Skip to content

Commit

Permalink
Fix Activity container transform unexpected flash and fade
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 307090565
  • Loading branch information
dsn5ft committed Apr 17, 2020
1 parent 9813cc5 commit 57a8ebd
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ public void onTransitionStart(Transition transition) {
/**
* Make the window background transparent during the container transform.
*
* This applies a color filter to the window background which clears the background's source
* pixels. If the client has set a color filter on the window background manually, this will
* be overridden and will not be restored after the transition. If you need to manipulate
* the color of the window background and have that manipulation restored after the transition,
* use {@link android.graphics.drawable.Drawable#setTint(int)} instead.
* <p>This applies a color filter to the window background which clears the background's source
* pixels. If the client has set a color filter on the window background manually, this will be
* overridden and will not be restored after the transition. If you need to manipulate the color
* of the window background and have that manipulation restored after the transition, use {@link
* android.graphics.drawable.Drawable#setTint(int)} instead.
*/
private static void removeWindowBackground(Window window) {
window
Expand All @@ -243,12 +243,11 @@ private static void restoreWindowBackground(Window window) {
}

/**
* When using a transparent window background, make sure that the background fade duration is at
* least as long as the transform's duration. This will help to avoid a black background visual
* artifact.
* When using a transparent window background, make sure that the background fade duration is as
* long as the transform's duration. This will help to avoid a black background visual artifact.
*/
private static void updateBackgroundFadeDuration(
Window window, MaterialContainerTransform transform) {
window.setTransitionBackgroundFadeDuration(transform.getDuration() * 2);
window.setTransitionBackgroundFadeDuration(transform.getDuration());
}
}

0 comments on commit 57a8ebd

Please sign in to comment.