Update ActivityEmbedding default TaskFragment animations to crossfade.
Test: tested locally on 1p app. Change-Id: I1c4bd4d51ad0a9c909cf2cb002849b267868e1f2
This commit is contained in:
38
core/res/res/anim-ldrtl/task_fragment_close_enter.xml
Normal file
38
core/res/res/anim-ldrtl/task_fragment_close_enter.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="1.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/linear"
|
||||
android:startOffset="0"
|
||||
android:duration="200" />
|
||||
|
||||
<translate
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:startOffset="0"
|
||||
android:duration="200" />
|
||||
</set>
|
||||
40
core/res/res/anim-ldrtl/task_fragment_close_exit.xml
Normal file
40
core/res/res/anim-ldrtl/task_fragment_close_exit.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/linear"
|
||||
android:startOffset="35"
|
||||
android:duration="83" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="-10%"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:startOffset="0"
|
||||
android:duration="200" />
|
||||
</set>
|
||||
40
core/res/res/anim-ldrtl/task_fragment_open_enter.xml
Normal file
40
core/res/res/anim-ldrtl/task_fragment_open_enter.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
/*
|
||||
** Copyright 2022, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="0"
|
||||
android:toAlpha="1.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/linear"
|
||||
android:startOffset="50"
|
||||
android:duration="83" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="-10%"
|
||||
android:toXDelta="0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:duration="450" />
|
||||
</set>
|
||||
38
core/res/res/anim-ldrtl/task_fragment_open_exit.xml
Normal file
38
core/res/res/anim-ldrtl/task_fragment_open_exit.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
/*
|
||||
** Copyright 2022, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="1.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/standard_accelerate"
|
||||
android:startOffset="0"
|
||||
android:duration="450" />
|
||||
|
||||
<translate
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:duration="450" />
|
||||
</set>
|
||||
@@ -17,16 +17,21 @@
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
<scale
|
||||
android:fromXScale="1.1"
|
||||
android:toXScale="1"
|
||||
android:fromYScale="1.1"
|
||||
android:toYScale="1"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="1.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/linear"
|
||||
android:startOffset="0"
|
||||
android:duration="200" />
|
||||
|
||||
<translate
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:duration="400"/>
|
||||
android:startOffset="0"
|
||||
android:duration="200" />
|
||||
</set>
|
||||
@@ -19,24 +19,21 @@
|
||||
android:shareInterpolator="false"
|
||||
android:zAdjustment="top">
|
||||
<alpha
|
||||
android:fromAlpha="1"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/linear"
|
||||
android:startOffset="33"
|
||||
android:duration="50"/>
|
||||
<scale
|
||||
android:fromXScale="1"
|
||||
android:toXScale="0.9"
|
||||
android:fromYScale="1"
|
||||
android:toYScale="0.9"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:startOffset="0"
|
||||
android:duration="83" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="10%"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:duration="400"/>
|
||||
android:duration="200" />
|
||||
</set>
|
||||
|
||||
@@ -25,17 +25,13 @@
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/linear"
|
||||
android:startOffset="50"
|
||||
android:duration="50"/>
|
||||
<scale
|
||||
android:fromXScale="0.85"
|
||||
android:toXScale="1"
|
||||
android:fromYScale="0.85"
|
||||
android:toYScale="1"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:duration="83" />
|
||||
<translate
|
||||
android:fromXDelta="10%"
|
||||
android:toXDelta="0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:duration="400"/>
|
||||
android:duration="400" />
|
||||
</set>
|
||||
|
||||
@@ -17,16 +17,20 @@
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
<scale
|
||||
android:fromXScale="1"
|
||||
android:toXScale="1.05"
|
||||
android:fromYScale="1"
|
||||
android:toYScale="1.05"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="1.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/standard_accelerate"
|
||||
android:startOffset="0"
|
||||
android:duration="400" />
|
||||
|
||||
<translate
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:duration="400"/>
|
||||
android:duration="400" />
|
||||
</set>
|
||||
@@ -17,6 +17,8 @@
|
||||
package androidx.window.extensions.embedding;
|
||||
|
||||
import static android.graphics.Matrix.MSCALE_X;
|
||||
import static android.graphics.Matrix.MTRANS_X;
|
||||
import static android.graphics.Matrix.MTRANS_Y;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.Choreographer;
|
||||
@@ -96,22 +98,20 @@ class TaskFragmentAnimationAdapter {
|
||||
mTarget.localBounds.left, mTarget.localBounds.top);
|
||||
t.setMatrix(mLeash, mTransformation.getMatrix(), mMatrix);
|
||||
t.setAlpha(mLeash, mTransformation.getAlpha());
|
||||
|
||||
// Open/close animation may scale up the surface. Apply an inverse scale to the window crop
|
||||
// so that it will not be covering other windows.
|
||||
mVecs[1] = mVecs[2] = 0;
|
||||
mVecs[0] = mVecs[3] = 1;
|
||||
mTransformation.getMatrix().mapVectors(mVecs);
|
||||
mVecs[0] = 1.f / mVecs[0];
|
||||
mVecs[3] = 1.f / mVecs[3];
|
||||
final Rect clipRect = mTarget.localBounds;
|
||||
mRect.left = (int) (clipRect.left * mVecs[0] + 0.5f);
|
||||
mRect.right = (int) (clipRect.right * mVecs[0] + 0.5f);
|
||||
mRect.top = (int) (clipRect.top * mVecs[3] + 0.5f);
|
||||
mRect.bottom = (int) (clipRect.bottom * mVecs[3] + 0.5f);
|
||||
mRect.offsetTo(Math.round(mTarget.localBounds.width() * (1 - mVecs[0]) / 2.f),
|
||||
Math.round(mTarget.localBounds.height() * (1 - mVecs[3]) / 2.f));
|
||||
t.setWindowCrop(mLeash, mRect);
|
||||
// Get current animation position.
|
||||
final int positionX = Math.round(mMatrix[MTRANS_X]);
|
||||
final int positionY = Math.round(mMatrix[MTRANS_Y]);
|
||||
// The exiting surface starts at position: mTarget.localBounds and moves with
|
||||
// positionX varying. Offset our crop region by the amount we have slided so crop
|
||||
// regions stays exactly on the original container in split.
|
||||
final int cropOffsetX = mTarget.localBounds.left - positionX;
|
||||
final int cropOffsetY = mTarget.localBounds.top - positionY;
|
||||
final Rect cropRect = new Rect();
|
||||
cropRect.set(mTarget.localBounds);
|
||||
// Because window crop uses absolute position.
|
||||
cropRect.offsetTo(0, 0);
|
||||
cropRect.offset(cropOffsetX, cropOffsetY);
|
||||
t.setCrop(mLeash, cropRect);
|
||||
}
|
||||
|
||||
/** Called after animation finished. */
|
||||
|
||||
Reference in New Issue
Block a user