From 17f9706d06662551df1b8a9e147b1485a48f218e Mon Sep 17 00:00:00 2001 From: Chris Li Date: Thu, 11 Nov 2021 15:10:10 +0800 Subject: [PATCH] Update TaskFragment animation to exclude scrim The new animation is the same as the activity_open/close_enter/exit animation, but without the black scrim. Fix: 201357701 Bug: 196173550 Test: test with settings app Change-Id: Ieff2f913f92ee745fea94734e5dadeecbed29a36 --- .../res/anim/task_fragment_close_enter.xml | 32 ++++++++++++++ .../res/res/anim/task_fragment_close_exit.xml | 42 +++++++++++++++++++ .../res/res/anim/task_fragment_open_enter.xml | 41 ++++++++++++++++++ core/res/res/anim/task_fragment_open_exit.xml | 32 ++++++++++++++ core/res/res/values/symbols.xml | 4 ++ .../embedding/TaskFragmentAnimationSpec.java | 13 +++--- 6 files changed, 158 insertions(+), 6 deletions(-) create mode 100644 core/res/res/anim/task_fragment_close_enter.xml create mode 100644 core/res/res/anim/task_fragment_close_exit.xml create mode 100644 core/res/res/anim/task_fragment_open_enter.xml create mode 100644 core/res/res/anim/task_fragment_open_exit.xml diff --git a/core/res/res/anim/task_fragment_close_enter.xml b/core/res/res/anim/task_fragment_close_enter.xml new file mode 100644 index 0000000000000..c940552d53ad7 --- /dev/null +++ b/core/res/res/anim/task_fragment_close_enter.xml @@ -0,0 +1,32 @@ + + + + + + \ No newline at end of file diff --git a/core/res/res/anim/task_fragment_close_exit.xml b/core/res/res/anim/task_fragment_close_exit.xml new file mode 100644 index 0000000000000..8998f764ff9b8 --- /dev/null +++ b/core/res/res/anim/task_fragment_close_exit.xml @@ -0,0 +1,42 @@ + + + + + + + diff --git a/core/res/res/anim/task_fragment_open_enter.xml b/core/res/res/anim/task_fragment_open_enter.xml new file mode 100644 index 0000000000000..6bc47deb2de43 --- /dev/null +++ b/core/res/res/anim/task_fragment_open_enter.xml @@ -0,0 +1,41 @@ + + + + + + + diff --git a/core/res/res/anim/task_fragment_open_exit.xml b/core/res/res/anim/task_fragment_open_exit.xml new file mode 100644 index 0000000000000..160eb84223dae --- /dev/null +++ b/core/res/res/anim/task_fragment_open_exit.xml @@ -0,0 +1,32 @@ + + + + + + \ No newline at end of file diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 9bb92e6c93cc2..fc9a45ced38d4 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1692,6 +1692,10 @@ + + + + diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentAnimationSpec.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentAnimationSpec.java index c0908a548501d..586ac1f212a17 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentAnimationSpec.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentAnimationSpec.java @@ -43,6 +43,7 @@ import com.android.internal.policy.AttributeCache; import com.android.internal.policy.TransitionAnimation; /** Animation spec for TaskFragment transition. */ +// TODO(b/206557124): provide an easier way to customize animation class TaskFragmentAnimationSpec { private static final String TAG = "TaskFragAnimationSpec"; @@ -179,9 +180,9 @@ class TaskFragmentAnimationSpec { Animation loadOpenAnimation(@NonNull RemoteAnimationTarget target, @NonNull Rect wholeAnimationBounds) { final boolean isEnter = target.mode != MODE_CLOSING; - final Animation animation = mTransitionAnimation.loadDefaultAnimationAttr(isEnter - ? R.styleable.WindowAnimation_activityOpenEnterAnimation - : R.styleable.WindowAnimation_activityOpenExitAnimation); + final Animation animation = mTransitionAnimation.loadDefaultAnimationRes(isEnter + ? com.android.internal.R.anim.task_fragment_open_enter + : com.android.internal.R.anim.task_fragment_open_exit); animation.initialize(target.localBounds.width(), target.localBounds.height(), wholeAnimationBounds.width(), wholeAnimationBounds.height()); animation.scaleCurrentDuration(mTransitionAnimationScaleSetting); @@ -191,9 +192,9 @@ class TaskFragmentAnimationSpec { Animation loadCloseAnimation(@NonNull RemoteAnimationTarget target, @NonNull Rect wholeAnimationBounds) { final boolean isEnter = target.mode != MODE_CLOSING; - final Animation animation = mTransitionAnimation.loadDefaultAnimationAttr(isEnter - ? R.styleable.WindowAnimation_activityCloseEnterAnimation - : R.styleable.WindowAnimation_activityCloseExitAnimation); + final Animation animation = mTransitionAnimation.loadDefaultAnimationRes(isEnter + ? com.android.internal.R.anim.task_fragment_close_enter + : com.android.internal.R.anim.task_fragment_close_exit); animation.initialize(target.localBounds.width(), target.localBounds.height(), wholeAnimationBounds.width(), wholeAnimationBounds.height()); animation.scaleCurrentDuration(mTransitionAnimationScaleSetting);