Skip to content

Commit

Permalink
修复刷新View的一个重大bug
Browse files Browse the repository at this point in the history
  • Loading branch information
XinYiWorld committed May 20, 2017
1 parent ebd319a commit 3723737
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 108 deletions.
Binary file modified .gradle/2.14.1/taskArtifacts/cache.properties.lock
Binary file not shown.
Binary file modified .gradle/2.14.1/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/2.14.1/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file not shown.
Binary file modified .gradle/2.14.1/taskArtifacts/taskArtifacts.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
125 changes: 18 additions & 107 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void bindRecyclerView(final RecyclerView recyclerView) {
this.recyclerView = recyclerView;
if(touchListener == null ){
touchListener = new View.OnTouchListener() {
private float startY;
private float startY = -1;

@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
Expand All @@ -102,6 +102,7 @@ public boolean onTouch(View view, MotionEvent motionEvent) {
setRefreshingState(mRefreshingStateNode.set(RefreshingState.NONE, RefreshingState.PULL_TO_REFRESH));
} else if (action == MotionEvent.ACTION_MOVE) {
float currentY = motionEvent.getY();
if(startY == -1) startY = currentY; //防止直接走了move没有走down事件,导致startY为0.
double detY = currentY - startY;
if(detY < 0 && refreshViewHolder.ll_root.getPaddingTop()<=-originalRefreshViewHeight){ //如果一开始就向上滑动,默认是加载更多。(*****************************************)
Log.i(TAG, "onTouch: 加载更多");
Expand Down

0 comments on commit 3723737

Please sign in to comment.