leandroBorgesFerreira / LoadingButtonAndroid

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

After tap on follow button, I would like to change button text as "follow" or "unfollow",button text is not changed #15

Closed Seroja1010 closed 7 years ago

Seroja1010 commented 7 years ago

followBtn.revertAnimation(new OnAnimationEndListener() { @Override public void onAnimationEnd() { if (selectedUser.isFollowing) { followBtn.setText("Unfollow"); } else { followBtn.setText("Follow"); } } });

.... followBtn.revertAnimation();

leandroBorgesFerreira commented 7 years ago

Witch one are you calling? The first or the second option of code that you presented?

Seroja1010 commented 7 years ago

both case is not working. And when I apply rounded corner shape to button. Once revert, It's changed rectangle corner

On Thu, Jun 1, 2017 at 8:40 PM, Leandro Borges Ferreira < notifications@github.com> wrote:

Witch one are you calling? The first or the second option of code that you presented?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/leandroBorgesFerreira/LoadingButtonAndroid/issues/15#issuecomment-305566677, or mute the thread https://github.com/notifications/unsubscribe-auth/ATaol0oyxINjbMK6nuncJoHwto79ZJKwks5r_veXgaJpZM4NtCYI .

leandroBorgesFerreira commented 7 years ago

Hi Seroja1010,

I just tested with 1.7.2 version (the current one) and it worked just fine, I believe that you are not setting the value of your selectedUser.isFollowing properly. You can test without any logic inside OnEndAnimationListener to make sure that the problem is not in your code.

I also just tested the revert corner. It also works fine. I believe that you are not setting the final corner angle in your XML like this:

app:finalCornerAngle="50dp"

If you don't set this variable, it is going to use the default value that is 0dp. So you will end with squared button. Just set the app:finalCornerAngle and you will have a rounded button

Seroja1010 commented 7 years ago

Thanks I will test

On Mon, Jun 5, 2017 at 1:28 AM, Leandro Borges Ferreira < notifications@github.com> wrote:

Hi Seroja1010,

I just tested with 1.7.2 version (the current one) and it worked just fine, I believe that you are not setting the value of your sleectedUser.isFollowing properlly. You can test without any logic inside OnEndAnimationListener to make sure that the problem is not in your code.

I also just tested the revert corner. It also works fine. I believe that you are not setting the final corner angle in your XML like this:

app:finalCornerAngle="50dp"

If you don't set this variable, it is going to use the default value that is 0dp. So you will end with squared button. Just set the app:finalCornerAngle and you will have a rounded button

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/leandroBorgesFerreira/LoadingButtonAndroid/issues/15#issuecomment-306071591, or mute the thread https://github.com/notifications/unsubscribe-auth/ATaolwDMWC3YXYrSHI_Gnl1fl8M-nlHxks5sAy-ngaJpZM4NtCYI .

leandroBorgesFerreira commented 7 years ago

Hello Seroja1010, Did the solution work for you?

leandroBorgesFerreira commented 7 years ago

@Seroja1010 I am closing this issue assuming that the solution worked for you. Feel free to reopen it if you have any problem

ClarkXP commented 6 years ago

I have a similar bug, I using CircularProgressImageButton. Then when I call revertAnimation with callback, only is changed the background, isn't changing ImageDrawable and SpinningBarColor.

btnPersonFollow.revertAnimation(new OnAnimationEndListener() {
            @Override
            public void onAnimationEnd() {
                boolean followingOrPending = Arrays.asList(FollowStatus.FollowStatusAccepted, FollowStatus.FollowStatusPending, FollowStatus.FollowStatusRejected).contains(getPerson().followingStatus);
                if (followingOrPending) {
                    btnPersonFollow.setBackgroundResource(R.drawable.bg_button_following);
                    btnPersonFollow.setImageResource(R.drawable.person_check);
                    btnPersonFollow.setSpinningBarColor(ResourcesCompat.getColor(viewHolder.itemView.getResources(),R.color.suda_blue_medium,null));

                } else {
                    btnPersonFollow.setBackgroundResource(R.drawable.bg_button_following_outline);
                    btnPersonFollow.setImageResource(R.drawable.person_add);
                    btnPersonFollow.setSpinningBarColor(ResourcesCompat.getColor(viewHolder.itemView.getResources(),R.color.suda_cyan,null));
                }
            }
        });