Minor tweak to enter/exit animation for the home activity.

- Fixing issue where the animation props was not applied to the progress
  and callback animations correctly
- Ensuring that all tasks animate the same distance on enter/exit, and 
  not just to the edge of the screen
- Removing unused styles and animation resources

Change-Id: I88bd0f79f386304373fe63b49e92f02eeb882e55
This commit is contained in:
Winson
2016-02-02 18:07:00 -08:00
parent 823441a74b
commit 40a2273377
21 changed files with 38 additions and 260 deletions

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2012, 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.
*/
-->
<!-- Recents Activity -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:zAdjustment="top">
<alpha android:fromAlpha="1.0" android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/fast_out_slow_in"
android:duration="0"/>
</set>

View File

@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2012, 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.
*/
-->
<!-- Incoming Activity -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:zAdjustment="normal">
<!-- Animate the view out only after recents is visible -->
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/fast_out_slow_in"
android:duration="1"/>
</set>

View File

@@ -23,6 +23,6 @@
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/linear"
android:interpolator="@android:interpolator/linear_out_slow_in"
android:duration="150"/>
</set>

View File

@@ -23,6 +23,6 @@
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/linear_out_slow_in"
android:duration="150"/>
android:interpolator="@interpolator/recents_from_launcher_exit_interpolator"
android:duration="133"/>
</set>

View File

@@ -23,6 +23,6 @@
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/linear_out_slow_in"
android:duration="@integer/recents_enter_from_home_transition_duration"/>
android:interpolator="@interpolator/recents_from_launcher_exit_interpolator"
android:duration="133"/>
</set>

View File

@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2012, 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"
android:zAdjustment="normal">
<!--scale android:fromXScale="2.0" android:toXScale="1.0"
android:fromYScale="2.0" android:toYScale="1.0"
android:interpolator="@android:interpolator/decelerate_cubic"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="250" /-->
</set>

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2012, 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"
android:zAdjustment="normal">
<!--scale android:fromXScale="1.0" android:toXScale="2.0"
android:fromYScale="1.0" android:toYScale="2.0"
android:interpolator="@android:interpolator/decelerate_cubic"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="250" /-->
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:interpolator="@android:interpolator/decelerate_cubic"
android:duration="250"/>
</set>

View File

@@ -23,6 +23,6 @@
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/linear"
android:duration="150"/>
android:interpolator="@interpolator/recents_to_launcher_enter_interpolator"
android:duration="133"/>
</set>

View File

@@ -24,5 +24,5 @@
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/linear_out_slow_in"
android:duration="150"/>
android:duration="1"/>
</set>

View File

@@ -23,6 +23,6 @@
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/linear"
android:duration="100"/>
android:interpolator="@interpolator/recents_to_launcher_enter_interpolator"
android:duration="133"/>
</set>

View File

@@ -24,5 +24,5 @@
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/linear"
android:duration="100"/>
android:duration="1"/>
</set>

View File

@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2012, 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:detachWallpaper="true"
android:shareInterpolator="false"
android:zAdjustment="normal">
<!--scale android:fromXScale="2.0" android:toXScale="1.0"
android:fromYScale="2.0" android:toYScale="1.0"
android:interpolator="@android:interpolator/decelerate_cubic"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="250" /-->
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/decelerate_cubic"
android:duration="250"/>
</set>

View File

@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2012, 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:detachWallpaper="true"
android:shareInterpolator="false"
android:zAdjustment="top">
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/decelerate_cubic"
android:duration="250"/>
</set>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2012, The Android Open Source Project
** Copyright 2014, 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.
@@ -16,11 +16,8 @@
** limitations under the License.
*/
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:zAdjustment="normal">
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:interpolator="@android:interpolator/decelerate_cubic"
android:duration="250"/>
</set>
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:controlX1="0"
android:controlY1="0"
android:controlX2="0.8"
android:controlY2="1" />

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2012, The Android Open Source Project
** Copyright 2014, 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.
@@ -16,13 +16,8 @@
** limitations under the License.
*/
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:zAdjustment="top">
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/decelerate_cubic"
android:duration="250"/>
</set>
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:controlX1="0.4"
android:controlY1="0"
android:controlX2="1"
android:controlY2="1" />

View File

@@ -138,12 +138,6 @@
<!-- The duration in seconds to wait before the dismiss buttons are shown. -->
<integer name="recents_task_bar_dismiss_delay_seconds">1000</integer>
<!-- The duration of the window transition when coming to Recents from an app.
In order to defer the in-app animations until after the transition is complete,
we also need to use this value as the starting delay when animating the first
task decorations in. -->
<integer name="recents_enter_from_app_transition_duration">325</integer>
<!-- The duration for animating the task decorations in after transitioning from an app. -->
<integer name="recents_task_enter_from_app_duration">200</integer>
@@ -153,12 +147,6 @@
<!-- The duration for animating the task decorations out before transitioning to an app. -->
<integer name="recents_task_exit_to_app_duration">125</integer>
<!-- The duration of the window transition when coming to Recents from the Launcher.
In order to defer the in-app animations until after the transition is complete,
we also need to use this value as the starting delay when animating the task views
in from the bottom of the screen. -->
<integer name="recents_enter_from_home_transition_duration">100</integer>
<!-- The min animation duration for animating the nav bar scrim in. -->
<integer name="recents_nav_bar_scrim_enter_duration">400</integer>

View File

