Fixed
Status Update
Comments
ad...@google.com <ad...@google.com> #2
We have passed this to the development team and will update this issue with more information as it becomes available.
ck...@google.com <ck...@google.com>
ol...@asos.com <ol...@asos.com> #3
Same issue exists with Support Library 28.0.0-rc01
na...@gmail.com <na...@gmail.com> #4
Hope you are not releasing 28.0.0 with this bug :)
[Deleted User] <[Deleted User]> #5
Seems Google really needs to hire some manual QAs?
iv...@gmail.com <iv...@gmail.com> #6
+1 The problem is present in version 28.0.0-rc01
le...@gmail.com <le...@gmail.com> #7
This should have a higher priority: the first release candidate for 28.0.0 is already out and not a single feedback for this issue was given.
ck...@google.com <ck...@google.com> #8
There are a few commits that seem related where we've previously tried to fix things only to introduce more bugs like this one.
https://github.com/material-components/material-components-android/commit/f3f2bad971e3423cfe676a7c7b522f180a837ac6
https://github.com/material-components/material-components-android/commit/219d4e51370f5bad9d93e5f40d91c918dce5517f
https://github.com/material-components/material-components-android/commit/62c08684398050472881a85f880457db9a70db5f
A solution to this bug requires understanding what bugs those commits we're originally trying to fix, and why it didn't work.
A solution to this bug requires understanding what bugs those commits we're originally trying to fix, and why it didn't work.
th...@gmail.com <th...@gmail.com> #9
When the show animation starts the variable imageMatrixScale is set to 0f (line 449). The AnimatorSet animates the matrix to value SHOW_ICON_SCALE = 1f (line 457). However, the method setImageMatrixScale is never called again with value 1f so the variable imageMatrixScale is never set to 1f again. That explains why the issue only occurs when changing the icon after the show animation. So somewhere the variable needs to be set to 1f so if the icon changes again the 'new' value is used.
So the variable needs to be set to 0f/1f again. Is onAnimationEnd (line 406 and 469) a good place to set the value? Or would onAnimationStart be better?
So the variable needs to be set to 0f/1f again. Is onAnimationEnd (line 406 and 469) a good place to set the value? Or would onAnimationStart be better?
ck...@google.com <ck...@google.com>
ku...@gmail.com <ku...@gmail.com> #10
When are you going to release this bug fix? Is there any quick fix for the current version?
ck...@google.com <ck...@google.com> #11
You might be able to get around it by removing the fab from the layout after it has been hidden, calling show() on the fab, setting the icon, calling hide() and then adding the fab back to the layout. I haven't tried it yet though. You should also be able to use reflection to get access to the FloatingActionButtonImpl backing the fab, and then call setImageMatrixScale(1) on that instance.
th...@gmail.com <th...@gmail.com> #12
There's a workaround using reflection in the attached sample project. Make sure to add the correct proguard rules.
[Deleted User] <[Deleted User]> #13
When to release the fix +1
mu...@gmail.com <mu...@gmail.com> #14
Bug still present in 28.0 stable
le...@gmail.com <le...@gmail.com> #15
> Bug still present in 28.0 stable
Unbelievable.
Unbelievable.
ma...@y20k.org <ma...@y20k.org> #16
Is there a timeline for a fix? 28.0.1? I am holding back an update to my app that otherwise would introduce the bug into a production version.
ma...@y20k.org <ma...@y20k.org> #17
PS. Why is the bug's status "fixed"?
er...@gmail.com <er...@gmail.com> #18
As ck@google has mentioned, there is a work around. See my SO answer for a simpler method that still looks good by incorporating hide show animation that you can use in production.
Otherwise we can only wait for the fix or create a pull request, staring this will get this issue more recognition, not by pinging all followers in this thread.
Workaround:
https://stackoverflow.com/questions/49587945/setimageresourceint-doesnt-work-after-setbackgroundtintcolorlistcolorstateli/52158081#52158081
Otherwise we can only wait for the fix or create a pull request, staring this will get this issue more recognition, not by pinging all followers in this thread.
Workaround:
ck...@google.com <ck...@google.com> #19
This has been marked as fixed because it was publicly released to github. We're currently going through a bit of a rough time for releases now because of the switch to jetback. Soon we should have full control over our releases and release schedule.
ck...@google.com <ck...@google.com> #20
jetpack*
mv...@gmail.com <mv...@gmail.com> #21
It isn't fixed.
My temporary solution was hide, change icon and show button.
See here the duplicate bughttps://issuetracker.google.com/issues/117145133
Open drive link and video&code folder.
My temporary solution was hide, change icon and show button.
See here the duplicate bug
Open drive link and video&code folder.
er...@gmail.com <er...@gmail.com> #22
@ ck...@google.com
On the basis of your recommendation on item #11 above, Mike M. proposed the following code (seehttps://stackoverflow.com/questions/53750074/correct-use-of-reflection-to-get-a-class-method ):
if (!fab.isShown()) {
fab.setImageDrawable(STEP_ICON);
try {
Field implField = FloatingActionButton.class.getDeclaredField("impl");
implField.setAccessible(true);
Object impl = implField.get(fab);
Class cls;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cls = impl.getClass().getSuperclass();
}
else {
cls = impl.getClass();
}
Method mthd = cls.getDeclaredMethod("setImageMatrixScale", Float.TYPE);
mthd.setAccessible(true);
mthd.invoke(impl, 1);
}
catch (Exception e) {
e.printStackTrace();
}
fab.show();
}
But the drawable still does not display in the FAB.
Is there anything wrong in this code?
On the basis of your recommendation on item #11 above, Mike M. proposed the following code (see
if (!fab.isShown()) {
fab.setImageDrawable(STEP_ICON);
try {
Field implField = FloatingActionButton.class.getDeclaredField("impl");
implField.setAccessible(true);
Object impl = implField.get(fab);
Class cls;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cls = impl.getClass().getSuperclass();
}
else {
cls = impl.getClass();
}
Method mthd = cls.getDeclaredMethod("setImageMatrixScale", Float.TYPE);
mthd.setAccessible(true);
mthd.invoke(impl, 1);
}
catch (Exception e) {
e.printStackTrace();
}
fab.show();
}
But the drawable still does not display in the FAB.
Is there anything wrong in this code?
er...@gmail.com <er...@gmail.com> #23
Please ignore the question in item #22; the answer can be found in the referenced SO question.
bh...@gmail.com <bh...@gmail.com> #24
I am using "com.google.android.material:material:1.0.0"
I am facing same issue.
Have you found any solution?
I am facing same issue.
Have you found any solution?
ah...@gmail.com <ah...@gmail.com> #25
right not i am also using com.google.android.material:material:1.0.0
it doesn't stop at the fact the the fab icon can't be set but the original icon is shown when the fab change state on collapsing
and the alpha value is ignored one it collapsed and expanded
it doesn't stop at the fact the the fab icon can't be set but the original icon is shown when the fab change state on collapsing
and the alpha value is ignored one it collapsed and expanded
le...@gmail.com <le...@gmail.com> #26
The status of this bug is "Fixed" but I can still reproduce the issue using "com.google.android.material:material:1.0.0".
Can you please let us know on which version of the Material Component library this is fixed?
It was marked as fixed in Aug 28, 2018 ffs.
Can you please let us know on which version of the Material Component library this is fixed?
It was marked as fixed in Aug 28, 2018 ffs.
fm...@gmail.com <fm...@gmail.com> #27
I'm on "com.google.android.material:material:1.0.0" and I have a fab anchored to a Collapsible Toolbar, which makes the fab disappear when user scrolls up and toolbar collapses.
what worked for me in my project was fab.imageMatrix = Matrix() immediately after setting the drawable
what worked for me in my project was fab.imageMatrix = Matrix() immediately after setting the drawable
ar...@cyface.de <ar...@cyface.de> #28
still present. Mentioned workaround works, though.
```
mFloatingButton.hide();
mFloatingButton.setImageResource(...);
mFloatingButton.show();
```
```
mFloatingButton.hide();
mFloatingButton.setImageResource(...);
mFloatingButton.show();
```
mm...@gmail.com <mm...@gmail.com> #30
Bug still present. Mentioned workaround works.
I don't know how to apply the fix, even if I can.
I don't know how to apply the fix, even if I can.
Description
- androidx.appcompat:appcompat:1.0.0-beta01
- com.google.android.material:material:1.0.0-beta01
Version used: 1.0.0-beta01
Theme used: Theme.AppCompat.Light.DarkActionBar
Devices/Android versions reproduced on: Android Oreo (probably all devices/versions)
Relevant code to trigger the issue.
- Create a FloatingActionButton in XML with an icon
- Call the method hide()
- Call the method show()
- Change the icon using setImageResource()
- The icon will disappear which is incorrect.
Please check out the attached project and screen recording. Steps to reproduce:
- Open the app
- Press TOGGLE VISIBILITY (will hide the fab)
- Press TOGGLE VISIBILITY (will show the fab)
- Press ICON 1 (will call setImageResource)
- The icon will disappear which is incorrect.
The reason why the icon disappears is because of the show() call. Internally the FAB has a class FloatingActionButtonImpl with a variable imageMatrixScale. This variable is set to 0 when show() is called but isn't set back to 1 after the animation. In the attached project there is a workaround (see comment) for this issue.