From ccacd88f801cde6222c6199de4c9a369f4a2c6d4 Mon Sep 17 00:00:00 2001 From: sk Date: Mon, 19 Dec 2022 15:42:32 +0100 Subject: [PATCH] tweak animations --- .../ui/displayitems/FooterStatusDisplayItem.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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 2b3957f91..f601bee41 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 @@ -60,12 +60,12 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ }; static { - opacityOut = new AlphaAnimation(1, 0.5f); + opacityOut = new AlphaAnimation(1, 0.7f); opacityOut.setDuration(200); opacityOut.setInterpolator(CubicBezierInterpolator.DEFAULT); opacityOut.setFillAfter(true); - opacityIn = new AlphaAnimation(0.5f, 1); - opacityIn.setDuration(150); + opacityIn = new AlphaAnimation(0.7f, 1); + opacityIn.setDuration(300); opacityIn.setInterpolator(CubicBezierInterpolator.DEFAULT); } @@ -120,6 +120,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ } private void onReplyClick(View v){ + v.startAnimation(opacityIn); Bundle args=new Bundle(); args.putString("account", item.accountID); args.putParcelable("replyTo", Parcels.wrap(item.status)); @@ -131,16 +132,17 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ // 20dp to center in middle of icon, because: (icon width = 24dp) / 2 + (paddingStart = 8dp) v.setPivotX(V.dp(20)); if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { - v.animate().scaleX(1).scaleY(1).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(100).start(); + v.animate().scaleX(1).scaleY(1).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(150).start(); if (action == MotionEvent.ACTION_UP) v.performClick(); + else v.startAnimation(opacityIn); } else if (action == MotionEvent.ACTION_DOWN) { - v.animate().scaleX(0.85f).scaleY(0.85f).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(50).start(); + v.startAnimation(opacityOut); + v.animate().scaleX(0.85f).scaleY(0.85f).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(75).start(); } return true; } private void onBoostClick(View v){ - v.startAnimation(opacityOut); boost.setSelected(!item.status.reblogged); AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setReblogged(item.status, !item.status.reblogged, r->{ v.startAnimation(opacityIn); @@ -149,7 +151,6 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ } private void onFavoriteClick(View v){ - v.startAnimation(opacityOut); favorite.setSelected(!item.status.favourited); AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setFavorited(item.status, !item.status.favourited, r->{ v.startAnimation(opacityIn); @@ -158,6 +159,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ } private void onShareClick(View v){ + v.startAnimation(opacityIn); Intent intent=new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, item.status.url);