fix bug in bookmark button

closes #167
This commit is contained in:
sk 2022-12-19 11:59:15 -03:00 committed by LucasGGamerM
parent d0d1d15de5
commit 09a0faacba
1 changed files with 9 additions and 10 deletions

View File

@ -26,8 +26,6 @@ import org.joinmastodon.android.model.StatusPrivacy;
import org.joinmastodon.android.ui.utils.UiUtils;
import org.parceler.Parcels;
import java.text.DecimalFormat;
import me.grishka.appkit.Nav;
import me.grishka.appkit.utils.CubicBezierInterpolator;
import me.grishka.appkit.utils.V;
@ -63,12 +61,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);
}
@ -131,6 +129,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));
@ -142,16 +141,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);
@ -160,7 +160,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);
@ -169,7 +168,6 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
}
private void onBookmarkClick(View v){
v.startAnimation(opacityOut);
bookmark.setSelected(item.status.bookmarked);
AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setBookmarked(item.status, !item.status.bookmarked, r->{
v.startAnimation(opacityIn);
@ -177,6 +175,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);