@@ -208,9 +208,10 @@ public void swipeLeft() {
208
208
}
209
209
210
210
View target = cardStackView .getTopView ();
211
+ View targetOverlay = cardStackView .getTopView ().getOverlayContainer ();
211
212
212
213
ValueAnimator rotation = ObjectAnimator .ofPropertyValuesHolder (
213
- target , PropertyValuesHolder .ofFloat ("rotation" , - 10f ));
214
+ target , PropertyValuesHolder .ofFloat ("rotation" , 10f ));
214
215
rotation .setDuration (200 );
215
216
ValueAnimator translateX = ObjectAnimator .ofPropertyValuesHolder (
216
217
target , PropertyValuesHolder .ofFloat ("translationX" , 0f , -2000f ));
@@ -220,10 +221,15 @@ public void swipeLeft() {
220
221
translateY .setStartDelay (100 );
221
222
translateX .setDuration (500 );
222
223
translateY .setDuration (500 );
223
- AnimatorSet set = new AnimatorSet ();
224
- set .playTogether (rotation , translateX , translateY );
224
+ AnimatorSet cardAnimationSet = new AnimatorSet ();
225
+ cardAnimationSet .playTogether (rotation , translateX , translateY );
226
+
227
+ ObjectAnimator overlayAnimator = ObjectAnimator .ofFloat (targetOverlay , "alpha" , 0f , 1f );
228
+ overlayAnimator .setDuration (200 );
229
+ AnimatorSet overlayAnimationSet = new AnimatorSet ();
230
+ overlayAnimationSet .playTogether (overlayAnimator );
225
231
226
- cardStackView .swipe (SwipeDirection .Left , set );
232
+ cardStackView .swipe (SwipeDirection .Left , cardAnimationSet , overlayAnimationSet );
227
233
}
228
234
229
235
public void swipeRight () {
@@ -233,9 +239,10 @@ public void swipeRight() {
233
239
}
234
240
235
241
View target = cardStackView .getTopView ();
242
+ View targetOverlay = cardStackView .getTopView ().getOverlayContainer ();
236
243
237
244
ValueAnimator rotation = ObjectAnimator .ofPropertyValuesHolder (
238
- target , PropertyValuesHolder .ofFloat ("rotation" , 10f ));
245
+ target , PropertyValuesHolder .ofFloat ("rotation" , - 10f ));
239
246
rotation .setDuration (200 );
240
247
ValueAnimator translateX = ObjectAnimator .ofPropertyValuesHolder (
241
248
target , PropertyValuesHolder .ofFloat ("translationX" , 0f , 2000f ));
@@ -245,10 +252,15 @@ public void swipeRight() {
245
252
translateY .setStartDelay (100 );
246
253
translateX .setDuration (500 );
247
254
translateY .setDuration (500 );
248
- AnimatorSet set = new AnimatorSet ();
249
- set .playTogether (rotation , translateX , translateY );
255
+ AnimatorSet cardAnimationSet = new AnimatorSet ();
256
+ cardAnimationSet .playTogether (rotation , translateX , translateY );
257
+
258
+ ObjectAnimator overlayAnimator = ObjectAnimator .ofFloat (targetOverlay , "alpha" , 0f , 1f );
259
+ overlayAnimator .setDuration (200 );
260
+ AnimatorSet overlayAnimationSet = new AnimatorSet ();
261
+ overlayAnimationSet .playTogether (overlayAnimator );
250
262
251
- cardStackView .swipe (SwipeDirection .Right , set );
263
+ cardStackView .swipe (SwipeDirection .Right , cardAnimationSet , overlayAnimationSet );
252
264
}
253
265
254
266
private void reverse () {
0 commit comments