Comments (6)
看的很用心呐 :)
if (mFragmentAnimator.getEnter() == 0) { mNeedDebounce = true; mFragmentAnimator.setEnter(R.anim.no_anim); }
上面的代码是,当用户设置了无动画(即FragmentAnimator.setEnter(0)或者使用DefalutNoAnimator时),mNeedDebounce设置为true,(字段名取的不好,下次commit修改下~)
在下面的
if (mNeedDebounce) { _mActivity.setFragmentClickable(true); }
就直接解除防抖动啦,github上的源码把上面的这个代码调整到onActivityCreated里,更合适些。
所以不用给mNoAnim设置监听了。
对了,我刚写了篇关于防抖动的文章:http://www.jianshu.com/p/9dbb03203fbc
onCreateAnimation里的mIsRoot是当某Fragment在Activity的栈底(即根Fragment)时,保证无动画的,这个是mIsRoot是0.1版本就存在的。
还是很感谢你的反馈哈 :)
from fragmentation.
是这样,我也被Fragment的各种问题困扰,想写出一套解决方案,恰好整个时候看到你的这个库.
mIsRoot我理解,下面的一个Activity
public class RechargeShellActivity extends BaseActivity {
public static Intent createIntent(Context context) {
Intent intent = new Intent(context, RechargeShellActivity.class);
return intent;
}
@Override
protected FragmentAnimator onCreateFragmentAnimator() {
//设置转场动画
return new DefaultVerticalAnimator();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTranslucentStatus();
setContentView(R.layout.activity_recharge);
if (null == savedInstanceState) {
//启动后,RechargeFragment的mIsRoot字段为true
start(RechargeFragment.newInstance());
}
initData();
}
@Override
protected int setContainerId() {
return R.id.container;
}
protected void initData() {
}
}
上面Activity启动RechargeFragment,onCreateAnimation()返回的应该是mNoAnim,启动后界面无法点击
from fragmentation.
感谢指出,我现在去查看下原因~
from fragmentation.
我刚看了下,按你这个代码,没出现界面无法点击的问题,你看下我的Demo,和你的代码一样,如果是无动画,会在onCreate里走(依赖0.6.3的话)
if (mNeedDebounce) { _mActivity.setFragmentClickable(true); }
PS:如果是github上的源码,是在onActivityCreated里走
如果可能,希望能加下我的QQ交流:328903522
from fragmentation.
我理解你的意思了,感谢,在为根Fragment设置了enter动画时确实有问题!!
稍后push修复该问题的commit
from fragmentation.
@duchengzhen 已push修复该问题,非常感谢~
from fragmentation.
Related Issues (20)
- viewpager嵌套viewpager,中第二个viewpager中的onLazyInitView和onSupportVisible步骤 HOT 1
- 不维护可能是随着谷歌逐步对fragment的优化,作者觉得越来越鸡肋了吧 HOT 2
- 结合ViewPager的父布局底部会被键盘顶起 HOT 3
- 废弃的原因是什么 HOT 4
- fragment栈的问题 must call loadRootFragment first HOT 1
- EasyFragmentation
- google 官方fragment 导航框架 navigation-fragment+navigation-ui HOT 7
- 消息队列管理为什么size==1才执行 ,如果>1 那么岂不是无法执行了? HOT 2
- viewpager上有输入框,输入框会把底部导航栏顶起来怎么怎么解决 HOT 1
- Fragmentation升级版, 欢迎试用
- 这么好的开源库放弃更新太可惜了,有大佬能和作者接触下接手吗? HOT 5
- 字体大小异常问题
- Fragmentation升级版,欢迎试用 HOT 1
- 如果viewpager在activity第一层级,初始化的时候viewpager中所有fragment的onLazyInitView都会被回调 HOT 2
- 为什么在Handler.post里调用onSupportVisible, 而不是直接调用? HOT 1
- popTo() has not been attached yet HOT 2
- onSupportVisible 在三星note5、s6上 不可用
- JCenter to be dismissed - please migrate to Maven Central HOT 1
- 使用popTo方法时被pop的Fragment不会调用onDestroy方法
- pop 动画在高版本(SDK 31,androidx.fragment 1.3.6)上异常
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fragmentation.