File tree 1 file changed +8
-3
lines changed
library/src/main/java/com/stone/pile/libs
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 13
13
import android .view .ViewTreeObserver ;
14
14
import android .view .animation .DecelerateInterpolator ;
15
15
import android .view .animation .Interpolator ;
16
+ import android .view .animation .LinearInterpolator ;
16
17
import android .widget .FrameLayout ;
17
18
18
19
import java .util .ArrayList ;
@@ -50,7 +51,7 @@ public class PileLayout extends ViewGroup {
50
51
51
52
private float animateValue ;
52
53
private ObjectAnimator animator ;
53
- private Interpolator interpolator = new DecelerateInterpolator (2 .6f );
54
+ private Interpolator interpolator = new DecelerateInterpolator (1 .6f );
54
55
private Adapter adapter ;
55
56
private boolean hasSetAdapter = false ;
56
57
private float displayCount = 1.6f ;
@@ -262,12 +263,16 @@ public boolean onTouchEvent(MotionEvent event) {
262
263
int tag = Integer .parseInt (animatingView .getTag ().toString ());
263
264
264
265
// 计算目标位置
265
- float destX = originX .get (3 );
266
+ int destX = originX .get (3 );
266
267
if (velocity > VELOCITY_THRESHOLD || (animatingView .getLeft () > originX .get (3 ) + scrollDistanceMax / 2 && velocity > -VELOCITY_THRESHOLD )) {
267
268
destX = originX .get (4 );
268
269
tag --;
269
270
}
270
- if (tag < 0 || tag >= adapter .getItemCount () || Math .abs (animatingView .getLeft () - destX ) < mTouchSlop ) {
271
+ if (tag < 0 || tag >= adapter .getItemCount ()) {
272
+ return true ;
273
+ }
274
+
275
+ if (Math .abs (animatingView .getLeft () - destX ) < mTouchSlop && Math .abs (event .getX () - downX ) < mTouchSlop ) {
271
276
return true ;
272
277
}
273
278
You can’t perform that action at this time.
0 commit comments