leandroBorgesFerreira / LoadingButtonAndroid

A button to substitute the ProgressDialog
MIT License
1.94k stars 214 forks source link

Text not changing after revert Animation #140

Closed deepakbaliga closed 5 years ago

deepakbaliga commented 5 years ago

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();

Here is an example.

dexterleng commented 5 years ago

Running into this as well.

leandroBorgesFerreira commented 5 years ago

fixed in version 2.1.5

ardevd commented 4 years ago

This is still an issue for me on 2.2.0