question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[MaterialFadeThrough] Transition does not take in account target view alpha values

See original GitHub issue

Description:

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:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hunterstichcommented, Oct 16, 2020

@Gericop this should be fixed in 49ad522!

1reaction
hunterstichcommented, Oct 13, 2020

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Motion - Material Design
A Visibility transition is triggered when the target View's visibility is changed or when the View is added or removed. This means MaterialFadeThrough...
Read more >
MaterialSharedAxis | Android Developers
MaterialSharedAxis supports theme-based easing and duration. The transition will load theme values from the SceneRoot 's context before it runs, ...
Read more >
View alpha not updating when animate - android
I only change their alpha to zero at init. I also tried to animate the view after onGlobalLayout(), but still doesn't work. Any...
Read more >
Building Beautiful Transitions with Material Motion for Android
Container Transform transition from email address chip to card view. The domain of the requested iframe (youtu.be) has not been whitelisted. In ...
Read more >
Building beautiful transitions with Material Motion for Android ...
Material Design's motion system consists of patterns for transitioning between components or full-screen views. The patterns are designed to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found