LoadingButtonAndroid icon indicating copy to clipboard operation
LoadingButtonAndroid copied to clipboard

Dynamically setting text doesn't reflect after reverting animation

Open somesh-basicx opened this issue 6 years ago • 8 comments
trafficstars

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.

somesh-basicx avatar Oct 31 '19 11:10 somesh-basicx

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
}

leandroBorgesFerreira avatar Nov 01 '19 09:11 leandroBorgesFerreira

Any plan to fix this issue?

somesh-basicx avatar Jan 25 '20 09:01 somesh-basicx

@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

oth-libs avatar Jan 30 '20 12:01 oth-libs

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

ardevd avatar Apr 23 '20 09:04 ardevd

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

Swati-soni-14 avatar Apr 26 '20 12:04 Swati-soni-14

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

ardevd avatar Apr 26 '20 18:04 ardevd

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

sebasira avatar Oct 24 '20 20:10 sebasira

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!!
            }
        });

leandroBorgesFerreira avatar Mar 23 '21 17:03 leandroBorgesFerreira