diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java index 621447f5a..d66573807 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java @@ -65,7 +65,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ private final TextView replies, boosts, favorites; private final View reply, boost, favorite, share, bookmark; private final ImageView favIcon; - private static AnimationSet animSet; + private static Animation spin; private View touchingView = null; @@ -87,6 +87,13 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ } }; + static { + spin = new RotateAnimation(0, 360, + Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, + 0.5f); + spin.setDuration(400); + } + public Holder(Activity activity, ViewGroup parent){ super(activity, R.layout.display_item_footer, parent); @@ -123,27 +130,6 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ share.setAccessibilityDelegate(buttonAccessibilityDelegate); } - private static final float ALPHA_PRESSED=0.55f; - - static { - AlphaAnimation opacityOut = new AlphaAnimation(1, ALPHA_PRESSED); - opacityOut.setDuration(300); - opacityOut.setInterpolator(CubicBezierInterpolator.DEFAULT); - opacityOut.setFillAfter(true); - AlphaAnimation opacityIn = new AlphaAnimation(ALPHA_PRESSED, 1); - opacityIn.setDuration(400); - opacityIn.setInterpolator(CubicBezierInterpolator.DEFAULT); - Animation spin = new RotateAnimation(0, 360, - Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, - 0.5f); - - animSet = new AnimationSet(true); - animSet.setInterpolator(CubicBezierInterpolator.DEFAULT); - animSet.addAnimation(spin); - animSet.addAnimation(opacityIn); - animSet.setDuration(400); - } - @Override public void onBind(FooterStatusDisplayItem item){ bindText(replies, item.status.repliesCount); @@ -386,10 +372,9 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ vibrateForAction(favorite, !status.favourited); AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setFavorited(status, !status.favourited, r->{ if (status.favourited && !GlobalUserPreferences.reduceMotion) { - v.startAnimation(animSet); - } else { - UiUtils.opacityIn(v); + v.startAnimation(spin); } + UiUtils.opacityIn(v); bindText(favorites, r.favouritesCount); }); } @@ -400,10 +385,9 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ vibrateForAction(favorite, !item.status.favourited); AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setFavorited(item.status, !item.status.favourited, r->{ if (item.status.favourited && !GlobalUserPreferences.reduceMotion) { - v.startAnimation(animSet); - } else { - UiUtils.opacityIn(v); + v.startAnimation(spin); } + UiUtils.opacityIn(v); bindText(favorites, r.favouritesCount); }); }