diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java index 530d75739c..60cd0c2be3 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java @@ -24,7 +24,6 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager.AnimationConfig; import com.android.launcher3.LauncherStateManager.StateHandler; -import com.android.launcher3.anim.AnimationLayerSet; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.Interpolators; @@ -54,7 +53,7 @@ public class RecentsViewStateController implements StateHandler { } @Override - public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews, + public void setStateWithAnimation(LauncherState toState, AnimatorSetBuilder builder, AnimationConfig config) { ObjectAnimator progressAnim = mTransitionProgress.animateToValue(toState == LauncherState.OVERVIEW ? 1 : 0); diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java index de21c7f516..e3768e2fc7 100644 --- a/src/com/android/launcher3/LauncherStateManager.java +++ b/src/com/android/launcher3/LauncherStateManager.java @@ -25,7 +25,6 @@ import android.os.Handler; import android.os.Looper; import android.view.View; -import com.android.launcher3.anim.AnimationLayerSet; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.AnimatorSetBuilder; @@ -212,15 +211,12 @@ public class LauncherStateManager { protected AnimatorSet createAnimationToNewWorkspaceInternal(final LauncherState state, AnimatorSetBuilder builder, final Runnable onCompleteRunnable) { - final AnimationLayerSet layerViews = new AnimationLayerSet(); - for (StateHandler handler : getStateHandlers()) { builder.startTag(handler); - handler.setStateWithAnimation(state, layerViews, builder, mConfig); + handler.setStateWithAnimation(state, builder, mConfig); } final AnimatorSet animation = builder.build(); - animation.addListener(layerViews); animation.addListener(new AnimationSuccessListener() { @Override @@ -339,7 +335,7 @@ public class LauncherStateManager { /** * Sets the UI to {@param state} by animating any changes. */ - void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews, + void setStateWithAnimation(LauncherState toState, AnimatorSetBuilder builder, AnimationConfig config); } diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index a67b92a482..9dc8bb7a00 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -62,7 +62,6 @@ import com.android.launcher3.LauncherStateManager.AnimationConfig; import com.android.launcher3.accessibility.AccessibleDragListenerAdapter; import com.android.launcher3.accessibility.OverviewScreenAccessibilityDelegate; import com.android.launcher3.accessibility.WorkspaceAccessibilityHelper; -import com.android.launcher3.anim.AnimationLayerSet; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.badge.FolderBadgeInfo; @@ -1547,10 +1546,10 @@ public class Workspace extends PagedView * Sets the current workspace {@link LauncherState}, then animates the UI */ @Override - public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews, + public void setStateWithAnimation(LauncherState toState, AnimatorSetBuilder builder, AnimationConfig config) { StateTransitionListener listener = new StateTransitionListener(toState); - mStateTransitionAnimation.setStateWithAnimation(toState, builder, layerViews, config); + mStateTransitionAnimation.setStateWithAnimation(toState, builder, config); // Invalidate the pages now, so that we have the visible pages before the // animation is started diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java index 0ec3142dc4..abc140d7d3 100644 --- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java +++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java @@ -21,7 +21,6 @@ import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; -import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; @@ -32,7 +31,6 @@ import android.view.accessibility.AccessibilityManager; import com.android.launcher3.LauncherState.PageAlphaProvider; import com.android.launcher3.LauncherStateManager.AnimationConfig; -import com.android.launcher3.anim.AnimationLayerSet; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.Interpolators; @@ -112,9 +110,9 @@ public class WorkspaceStateTransitionAnimation { } public void setStateWithAnimation(LauncherState toState, AnimatorSetBuilder builder, - AnimationLayerSet layerViews, AnimationConfig config) { + AnimationConfig config) { AnimatedPropertySetter propertySetter = - new AnimatedPropertySetter(config.duration, layerViews, builder); + new AnimatedPropertySetter(config.duration, builder); setWorkspaceProperty(toState, propertySetter); } @@ -190,13 +188,10 @@ public class WorkspaceStateTransitionAnimation { public static class AnimatedPropertySetter extends PropertySetter { private final long mDuration; - private final AnimationLayerSet mLayerViews; private final AnimatorSetBuilder mStateAnimator; - public AnimatedPropertySetter( - long duration, AnimationLayerSet layerView, AnimatorSetBuilder builder) { + public AnimatedPropertySetter(long duration, AnimatorSetBuilder builder) { mDuration = duration; - mLayerViews = layerView; mStateAnimator = builder; } @@ -211,7 +206,6 @@ public class WorkspaceStateTransitionAnimation { } anim.setDuration(mDuration).setInterpolator(getFadeInterpolator(alpha)); - mLayerViews.addView(view); mStateAnimator.play(anim); } diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 14ad97b45a..5de58b4723 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -18,7 +18,6 @@ import com.android.launcher3.LauncherStateManager.AnimationConfig; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; -import com.android.launcher3.anim.AnimationLayerSet; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.Interpolators; @@ -122,7 +121,7 @@ public class AllAppsTransitionController * @param progress value between 0 and 1, 0 shows all apps and 1 shows workspace * * @see #setState(LauncherState) - * @see #setStateWithAnimation(LauncherState, AnimationLayerSet, AnimatorSetBuilder, AnimationConfig) + * @see #setStateWithAnimation(LauncherState, AnimatorSetBuilder, AnimationConfig) */ public void setProgress(float progress) { mProgress = progress; @@ -167,7 +166,7 @@ public class AllAppsTransitionController * dependent UI using various animation events */ @Override - public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews, + public void setStateWithAnimation(LauncherState toState, AnimatorSetBuilder builder, AnimationConfig config) { if (Float.compare(mProgress, toState.verticalProgress) == 0) { // Fail fast diff --git a/src/com/android/launcher3/anim/AnimationLayerSet.java b/src/com/android/launcher3/anim/AnimationLayerSet.java deleted file mode 100644 index f0b34587a2..0000000000 --- a/src/com/android/launcher3/anim/AnimationLayerSet.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -package com.android.launcher3.anim; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.util.ArrayMap; -import android.view.View; -import java.util.Iterator; -import java.util.Map; - -/** - * Helper class to automatically build view hardware layers for the duration of an animation. - */ -public class AnimationLayerSet extends AnimatorListenerAdapter { - - private final ArrayMap mViewsToLayerTypeMap; - - public AnimationLayerSet() { - mViewsToLayerTypeMap = new ArrayMap<>(); - } - - public AnimationLayerSet(View v) { - mViewsToLayerTypeMap = new ArrayMap<>(1); - addView(v); - } - - public void addView(View v) { - mViewsToLayerTypeMap.put(v, v.getLayerType()); - } - - @Override - public void onAnimationStart(Animator animation) { - // Enable all necessary layers - Iterator> itr = mViewsToLayerTypeMap.entrySet().iterator(); - while (itr.hasNext()) { - Map.Entry entry = itr.next(); - View v = entry.getKey(); - entry.setValue(v.getLayerType()); - v.setLayerType(View.LAYER_TYPE_HARDWARE, null); - if (v.isAttachedToWindow() && v.getVisibility() == View.VISIBLE) { - v.buildLayer(); - } - } - } - - @Override - public void onAnimationEnd(Animator animation) { - Iterator> itr = mViewsToLayerTypeMap.entrySet().iterator(); - while (itr.hasNext()) { - Map.Entry entry = itr.next(); - entry.getKey().setLayerType(entry.getValue(), null); - } - } -} diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java b/src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java index 1ba8cd62c0..b23927be22 100644 --- a/src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java +++ b/src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java @@ -36,7 +36,6 @@ import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.WorkspaceStateTransitionAnimation.AnimatedPropertySetter; import com.android.launcher3.WorkspaceStateTransitionAnimation.PropertySetter; -import com.android.launcher3.anim.AnimationLayerSet; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType; @@ -168,9 +167,9 @@ public class OverviewPanel extends LinearLayout implements Insettable, View.OnCl } @Override - public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews, + public void setStateWithAnimation(LauncherState toState, AnimatorSetBuilder builder, AnimationConfig config) { - setState(toState, new AnimatedPropertySetter(config.duration, layerViews, builder)); + setState(toState, new AnimatedPropertySetter(config.duration, builder)); } private void setState(LauncherState state, PropertySetter setter) {