Hello there, I am trying to set different texts based on whether an operation was successful or not. It fails to change the text and looks like it only changes the text for about less than half a second and goes back to the default text (or the first set `text).
CircularProgressButton progressButton = ((CircularProgressButton) v);
progressButton.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.sample_animation));
new CountDownTimer(1000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
((CircularProgressButton) v).startAnimation(() -> null);
}
@Override
public void onFinish() {
Random random = new Random();
boolean failed = random.nextBoolean();
if (failed) {
progressButton.revertAnimation(() -> null);
progressButton.setText(getResources().getString(R.string.try_again_accept_order));
progressButton.setBackground(ResourcesCompat.getDrawable(getActivity().getResources(), R.drawable.bamboo_button_green_accepted_order, null));
} else {
progressButton.revertAnimation(() -> null);
progressButton.setText(getResources().getString(R.string.accepted_order));
progressButton.setBackground(ResourcesCompat.getDrawable(getActivity().getResources(), R.drawable.bamboo_button_pink_accept_order, null));
}
}
}.start();
Hello there, I am trying to set different texts based on whether an operation was successful or not. It fails to change the text and looks like it only changes the text for about less than half a second and goes back to the default text (or the first set `text).
Here is an example.