LoadingButtonAndroid icon indicating copy to clipboard operation
LoadingButtonAndroid copied to clipboard

Keep background resource border on doneLoadingAnimation

Open b-fg opened this issue 7 years ago • 4 comments

Hi, I am trying to keep the border (stroke) of my custom background when doneLoadingAnimation is called. Instead, I can only select the same color of my custom background but the stroke is lost in the process.

My custom background (request_button_background.xml) is:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <corners android:radius="12dp" />
    <solid android:color="@color/green" />
    <stroke
        android:width="1.5dp"
        android:color="@color/colorPrimaryDark" />
    <padding
        android:bottom="10dp"
        android:left="10dp"
        android:right="10dp"
        android:top="10dp" />
</shape>

My CircularProgressButton is defined as:

<br.com.simplepass.loading_button_lib.customViews.CircularProgressButton
        android:id="@+id/btn_request"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:elevation="30dp"
        android:textAlignment="center"
        android:background="@drawable/request_button_background"
        android:layout_marginEnd="20dp"
        app:layout_anchor="@id/app_bar"
        app:layout_anchorGravity="bottom|right"
        app:spinning_bar_width="4dp"
        app:spinning_bar_color="@color/white"
        app:spinning_bar_padding="2dp"
        android:paddingStart="20dp"
        android:paddingEnd="20dp"
        android:textSize="15sp"
        android:textColor="@color/black"
        android:textAllCaps="false"
        android:text="Request RSVP"/>

Finally I call the doneLoadingAnimation as follows

btn.doneLoadingAnimation(ContextCompat.getColor(EventInfoActivity.this, R.color.green),
                                        BitmapFactory.decodeResource(EventInfoActivity.this.getResources(),
                                        R.drawable.ic_check2));

Thanks for the support and the awesome library.

Bernat

b-fg avatar Mar 05 '18 15:03 b-fg

You're right the border goes away... The behaviour that your are requesting is not possible is this library for now. But that's a nice request! Lately It's being hard to find some free time to take care of all the issues/requests of this library, but I will take a look a this ASAP.

leandroBorgesFerreira avatar Mar 06 '18 12:03 leandroBorgesFerreira

If any one want's to implement this, help is more than welcome!

leandroBorgesFerreira avatar Mar 06 '18 12:03 leandroBorgesFerreira

hi, I had the same problem, but I just set the background to the XML again, and the border goes back to the start. setBackground(ContextCompat.getDrawable(MainActivity.this, R.drawable.button_shape_default_rounded));

MaildoLP avatar Aug 27 '18 18:08 MaildoLP

after set background again, my morph going to square image

lukaskris avatar Apr 29 '21 02:04 lukaskris