fix(custom-local-timelines): translate button now works
This commit is contained in:
@@ -193,26 +193,51 @@ public class TextStatusDisplayItem extends StatusDisplayItem{
|
|||||||
translateProgress.setVisibility(View.VISIBLE);
|
translateProgress.setVisibility(View.VISIBLE);
|
||||||
translateButton.setClickable(false);
|
translateButton.setClickable(false);
|
||||||
translateButton.animate().alpha(0.5f).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(150).start();
|
translateButton.animate().alpha(0.5f).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(150).start();
|
||||||
new TranslateStatus(item.status.id).setCallback(new Callback<>() {
|
if(item.status.reloadWhenClicked){
|
||||||
@Override
|
UiUtils.lookupStatus(item.parentFragment.getContext(), item.status, item.parentFragment.getAccountID(), null, status1 -> {
|
||||||
public void onSuccess(TranslatedStatus translatedStatus) {
|
new TranslateStatus(status1.id).setCallback(new Callback<>() {
|
||||||
item.translation = translatedStatus;
|
@Override
|
||||||
item.translated = true;
|
public void onSuccess(TranslatedStatus translatedStatus) {
|
||||||
if (item.parentFragment.getActivity() == null) return;
|
item.translation = translatedStatus;
|
||||||
translateProgress.setVisibility(View.GONE);
|
item.translated = true;
|
||||||
translateButton.setClickable(true);
|
if (item.parentFragment.getActivity() == null) return;
|
||||||
translateButton.animate().alpha(1).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(50).start();
|
translateProgress.setVisibility(View.GONE);
|
||||||
rebind();
|
translateButton.setClickable(true);
|
||||||
}
|
translateButton.animate().alpha(1).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(50).start();
|
||||||
|
rebind();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
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.animate().alpha(1).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(50).start();
|
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());
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
new TranslateStatus(item.status.id).setCallback(new Callback<>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(TranslatedStatus translatedStatus) {
|
||||||
|
item.translation = translatedStatus;
|
||||||
|
item.translated = true;
|
||||||
|
if (item.parentFragment.getActivity() == null) return;
|
||||||
|
translateProgress.setVisibility(View.GONE);
|
||||||
|
translateButton.setClickable(true);
|
||||||
|
translateButton.animate().alpha(1).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(50).start();
|
||||||
|
rebind();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(ErrorResponse error) {
|
||||||
|
translateProgress.setVisibility(View.GONE);
|
||||||
|
translateButton.setClickable(true);
|
||||||
|
translateButton.animate().alpha(1).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(50).start();
|
||||||
|
error.showToast(itemView.getContext());
|
||||||
|
}
|
||||||
|
}).exec(item.parentFragment.getAccountID());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
item.translated = !item.translated;
|
item.translated = !item.translated;
|
||||||
rebind();
|
rebind();
|
||||||
|
|||||||
Reference in New Issue
Block a user