animate translate button opacity

This commit is contained in:
sk 2022-12-21 16:19:08 +01:00 committed by LucasGGamerM
parent b36c7375dd
commit afb518cf8e
1 changed files with 4 additions and 3 deletions

View File

@ -31,6 +31,7 @@ import me.grishka.appkit.api.ErrorResponse;
import me.grishka.appkit.imageloader.ImageLoaderViewHolder; import me.grishka.appkit.imageloader.ImageLoaderViewHolder;
import me.grishka.appkit.imageloader.MovieDrawable; import me.grishka.appkit.imageloader.MovieDrawable;
import me.grishka.appkit.imageloader.requests.ImageLoaderRequest; import me.grishka.appkit.imageloader.requests.ImageLoaderRequest;
import me.grishka.appkit.utils.CubicBezierInterpolator;
import me.grishka.appkit.utils.V; import me.grishka.appkit.utils.V;
public class TextStatusDisplayItem extends StatusDisplayItem{ public class TextStatusDisplayItem extends StatusDisplayItem{
@ -155,7 +156,7 @@ public class TextStatusDisplayItem extends StatusDisplayItem{
if (item.translation == null) { if (item.translation == null) {
translateProgress.setVisibility(View.VISIBLE); translateProgress.setVisibility(View.VISIBLE);
translateButton.setClickable(false); translateButton.setClickable(false);
translateButton.setAlpha(.50f); translateButton.animate().alpha(0.5f).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(150).start();
new TranslateStatus(item.status.id).setCallback(new Callback<>() { new TranslateStatus(item.status.id).setCallback(new Callback<>() {
@Override @Override
public void onSuccess(TranslatedStatus translatedStatus) { public void onSuccess(TranslatedStatus translatedStatus) {
@ -163,7 +164,7 @@ public class TextStatusDisplayItem extends StatusDisplayItem{
item.translated = true; item.translated = true;
translateProgress.setVisibility(View.GONE); translateProgress.setVisibility(View.GONE);
translateButton.setClickable(true); translateButton.setClickable(true);
translateButton.setAlpha(1f); translateButton.animate().alpha(1).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(50).start();
rebind(); rebind();
} }
@ -171,7 +172,7 @@ public class TextStatusDisplayItem extends StatusDisplayItem{
public void onError(ErrorResponse error) { public void onError(ErrorResponse error) {
translateProgress.setVisibility(View.GONE); translateProgress.setVisibility(View.GONE);
translateButton.setClickable(true); translateButton.setClickable(true);
translateButton.setAlpha(1f); translateButton.animate().alpha(1).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(50).start();
error.showToast(itemView.getContext()); error.showToast(itemView.getContext());
} }
}).exec(item.parentFragment.getAccountID()); }).exec(item.parentFragment.getAccountID());