Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically setting text doesn't reflect after reverting animation #150

Open
somesh-basicx opened this issue Oct 31, 2019 · 8 comments
Open
Labels

Comments

@somesh-basicx
Copy link

somesh-basicx commented Oct 31, 2019

I am using CircularProgressButton in XML like this

<br.com.simplepass.loadingbutton.customViews.CircularProgressButton
        android:id="@+id/btnSelfCheckInCheckOut"
        style="@style/Widget.MaterialComponents.Button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:spinning_bar_color="@color/color_on_primary"
        tools:text="Check In"
        tools:visibility="visible" />`

and button setting the text on button inside my fragment and start the animation like this btnSelfCheckInCheckOut.startAnimation() and when I revert the animation the dynamically applied text is lost. I found a workout for this by calling saveInitialState() after changing text.

@leandroBorgesFerreira
Copy link
Owner

Hello @somesh-basicx. You're right, I can reproduce this bug. Thanks for catching this! I'll take a look and fix it as soon as I can. Mean while, you can workaround this by using the call back in the revertAnimation():

val buttonText = buttonTest1.text

buttonTest1.startAnimation()
buttonTest1.revertAnimation {
        buttonTest1.text = buttonText
}

@somesh-basicx
Copy link
Author

Any plan to fix this issue?

@oth-libs
Copy link

oth-libs commented Jan 30, 2020

@somesh-basicx I had the same issue, seems to be fixed in latest version 2.2.0
hmm.. nevermind, still there, but
revertAnimation{btn.text = "blaah"} does the job

@ardevd
Copy link

ardevd commented Apr 23, 2020

Is there any Java equivalent to this workaround? I can't seem to find that constructor.

@Swati-soni-14
Copy link

@ardevd Did you get the solution? I need to set text after revert Animation. Text Setting and being changed as defined in XML class

@ardevd
Copy link

ardevd commented Apr 26, 2020

@Swati-soni-14 No, I haven't found a solution yet.

@sebasira
Copy link

I'm also looking forward to achieve this in Java. Any updates?

@leandroBorgesFerreira
Copy link
Owner

leandroBorgesFerreira commented Mar 23, 2021

I know that I'm answering this several months later... But the Java workaround was always available:

progressButton.revertAnimation(new OnAnimationEndListener() {
            @Override
            public void onAnimationEnd() {
                //Change the text here!!
            }
        });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants