Skip to content

Commit a66770b

Browse files
committed
fix touch
1 parent 781176f commit a66770b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cardstackview/src/main/java/me/brucezz/cardstackview/CardStackView.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,16 @@ public class CardStackView extends ViewGroup {
4141
private CardHolder mSelected;
4242

4343
private boolean mSkipLayout = false;
44+
private boolean mSkipTouch = false;
4445

4546
public void setSkipLayout(boolean skipLayout) {
4647
mSkipLayout = skipLayout;
4748
}
4849

50+
public void setSkipTouch(boolean skipTouch) {
51+
mSkipTouch = skipTouch;
52+
}
53+
4954
public CardStackView(Context context) {
5055
this(context, null);
5156
}
@@ -175,7 +180,6 @@ public void onLongPress(MotionEvent e) {
175180

176181
@Override
177182
public boolean onSingleTapUp(MotionEvent e) {
178-
179183
final CardHolder touch = mCardFactory.findByTouch(e.getY() - getPaddingTop());
180184
if (touch != null && mOnCardClickListener != null) {
181185
mOnCardClickListener.onClick(touch.mView, touch.mRealIndex, touch.mChildIndex);
@@ -214,6 +218,8 @@ private void updateOptions() {
214218
@Override
215219
public boolean onTouchEvent(MotionEvent event) {
216220

221+
if (mSkipTouch) return false;
222+
217223
if (event.getAction() == MotionEvent.ACTION_UP && mSelected == null) {
218224
resetCardSpan();
219225
}

0 commit comments

Comments
 (0)