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

FAB artifact on click when using com.google.android.material:material:1.1.0 #146

Open
mbfakourii opened this issue Feb 17, 2020 · 18 comments

Comments

@mbfakourii
Copy link

Hi this library is having a problem at Ripple
This is a problem when we click on the fab button
See the picture below to find out

@leinardi
Copy link
Owner

Please provide all the information required when you open a bug report:

  • Library version: ?
  • Android version: ?
  • Support library version: ?
  • Device brand: ?
  • Device model: ?

@mbfakourii
Copy link
Author

mbfakourii commented Feb 17, 2020

Library version: 3.1.1
Android version: API 21 Android 5.1.1
Support library version: Use AndroidX Verison appcompat:1.1.0 And material:1.1.0
Device brand: Huawei
Device model: huawei p7-l10

@mbfakourii
Copy link
Author

mbfakourii commented Feb 17, 2020

For better Test change Color overlay to black !

@leinardi
Copy link
Owner

I can reproduce the issue using com.google.android.material:material:1.1.0 but it seems already fixed on version com.google.android.material:material:1.2.0-alpha04.

I can't do anything about this since it's a bug of the google material library. My advice is to use the version 1.2.0-alpha04 if you can or don't use the material library at all.

@leinardi leinardi changed the title ripple has bug ! FAB artifact on click when using com.google.android.material:material:1.1.0 Feb 17, 2020
@mbfakourii
Copy link
Author

i use material:1.2.0-alpha04 But the problem was not solved

@mbfakourii
Copy link
Author

mbfakourii commented Feb 17, 2020

if google material library has bug Why this is ok ?
https://material.io/develop/android/components/floating-action-button/

i use both lib FloatingActionButtonSpeedDial and floating action button in the my project but only FloatingActionButtonSpeedDial has bug !

@drakeet
Copy link

drakeet commented Feb 18, 2020

Don't use paddingCompat can fix this. I am using this library in my app Pure Writer, and got the same bug on Android 5.1.1, I finally fixed it by using real margins and no clips.

@drakeet
Copy link

drakeet commented Feb 18, 2020

This bug can be reproduced on Android 5.1.1 emulator/AOSP ROM.

@drakeet
Copy link

drakeet commented Feb 18, 2020

Yes, it's the cause.

@mbfakourii
Copy link
Author

mbfakourii commented Feb 18, 2020

The bug will be solved
but
This is what it looks like

123

@mbfakourii
Copy link
Author

Items have the same bug :|

@mbfakourii
Copy link
Author

@leinardi help :(

@BrightVan
Copy link

you can try this:

public static void fixSpeedDialFab_5_x(@NonNull SpeedDialView speedDialView) {
        if (Build.VERSION.SDK_INT > 22 || Build.VERSION.SDK_INT < 21) {
            return;
        }
        speedDialView.getMainFab().setRippleColor(Color.TRANSPARENT);
        Class speedDialViewClass = speedDialView.getClass();
        try {
            Field fabWithLabelViewsField = speedDialViewClass.getDeclaredField("mFabWithLabelViews");
            fabWithLabelViewsField.setAccessible(true);
            Object targetObject = fabWithLabelViewsField.get(speedDialView);
            if (targetObject instanceof List) {
                List<FabWithLabelView> fabWithLabelViews = (List<FabWithLabelView>) targetObject;
                if (!fabWithLabelViews.isEmpty()) {
                    for (FabWithLabelView fabWithLabelView : fabWithLabelViews) {
                        fabWithLabelView.getFab().setRippleColor(Color.TRANSPARENT);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

@mbfakourii
Copy link
Author

@BrightVan
this code remove ripple :( and not work for items

@BrightVan
Copy link

@BrightVan
this code remove ripple :( and not work for items
the ripple effect is just fab bg become deeper when pressed.
of cource the code remove ripple.there is no other way to solve the problem quickly and compat. it's better than there show a strange ripple when pressed on api 22.
and what is the 'not work for items' means?the reflection code is for what ?

@drakeet
Copy link

drakeet commented Feb 26, 2020

I have provided the exact solution:

Don't use paddingCompat can fix this. I am using this library in my app Pure Writer, and got the same bug on Android 5.1.1, I finally fixed it by using real margins and no clips.

Remove FAB setUseCompatPadding(~~true~~) and use params.setMargins(padding, padding, padding, padding) instead. In the same time, setClipChildren(false)) in its parent view.

I am sorry, I made a lot of local changes to this library, so I can’t create a PR or share related code directly. But I can take a screenshot for the source code:

image

(You can see my app for the performance result https://play.google.com/store/apps/details?id=com.drakeet.purewriter)

@stale
Copy link

stale bot commented Apr 26, 2020

This issue has been automatically marked as stale because it has not had activity in the last 60 days.

@stale stale bot added the Status: Stale label Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants