Merge "Fix enter/exit horizontal ActivityEmbedding split with legacy transition" into tm-qpr-dev am: 5a31efbff4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20540706 Change-Id: Ia90870082579ea05404bbaa9afd869d3b4e89df6 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -86,13 +86,23 @@ class TaskFragmentAnimationSpec {
|
|||||||
/** Animation for target that is opening in a change transition. */
|
/** Animation for target that is opening in a change transition. */
|
||||||
@NonNull
|
@NonNull
|
||||||
Animation createChangeBoundsOpenAnimation(@NonNull RemoteAnimationTarget target) {
|
Animation createChangeBoundsOpenAnimation(@NonNull RemoteAnimationTarget target) {
|
||||||
final Rect bounds = target.localBounds;
|
final Rect parentBounds = target.taskInfo.configuration.windowConfiguration.getBounds();
|
||||||
// The target will be animated in from left or right depends on its position.
|
final Rect bounds = target.screenSpaceBounds;
|
||||||
final int startLeft = bounds.left == 0 ? -bounds.width() : bounds.width();
|
final int startLeft;
|
||||||
|
final int startTop;
|
||||||
|
if (parentBounds.top == bounds.top && parentBounds.bottom == bounds.bottom) {
|
||||||
|
// The window will be animated in from left or right depending on its position.
|
||||||
|
startTop = 0;
|
||||||
|
startLeft = parentBounds.left == bounds.left ? -bounds.width() : bounds.width();
|
||||||
|
} else {
|
||||||
|
// The window will be animated in from top or bottom depending on its position.
|
||||||
|
startTop = parentBounds.top == bounds.top ? -bounds.height() : bounds.height();
|
||||||
|
startLeft = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// The position should be 0-based as we will post translate in
|
// The position should be 0-based as we will post translate in
|
||||||
// TaskFragmentAnimationAdapter#onAnimationUpdate
|
// TaskFragmentAnimationAdapter#onAnimationUpdate
|
||||||
final Animation animation = new TranslateAnimation(startLeft, 0, 0, 0);
|
final Animation animation = new TranslateAnimation(startLeft, 0, startTop, 0);
|
||||||
animation.setInterpolator(mFastOutExtraSlowInInterpolator);
|
animation.setInterpolator(mFastOutExtraSlowInInterpolator);
|
||||||
animation.setDuration(CHANGE_ANIMATION_DURATION);
|
animation.setDuration(CHANGE_ANIMATION_DURATION);
|
||||||
animation.initialize(bounds.width(), bounds.height(), bounds.width(), bounds.height());
|
animation.initialize(bounds.width(), bounds.height(), bounds.width(), bounds.height());
|
||||||
@@ -103,13 +113,24 @@ class TaskFragmentAnimationSpec {
|
|||||||
/** Animation for target that is closing in a change transition. */
|
/** Animation for target that is closing in a change transition. */
|
||||||
@NonNull
|
@NonNull
|
||||||
Animation createChangeBoundsCloseAnimation(@NonNull RemoteAnimationTarget target) {
|
Animation createChangeBoundsCloseAnimation(@NonNull RemoteAnimationTarget target) {
|
||||||
final Rect bounds = target.localBounds;
|
final Rect parentBounds = target.taskInfo.configuration.windowConfiguration.getBounds();
|
||||||
// The target will be animated out to left or right depends on its position.
|
// TODO(b/258126915): we want to keep track of the closing start bounds
|
||||||
final int endLeft = bounds.left == 0 ? -bounds.width() : bounds.width();
|
final Rect bounds = target.screenSpaceBounds;
|
||||||
|
final int endTop;
|
||||||
|
final int endLeft;
|
||||||
|
if (parentBounds.top == bounds.top && parentBounds.bottom == bounds.bottom) {
|
||||||
|
// The window will be animated out to left or right depending on its position.
|
||||||
|
endTop = 0;
|
||||||
|
endLeft = parentBounds.left == bounds.left ? -bounds.width() : bounds.width();
|
||||||
|
} else {
|
||||||
|
// The window will be animated out to top or bottom depending on its position.
|
||||||
|
endTop = parentBounds.top == bounds.top ? -bounds.height() : bounds.height();
|
||||||
|
endLeft = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// The position should be 0-based as we will post translate in
|
// The position should be 0-based as we will post translate in
|
||||||
// TaskFragmentAnimationAdapter#onAnimationUpdate
|
// TaskFragmentAnimationAdapter#onAnimationUpdate
|
||||||
final Animation animation = new TranslateAnimation(0, endLeft, 0, 0);
|
final Animation animation = new TranslateAnimation(0, endLeft, 0, endTop);
|
||||||
animation.setInterpolator(mFastOutExtraSlowInInterpolator);
|
animation.setInterpolator(mFastOutExtraSlowInInterpolator);
|
||||||
animation.setDuration(CHANGE_ANIMATION_DURATION);
|
animation.setDuration(CHANGE_ANIMATION_DURATION);
|
||||||
animation.initialize(bounds.width(), bounds.height(), bounds.width(), bounds.height());
|
animation.initialize(bounds.width(), bounds.height(), bounds.width(), bounds.height());
|
||||||
|
|||||||
@@ -86,11 +86,11 @@ class ActivityEmbeddingAnimationSpec {
|
|||||||
final int startLeft;
|
final int startLeft;
|
||||||
final int startTop;
|
final int startTop;
|
||||||
if (parentBounds.top == bounds.top && parentBounds.bottom == bounds.bottom) {
|
if (parentBounds.top == bounds.top && parentBounds.bottom == bounds.bottom) {
|
||||||
// The window will be animated in from left or right depends on its position.
|
// The window will be animated in from left or right depending on its position.
|
||||||
startTop = 0;
|
startTop = 0;
|
||||||
startLeft = parentBounds.left == bounds.left ? -bounds.width() : bounds.width();
|
startLeft = parentBounds.left == bounds.left ? -bounds.width() : bounds.width();
|
||||||
} else {
|
} else {
|
||||||
// The window will be animated in from top or bottom depends on its position.
|
// The window will be animated in from top or bottom depending on its position.
|
||||||
startTop = parentBounds.top == bounds.top ? -bounds.height() : bounds.height();
|
startTop = parentBounds.top == bounds.top ? -bounds.height() : bounds.height();
|
||||||
startLeft = 0;
|
startLeft = 0;
|
||||||
}
|
}
|
||||||
@@ -114,11 +114,11 @@ class ActivityEmbeddingAnimationSpec {
|
|||||||
final int endTop;
|
final int endTop;
|
||||||
final int endLeft;
|
final int endLeft;
|
||||||
if (parentBounds.top == bounds.top && parentBounds.bottom == bounds.bottom) {
|
if (parentBounds.top == bounds.top && parentBounds.bottom == bounds.bottom) {
|
||||||
// The window will be animated out to left or right depends on its position.
|
// The window will be animated out to left or right depending on its position.
|
||||||
endTop = 0;
|
endTop = 0;
|
||||||
endLeft = parentBounds.left == bounds.left ? -bounds.width() : bounds.width();
|
endLeft = parentBounds.left == bounds.left ? -bounds.width() : bounds.width();
|
||||||
} else {
|
} else {
|
||||||
// The window will be animated out to top or bottom depends on its position.
|
// The window will be animated out to top or bottom depending on its position.
|
||||||
endTop = parentBounds.top == bounds.top ? -bounds.height() : bounds.height();
|
endTop = parentBounds.top == bounds.top ? -bounds.height() : bounds.height();
|
||||||
endLeft = 0;
|
endLeft = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user