Skip to content

Commit 53ed8fd

Browse files
bug fix, overlay not working when performSwipe arg3: overlayAnimatorSet is null
1 parent a219e4b commit 53ed8fd

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

cardstackview/src/main/java/com/yuyakaido/android/cardstackview/CardStackView.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,19 +262,26 @@ public void performSwipe(Point point, final Animator.AnimatorListener listener)
262262
}
263263

264264
public void performSwipe(SwipeDirection direction, AnimatorSet set, AnimatorSet overlayAnimatorSet, final Animator.AnimatorListener listener) {
265-
if (direction == SwipeDirection.Left) {
265+
boolean showOverlay;
266+
if (showOverlay = direction == SwipeDirection.Left) {
266267
getTopView().showLeftOverlay();
267-
getTopView().setOverlayAlpha(overlayAnimatorSet);
268-
} else if (direction == SwipeDirection.Right) {
268+
} else if (showOverlay = direction == SwipeDirection.Right) {
269269
getTopView().showRightOverlay();
270-
getTopView().setOverlayAlpha(overlayAnimatorSet);
271-
} else if (direction == SwipeDirection.Bottom){
270+
} else if (showOverlay = direction == SwipeDirection.Bottom){
272271
getTopView().showBottomOverlay();
273-
getTopView().setOverlayAlpha(overlayAnimatorSet);
274-
} else if (direction == SwipeDirection.Top){
272+
} else if (showOverlay = direction == SwipeDirection.Top){
275273
getTopView().showTopOverlay();
276-
getTopView().setOverlayAlpha(overlayAnimatorSet);
274+
} else {
275+
showOverlay = false;
277276
}
277+
if(showOverlay) {
278+
if(overlayAnimatorSet != null) {
279+
getTopView().setOverlayAlpha(overlayAnimatorSet);
280+
} else {
281+
getTopView().setOverlayAlpha(1f);
282+
}
283+
}
284+
278285
set.addListener(listener);
279286
set.setInterpolator(new TimeInterpolator() {
280287
@Override

0 commit comments

Comments
 (0)