Scalified / fab

Floating Action Button Library for Android
Apache License 2.0
849 stars 164 forks source link

Ripple state reset on UP_ACTION outside of FAB #39

Open fritzsche91 opened 8 years ago

fritzsche91 commented 8 years ago

In order to reset the ActionButton state on an UP_ACTION outside of the view bounds, I had to include the following workaround:

actionButton.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(@NonNull View view, @NonNull MotionEvent event) {
        int action = event.getAction();
        if((action == MotionEvent.ACTION_CANCEL) || (action == MotionEvent.ACTION_UP)) {
            actionButton.setState(ActionButton.State.NORMAL); // fix ripple handling
        }
        return false; // default handling
    }
});
vbaidak commented 8 years ago

Hi fritzsche91,

Could you please provide the case and the issue itself in more details?

As far as I understood you are leaving the view bounds while the ActionButton is pressed?

fritzsche91 commented 8 years ago

Hi,

This is the step-by-step use case:

vbaidak commented 8 years ago

Hi,

This issue was fixed in version 1.1.0.

I'm showing this fix in this video: https://youtu.be/7GHAcX2myh8

What version are you using?

fritzsche91 commented 8 years ago

The version I am using right now is 1.1.2. So it seems, that the mentioned issue has not been fixed for my Nexus 5.

vbaidak commented 8 years ago

The problem is that I can't reproduce it. Is it specific only for Nexus 5?

Could you please try to use demo application from the project to check this?

fritzsche91 commented 8 years ago

The thing is that I tested it only with my Nexus 5 for now. As I have only very limited time the next days, I am not sure if I am able to do more testing on this.

I used your ActionButton with the following configuration:

<com.software.shell.fab.ActionButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:button_color="@color/fab_material_pink_500"
    app:button_colorPressed="@color/fab_material_pink_500"
    app:image="@drawable/ic_thumb_up_white"
    app:rippleEffect_enabled="true" />
vbaidak commented 8 years ago

Good, I'll check it soon (currently my PC is disassembled)

Anyway I can add the code you've sent into the library as a quick fix

fritzsche91 commented 8 years ago

Sounds good to me, because it shouldn't break anything and fixed it for my Nexus 5.