fix: make favorite button spin again
This commit is contained in:
@@ -65,7 +65,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
|||||||
private final TextView replies, boosts, favorites;
|
private final TextView replies, boosts, favorites;
|
||||||
private final View reply, boost, favorite, share, bookmark;
|
private final View reply, boost, favorite, share, bookmark;
|
||||||
private final ImageView favIcon;
|
private final ImageView favIcon;
|
||||||
private static AnimationSet animSet;
|
private static Animation spin;
|
||||||
|
|
||||||
|
|
||||||
private View touchingView = null;
|
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){
|
public Holder(Activity activity, ViewGroup parent){
|
||||||
super(activity, R.layout.display_item_footer, parent);
|
super(activity, R.layout.display_item_footer, parent);
|
||||||
|
|
||||||
@@ -123,27 +130,6 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
|||||||
share.setAccessibilityDelegate(buttonAccessibilityDelegate);
|
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
|
@Override
|
||||||
public void onBind(FooterStatusDisplayItem item){
|
public void onBind(FooterStatusDisplayItem item){
|
||||||
bindText(replies, item.status.repliesCount);
|
bindText(replies, item.status.repliesCount);
|
||||||
@@ -386,10 +372,9 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
|||||||
vibrateForAction(favorite, !status.favourited);
|
vibrateForAction(favorite, !status.favourited);
|
||||||
AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setFavorited(status, !status.favourited, r->{
|
AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setFavorited(status, !status.favourited, r->{
|
||||||
if (status.favourited && !GlobalUserPreferences.reduceMotion) {
|
if (status.favourited && !GlobalUserPreferences.reduceMotion) {
|
||||||
v.startAnimation(animSet);
|
v.startAnimation(spin);
|
||||||
} else {
|
|
||||||
UiUtils.opacityIn(v);
|
|
||||||
}
|
}
|
||||||
|
UiUtils.opacityIn(v);
|
||||||
bindText(favorites, r.favouritesCount);
|
bindText(favorites, r.favouritesCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -400,10 +385,9 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
|||||||
vibrateForAction(favorite, !item.status.favourited);
|
vibrateForAction(favorite, !item.status.favourited);
|
||||||
AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setFavorited(item.status, !item.status.favourited, r->{
|
AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setFavorited(item.status, !item.status.favourited, r->{
|
||||||
if (item.status.favourited && !GlobalUserPreferences.reduceMotion) {
|
if (item.status.favourited && !GlobalUserPreferences.reduceMotion) {
|
||||||
v.startAnimation(animSet);
|
v.startAnimation(spin);
|
||||||
} else {
|
|
||||||
UiUtils.opacityIn(v);
|
|
||||||
}
|
}
|
||||||
|
UiUtils.opacityIn(v);
|
||||||
bindText(favorites, r.favouritesCount);
|
bindText(favorites, r.favouritesCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user