Comments (1)
这是我当时为了解决一个bug写的一段chenglish,见笑了。
当前状态是SWIPING_TO_REFRESH
的时候,抬起手指,然后落下手指。如果这时候状态依然是SWIPEING_TO_REFRESH
(当速度特别快的时候,header没有收缩到原位,所以这种情况是可能的。)
当时onInterceptTouchEvent
ACTION_DOWN中是这样的:
if (!(STATUS.isRefreshComplete(mStatus) || STATUS.isLoadMoreComplete(mStatus))
&& !(STATUS.isRefreshing(mStatus) || STATUS.isLoadingMore(mStatus))) {
mAutoScroller.abortIfRunning();
}
这时候明显if条件是成立的,所以
mAutoScroller.abortIfRunning();
会执行,让scroller停止。
这时候手指如果移动,在ACTION_MOVE
中的triggerCondition为false。
boolean triggerCondition = (yInitDiff > 0 && moved && onCheckCanRefresh())
|| (yInitDiff < 0 && moved && onCheckCanLoadMore());
if (triggerCondition) {
// the trigger condition refresh or load more is true
// intercept the move action event and pass it to SwipeToLoadLayout#onTouchEvent()
return true;
}
这次事件就不能拦截在SwipeToLoadLayout中,而是会传向swipe_tagert这id的子view的onTouchEevent
。所以随后的ACTION_UP和ACTION_CANCEL都不会传向onInterceptTouchEvent
和onTouchEvent
。
而我在SwipeToLoadLayout的onTouchEvent的
ACTION_UP和
ACTION_CANCEL中调用了
onActivePointerUp()`来让scroller运行,让header弹回去。
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (mActivePointerId == INVALID_POINTER) {
return false;
}
onActivePointerUp();
mActivePointerId = INVALID_POINTER;
break;
所以,就导致了当时header会卡住的bug。
然后当时的处理方式是,把onActivePointerUp()
放在dispatchTouchEvent
中去执行。bug就fix了。
当时处理这个问题用的时间比较长,然后就做了一下简单的记录。
从现在的代码里面应该是找不到轨迹了,应该删掉的,对你造成了误导,不好意思啊。
看这里:
from swipetoloadlayout.
Related Issues (20)
- ListView emptyView,求指教 怎么处理。 HOT 1
- maven库拉不下来,能不能换到jcenter库
- 请问如何配置下拉阻力系数?下拉时越往下移动距离越小 HOT 1
- 事件拦截!!!急 HOT 3
- 瀑布流的上拉刷新,如何处理才能不显示不对齐的空白
- 正在刷新的状态下,reclycleview居然可以上滑 HOT 1
- 当嵌套ListView发现滑动冲突问题 HOT 1
- 上拉或下拉 刷新时 SwipeTrigger void onMove(int y, boolean isComplete, boolean automatic);
- onMove(int y, boolean isComplete, boolean automatic);建议还是改为 float 类型 做一些效果时 距离精度丢失了
- 下拉刷新刷新完成有时候头布局一直在转
- 崩!
- 有个问题
- 作者这个库不维护了吗
- 子控件大小设置为自适应,SwipeToLoadLayout,子控件内容发生变化,但控件大小无法改变 HOT 1
- 最新版的isRefreshing()接口在下拉刷新后一直显示为true,不能用于判断刷新状态。
- CoordinatorLayout嵌套SwipeToLoadLayout出现滑动冲突 HOT 3
- 在fragment生命周期onActivityCreated中发生null pointer exception
- swipe_target should chagne to android:tag
- CoordinatorLayout
- 当recyclerview添加了footerview之后又隐藏的话不能上拉加载更多
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 swipetoloadlayout.