@@ -16,10 +16,6 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="RecentsStyle" parent="@android:style/Theme.DeviceDefault.Wallpaper.NoTitleBar">
<item name="android:windowAnimationStyle">@style/Animation.RecentsActivity</item>
</style>
<style name="RecentsTheme" parent="@android:style/Theme.Material">
<!-- NoTitle -->
<item name="android:windowNoTitle">true</item>
@@ -27,38 +23,23 @@
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowAnimationStyle">@style/Animation.RecentsActivity</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:ambientShadowAlpha">0.35</item>
</style>
<!-- Alternate Recents theme -->
<!-- Recents theme -->
<style name="RecentsTheme.Wallpaper">
<!-- Wallpaper -->
<item name="android:windowBackground">@color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowShowWallpaper">true</item>
</style>
<!-- Performance optimized alternate Recents theme (no wallpaper) -->
<!-- Performance optimized Recents theme (no wallpaper) -->
<style name="RecentsTheme.NoWallpaper">
<item name="android:windowBackground">@android:color/black</item>
</style>
<!-- Animations for a non-full-screen window or activity. -->
<style name="Animation.RecentsActivity" parent="@android:style/Animation.Activity">
<item name="android:activityOpenEnterAnimation">@anim/recents_launch_from_launcher_enter</item>
<item name="android:activityOpenExitAnimation">@anim/recents_launch_from_launcher_exit</item>
<item name="android:taskOpenEnterAnimation">@anim/recents_launch_from_launcher_enter</item>
<item name="android:taskOpenExitAnimation">@anim/recents_launch_from_launcher_exit</item>
<item name="android:taskToFrontEnterAnimation">@anim/recents_launch_from_launcher_enter</item>
<item name="android:taskToFrontExitAnimation">@anim/recents_launch_from_launcher_exit</item>
<item name="android:wallpaperOpenEnterAnimation">@anim/recents_launch_from_launcher_enter</item>
<item name="android:wallpaperOpenExitAnimation">@anim/recents_launch_from_launcher_exit</item>
<item name="android:wallpaperIntraOpenEnterAnimation">@anim/wallpaper_recents_launch_from_launcher_enter</item>
<item name="android:wallpaperIntraOpenExitAnimation">@anim/wallpaper_recents_launch_from_launcher_exit</item>
</style>
<style name="TextAppearance.StatusBar.HeadsUp"
parent="@*android:style/TextAppearance.StatusBar">
</style>

View File

@@ -130,6 +130,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
*/
public FinishRecentsRunnable(Intent launchIntent, ActivityOptions opts) {
mLaunchIntent = launchIntent;
mOpts = opts;
}
@Override

View File

@@ -83,13 +83,11 @@ public class SystemBarScrimViews {
* going home).
*/
public final void onBusEvent(DismissRecentsToHomeAnimationStarted event) {
int taskViewExitToAppDuration = mContext.getResources().getInteger(
R.integer.recents_task_exit_to_app_duration);
if (mHasNavBarScrim && mShouldAnimateNavBarScrim) {
mNavBarScrimView.animate()
.translationY(mNavBarScrimView.getMeasuredHeight())
.setStartDelay(0)
.setDuration(taskViewExitToAppDuration)
.setDuration(TaskStackAnimationHelper.EXIT_TO_HOME_TRANSLATION_DURATION)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.start();
}

View File

@@ -108,7 +108,7 @@ public class TaskStackAnimationHelper {
return;
}
int offscreenY = stackLayout.mStackRect.bottom;
int offscreenYOffset = stackLayout.mStackRect.height();
int taskViewAffiliateGroupEnterOffset = res.getDimensionPixelSize(
R.dimen.recents_task_view_affiliate_group_enter_offset);
@@ -145,7 +145,7 @@ public class TaskStackAnimationHelper {
} else if (launchState.launchedFromHome) {
// Move the task view off screen (below) so we can animate it in
RectF bounds = new RectF(mTmpTransform.rect);
bounds.offsetTo(bounds.left, offscreenY);
bounds.offset(0, offscreenYOffset);
tv.setLeftTopRightBottom((int) bounds.left, (int) bounds.top, (int) bounds.right,
(int) bounds.bottom);
}
@@ -247,7 +247,7 @@ public class TaskStackAnimationHelper {
return;
}
int offscreenY = stackLayout.mStackRect.bottom;
int offscreenYOffset = stackLayout.mStackRect.height();
// Create the animations for each of the tasks
List<TaskView> taskViews = mStackView.getTaskViews();
@@ -277,7 +277,7 @@ public class TaskStackAnimationHelper {
stackLayout.getStackTransform(task, stackScroller.getStackScroll(), mTmpTransform,
null);
mTmpTransform.rect.offsetTo(mTmpTransform.rect.left, offscreenY);
mTmpTransform.rect.offset(0, offscreenYOffset);
mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);
}
}

View File

@@ -242,7 +242,7 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
}
void updateViewPropertiesToTaskTransform(TaskViewTransform toTransform,
AnimationProps toAnimation, ValueAnimator.AnimatorUpdateListener updateCallback) {
AnimationProps toAnimation, ValueAnimator.AnimatorUpdateListener updateCallback) {
RecentsConfiguration config = Recents.getConfiguration();
cancelTransformAnimation();
@@ -261,14 +261,16 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
updateCallback.onAnimationUpdate(null);
}
} else {
// Both the progress and the update are a function of the bounds movement of the task
if (Float.compare(getTaskProgress(), toTransform.p) != 0) {
mTmpAnimators.add(ObjectAnimator.ofFloat(this, TASK_PROGRESS, getTaskProgress(),
toTransform.p));
ObjectAnimator anim = ObjectAnimator.ofFloat(this, TASK_PROGRESS, getTaskProgress(),
toTransform.p);
mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, anim));
}
if (updateCallback != null) {
ValueAnimator updateCallbackAnim = ValueAnimator.ofInt(0, 1);
updateCallbackAnim.addUpdateListener(updateCallback);
mTmpAnimators.add(updateCallbackAnim);
mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, updateCallbackAnim));
}
// Create the animator