Skip to content

Commit

Permalink
Delete the redundant code.
Browse files Browse the repository at this point in the history
  • Loading branch information
lcodecorex committed Mar 10, 2017
1 parent 81b38c4 commit cd6a64c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 54 deletions.
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android {
buildToolsVersion '25.0.1'

defaultConfig {
minSdkVersion 12
minSdkVersion 14
targetSdkVersion 25
versionCode 6
versionName "1.06"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.lcodecore.tkrefreshlayout.Footer;
package com.lcodecore.tkrefreshlayout.footer;

import android.animation.ValueAnimator;
import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.lcodecore.tkrefreshlayout.Footer;
package com.lcodecore.tkrefreshlayout.footer;

import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ protected void onFinishInflate() {
super.onFinishInflate();
//获得子控件
//onAttachedToWindow方法中mChildView始终是第0个child,把header、footer放到构造函数中,mChildView最后被inflate
//TODO 可能引入新问题:1.fixedHeader显示异常 2.悬浮刷新不可见
mChildView = getChildAt(3);

cp.init();
Expand Down Expand Up @@ -239,56 +238,6 @@ public boolean dispatchTouchEvent(MotionEvent event) {

return super.dispatchTouchEvent(event);
}
/*TODO 保留方案,解决refresh在滚动中刷新失效问题
private float mTouchX, mTouchY;
private boolean intercepted = false;
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
mTouchX = ev.getX();
mTouchY = ev.getY();
break;
case MotionEvent.ACTION_MOVE:
float dx = ev.getX() - mTouchX;
float dy = ev.getY() - mTouchY;
if (Math.abs(dx) <= Math.abs(dy)) {//滑动允许最大角度为45度
//ListView向上滚动时这里执行不到,想办法拦截掉这个事件,不让它向下传递
//模拟拦截事件
if (!intercepted){
if (dy > 0 && !ScrollingUtil.canChildScrollUp(cp.getScrollableView()) && cp.allowPullDown()){
cp.setStatePTD();
intercepted = true;
}else if (dy < 0 && !ScrollingUtil.canChildScrollDown(cp.getScrollableView()) && cp.allowPullUp()) {
cp.setStatePBU();
intercepted = true;
}else return super.dispatchTouchEvent(ev);
}
//事件已拦截到
if (cp.isStatePTD()){
dy = Math.min(cp.getMaxHeadHeight() * 2, dy);
dy = Math.max(0, dy);
cp.getAnimProcessor().scrollHeadByMove(dy);
}else if(cp.isStatePBU()){
dy = Math.min(cp.getBottomHeight() * 2, Math.abs(dy));
dy = Math.max(0, dy);
cp.getAnimProcessor().scrollBottomByMove(dy);
}
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (cp.isStatePTD()) {
cp.getAnimProcessor().dealPullDownRelease();
} else if (cp.isStatePBU()) {
cp.getAnimProcessor().dealPullUpRelease();
}
intercepted = false;
break;
}
return super.dispatchTouchEvent(ev);
}*/

/**
* 拦截事件
Expand Down

0 comments on commit cd6a64c

Please sign in to comment.