Skip to content

Commit 3643e2f

Browse files
author
uis
committed
fixed 点击事件后自动轮播失效,支持轮播时间设置
1 parent 76b4615 commit 3643e2f

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

stackviewlayout/src/main/java/com/uis/stackviewlayout/StackViewLayout.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ public StackViewLayout(Context context, AttributeSet attrs, int defStyleAttr) {
8989
offsetX = (int)type.getDimension(R.styleable.StackViewLayout_stackOffsetX,dp(offsetX,metrics));
9090
paddingY = (int)type.getDimension(R.styleable.StackViewLayout_stackPaddingY,dp(paddingY,metrics));
9191
offsetY = (int)type.getDimension(R.styleable.StackViewLayout_stackOffsetY,dp(offsetY,metrics));
92+
mDuration = type.getInteger(R.styleable.StackViewLayout_stackDuration,mDuration);
93+
mDelay = type.getInteger(R.styleable.StackViewLayout_stackDelay,mDelay);
9294
type.recycle();
9395

9496
boolean isLeft = MODEL_LEFT == stackModel;
@@ -433,6 +435,10 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
433435
return true;
434436
}
435437
break;
438+
case MotionEvent.ACTION_CANCEL:
439+
case MotionEvent.ACTION_UP:
440+
startAutoPlay();
441+
break;
436442
}
437443
return false;
438444
}

stackviewlayout/src/main/res/values/attrs.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<attr name="stackAspectRatio" format="float"/>
1010
<attr name="stackEdge" format="dimension|reference" />
1111
<attr name="stackAutoPlay" format="boolean"/>
12+
<attr name="stackDelay" format="integer"/>
13+
<attr name="stackDuration" format="integer"/>
1214
<attr name="stackModel">
1315
<flag name="left" value="1"/>
1416
<flag name="right" value="2"/>

0 commit comments

Comments
 (0)