[MaterialFadeThrough] Transition does not take in account target view alpha values
See original GitHub issueDescription:
When using MaterialFadeThrough as enterTransition = MaterialFadeThrough()
for fragment transition the target view alpha status is not taken in account.
Expected behavior:
The transition should take in account the target views alpha status.
When having a view with alpha=0
defined in XML that transition will animate the alpha to 1.0f (Took me a while to understand why the view was now visible)
The workaround is to excludeTarget those view manually. But 1) it’s really hard to figure out what is happening 2) it should not be necessary as actual alpha could be computed and if the final alpha is 0.5 then the transition should do 0 to 0.5 and not 0 to 1. Source code:
In fragment transition just use enterTransition = MaterialFadeThrough()
and in final fragment have a view defined as
<View
android:id="@+id/placeholder"
android:layout_width="match_parent"
android:layout_height="24dp"
android:alpha="0"
android:background="?attr/colorPrimaryDark"
android:translationZ="4dp" />
Proper solution is probably that start / end values from https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/transition/FadeThroughProvider.java are properly get from the view if set (But don’t know the internal to know when the values should be computed)
Android API version: Android API version 10 and 11 but probably all.
Material Library version: Material Android Library version you are using : 1.2.1
Device: Device on which the bug was encountered : All including emulators
To help us triage faster, please check to make sure you are using the latest version of the library.
We also happily accept pull requests.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
@Gericop this should be fixed in 49ad522!
@Gericop Okay! Now I understand what’s happening. I’ve made a small demo and can repro this. No need to submit your own sample!
I’ll look into ways we can fix this and hopefully get a solution submitted soon