diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index a80e62b08f..24e708315d 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -17,7 +17,7 @@ package com.android.launcher3; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_NEXT_FRAME; -import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_SHORT_TIMEOUT; +import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.launcher3.util.RunnableWithId.RUNNABLE_ID_BIND_APPS; import static com.android.launcher3.util.RunnableWithId.RUNNABLE_ID_BIND_WIDGETS; @@ -581,7 +581,7 @@ public class Launcher extends BaseActivity Runnable exitSpringLoaded = new Runnable() { @Override public void run() { - exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); + exitSpringLoadedDragMode(SPRING_LOADED_EXIT_DELAY); } }; @@ -761,7 +761,7 @@ public class Launcher extends BaseActivity @Override public void run() { completeAddAppWidget(appWidgetId, requestArgs, layout, null); - exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); + exitSpringLoadedDragMode(SPRING_LOADED_EXIT_DELAY); } }; } else if (resultCode == RESULT_CANCELED) { @@ -1712,7 +1712,7 @@ public class Launcher extends BaseActivity @Override public void run() { // Exit spring loaded mode if necessary after adding the widget - exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); + exitSpringLoadedDragMode(SPRING_LOADED_EXIT_DELAY); } }; completeAddAppWidget(appWidgetId, info, boundWidget, addFlowHandler.getProviderInfo(this)); @@ -2460,11 +2460,11 @@ public class Launcher extends BaseActivity public boolean showWorkspace(boolean animated, Runnable onCompleteRunnable) { boolean changed = mState != State.WORKSPACE || - mWorkspace.getState() != Workspace.State.NORMAL; + mWorkspace.getState() != LauncherState.NORMAL; if (changed || mAllAppsController.isTransitioning()) { mWorkspace.setVisibility(View.VISIBLE); mStateTransitionAnimation.startAnimationToWorkspace(mState, mWorkspace.getState(), - Workspace.State.NORMAL, animated, onCompleteRunnable); + LauncherState.NORMAL, animated, onCompleteRunnable); // Set focus to the AppsCustomize button if (mAllAppsButton != null) { @@ -2509,7 +2509,7 @@ public class Launcher extends BaseActivity } mWorkspace.setVisibility(View.VISIBLE); mStateTransitionAnimation.startAnimationToWorkspace(mState, mWorkspace.getState(), - Workspace.State.OVERVIEW, animated, postAnimRunnable); + LauncherState.OVERVIEW, animated, postAnimRunnable); setState(State.WORKSPACE); // If animated from long press, then don't allow any of the controller in the drag @@ -2583,7 +2583,7 @@ public class Launcher extends BaseActivity InstallShortcutReceiver.enableInstallQueue(InstallShortcutReceiver.FLAG_DRAG_AND_DROP); mStateTransitionAnimation.startAnimationToWorkspace(mState, mWorkspace.getState(), - Workspace.State.SPRING_LOADED, true /* animated */, + LauncherState.SPRING_LOADED, true /* animated */, null /* onCompleteRunnable */); setState(State.WORKSPACE_SPRING_LOADED); } @@ -2608,11 +2608,6 @@ public class Launcher extends BaseActivity mExitSpringLoadedModeRunnable = new Runnable() { @Override public void run() { - // TODO(hyunyoungs): verify if this hack is still needed, if not, delete. - // - // Before we show workspace, hide all apps again because - // exitSpringLoadedDragMode made it visible. This is a bit hacky; we should - // clean up our state transition functions showWorkspace(true, onCompleteRunnable); mExitSpringLoadedModeRunnable = null; } diff --git a/src/com/android/launcher3/LauncherAnimUtils.java b/src/com/android/launcher3/LauncherAnimUtils.java index 02f05c30e7..358511046c 100644 --- a/src/com/android/launcher3/LauncherAnimUtils.java +++ b/src/com/android/launcher3/LauncherAnimUtils.java @@ -37,7 +37,7 @@ public class LauncherAnimUtils { public static final int ALL_APPS_TRANSITION_MS = 320; public static final int OVERVIEW_TRANSITION_MS = 250; public static final int SPRING_LOADED_TRANSITION_MS = 150; - public static final int SPRING_LOADED_EXIT_SHORT_TIMEOUT = 500; + public static final int SPRING_LOADED_EXIT_DELAY = 500; public static final int SPRING_LOADED_EXIT_NEXT_FRAME = 0; static WeakHashMap sAnimators = new WeakHashMap(); diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java new file mode 100644 index 0000000000..8ddc491227 --- /dev/null +++ b/src/com/android/launcher3/LauncherState.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2017 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; + +import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_AUTO; +import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS; + +import static com.android.launcher3.LauncherAnimUtils.ALL_APPS_TRANSITION_MS; +import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS; +import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_TRANSITION_MS; +import static com.android.launcher3.StateFlags.FLAG_DISABLE_ACCESSIBILITY; +import static com.android.launcher3.StateFlags.FLAG_HIDE_HOTSEAT; +import static com.android.launcher3.StateFlags.FLAG_MULTI_PAGE; +import static com.android.launcher3.StateFlags.FLAG_SHOW_SCRIM; + +import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; + +interface StateFlags { + int FLAG_SHOW_SCRIM = 1 << 0; + int FLAG_MULTI_PAGE = 1 << 1; + int FLAG_HIDE_HOTSEAT = 1 << 2; + int FLAG_DISABLE_ACCESSIBILITY = 1 << 3; +} + +/** + * Various states for launcher + */ +public enum LauncherState { + + NORMAL (ContainerType.WORKSPACE, 0, 0), + ALL_APPS (ContainerType.ALLAPPS, ALL_APPS_TRANSITION_MS, FLAG_DISABLE_ACCESSIBILITY), + SPRING_LOADED (ContainerType.WORKSPACE, SPRING_LOADED_TRANSITION_MS, + FLAG_SHOW_SCRIM | FLAG_MULTI_PAGE | FLAG_DISABLE_ACCESSIBILITY), + OVERVIEW (ContainerType.OVERVIEW, OVERVIEW_TRANSITION_MS, + FLAG_SHOW_SCRIM | FLAG_MULTI_PAGE | FLAG_HIDE_HOTSEAT); + + public final int containerType; + + public final boolean hasMultipleVisiblePages; + public final int workspaceAccessibilityFlag; + + // Properties related to state transition animation. + public final boolean hasScrim; + public final boolean hideHotseat; + public final int transitionDuration; + + LauncherState(int containerType, int transitionDuration, int flags) { + this.containerType = containerType; + this.transitionDuration = transitionDuration; + + this.hasScrim = (flags & FLAG_SHOW_SCRIM) != 0; + this.hasMultipleVisiblePages = (flags & FLAG_MULTI_PAGE) != 0; + this.hideHotseat = (flags & FLAG_HIDE_HOTSEAT) != 0; + this.workspaceAccessibilityFlag = (flags & FLAG_DISABLE_ACCESSIBILITY) != 0 + ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS + : IMPORTANT_FOR_ACCESSIBILITY_AUTO; + } +} diff --git a/src/com/android/launcher3/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java index 9c83e3c016..f07f1bf605 100644 --- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java +++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java @@ -100,7 +100,7 @@ public class LauncherStateTransitionAnimation { cancelAnimation(); if (!animated) { - mLauncher.getWorkspace().setState(Workspace.State.NORMAL_HIDDEN); + mLauncher.getWorkspace().setState(LauncherState.ALL_APPS); mAllAppsController.finishPullUp(); toView.setTranslationX(0.0f); @@ -129,7 +129,7 @@ public class LauncherStateTransitionAnimation { mConfig.reset(); mAllAppsController.animateToAllApps(animation, mConfig); - mLauncher.getWorkspace().setStateWithAnimation(Workspace.State.NORMAL_HIDDEN, + mLauncher.getWorkspace().setStateWithAnimation(LauncherState.ALL_APPS, layerViews, animation, mConfig); Runnable startAnimRunnable = new StartAnimRunnable(animation, toView); @@ -146,11 +146,11 @@ public class LauncherStateTransitionAnimation { * Starts an animation to the workspace from the current overlay view. */ public void startAnimationToWorkspace(final Launcher.State fromState, - final Workspace.State fromWorkspaceState, final Workspace.State toWorkspaceState, + final LauncherState fromWorkspaceState, final LauncherState toWorkspaceState, final boolean animated, final Runnable onCompleteRunnable) { - if (toWorkspaceState != Workspace.State.NORMAL && - toWorkspaceState != Workspace.State.SPRING_LOADED && - toWorkspaceState != Workspace.State.OVERVIEW) { + if (toWorkspaceState != LauncherState.NORMAL && + toWorkspaceState != LauncherState.SPRING_LOADED && + toWorkspaceState != LauncherState.OVERVIEW) { Log.e(TAG, "Unexpected call to startAnimationToWorkspace"); } @@ -166,8 +166,8 @@ public class LauncherStateTransitionAnimation { /** * Starts an animation to the workspace from the apps view. */ - private void startAnimationToWorkspaceFromAllApps(final Workspace.State fromWorkspaceState, - final Workspace.State toWorkspaceState, boolean animated, + private void startAnimationToWorkspaceFromAllApps(final LauncherState fromWorkspaceState, + final LauncherState toWorkspaceState, boolean animated, final Runnable onCompleteRunnable) { final AllAppsContainerView fromView = mLauncher.getAppsView(); // If for some reason our views aren't initialized, don't animate @@ -180,7 +180,7 @@ public class LauncherStateTransitionAnimation { cancelAnimation(); if (!animated) { - if (fromWorkspaceState == Workspace.State.NORMAL_HIDDEN) { + if (fromWorkspaceState == LauncherState.ALL_APPS) { mAllAppsController.finishPullDown(); } fromView.setVisibility(View.GONE); @@ -233,8 +233,8 @@ public class LauncherStateTransitionAnimation { /** * Starts an animation to the workspace from another workspace state, e.g. normal to overview. */ - private void startAnimationToNewWorkspaceState(final Workspace.State fromWorkspaceState, - final Workspace.State toWorkspaceState, final boolean animated, + private void startAnimationToNewWorkspaceState(final LauncherState fromWorkspaceState, + final LauncherState toWorkspaceState, final boolean animated, final Runnable onCompleteRunnable) { final View fromWorkspace = mLauncher.getWorkspace(); // Cancel the current animation diff --git a/src/com/android/launcher3/PinchAnimationManager.java b/src/com/android/launcher3/PinchAnimationManager.java index 10f35bde3e..bbe8e89225 100644 --- a/src/com/android/launcher3/PinchAnimationManager.java +++ b/src/com/android/launcher3/PinchAnimationManager.java @@ -28,8 +28,8 @@ import com.android.launcher3.anim.AnimationLayerSet; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; -import static com.android.launcher3.Workspace.State.NORMAL; -import static com.android.launcher3.Workspace.State.OVERVIEW; +import static com.android.launcher3.LauncherState.NORMAL; +import static com.android.launcher3.LauncherState.OVERVIEW; /** * Manages the animations that play as the user pinches to/from overview mode. @@ -141,12 +141,12 @@ public class PinchAnimationManager { * @param threshold One of {@link PinchThresholdManager#THRESHOLD_ONE}, * {@link PinchThresholdManager#THRESHOLD_TWO}, or * {@link PinchThresholdManager#THRESHOLD_THREE} - * @param startState {@link Workspace.State#NORMAL} or {@link Workspace.State#OVERVIEW}. - * @param goingTowards {@link Workspace.State#NORMAL} or {@link Workspace.State#OVERVIEW}. + * @param startState {@link LauncherState#NORMAL} or {@link LauncherState#OVERVIEW}. + * @param goingTowards {@link LauncherState#NORMAL} or {@link LauncherState#OVERVIEW}. * Note that this doesn't have to be the opposite of startState; */ - public void animateThreshold(float threshold, Workspace.State startState, - Workspace.State goingTowards) { + public void animateThreshold(float threshold, LauncherState startState, + LauncherState goingTowards) { if (threshold == PinchThresholdManager.THRESHOLD_ONE) { if (startState == OVERVIEW) { animateOverviewPanelButtons(goingTowards == OVERVIEW); diff --git a/src/com/android/launcher3/PinchThresholdManager.java b/src/com/android/launcher3/PinchThresholdManager.java index 52aac17352..8cbc33d304 100644 --- a/src/com/android/launcher3/PinchThresholdManager.java +++ b/src/com/android/launcher3/PinchThresholdManager.java @@ -68,10 +68,10 @@ public class PinchThresholdManager { } if (mPassedThreshold != previousPassedThreshold) { - Workspace.State fromState = mWorkspace.isInOverviewMode() ? Workspace.State.OVERVIEW - : Workspace.State.NORMAL; - Workspace.State toState = mWorkspace.isInOverviewMode() ? Workspace.State.NORMAL - : Workspace.State.OVERVIEW; + LauncherState fromState = mWorkspace.isInOverviewMode() ? LauncherState.OVERVIEW + : LauncherState.NORMAL; + LauncherState toState = mWorkspace.isInOverviewMode() ? LauncherState.NORMAL + : LauncherState.OVERVIEW; float thresholdToAnimate = mPassedThreshold; if (mPassedThreshold < previousPassedThreshold) { // User reversed pinch, so heading back to the state that they started from. diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index b57ce63757..213eaadb01 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -17,8 +17,7 @@ package com.android.launcher3; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_NEXT_FRAME; -import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_SHORT_TIMEOUT; -import static com.android.launcher3.LauncherAnimUtils.ALL_APPS_TRANSITION_MS; +import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_TRANSITION_MS; @@ -185,33 +184,6 @@ public class Workspace extends PagedView private SpringLoadedDragController mSpringLoadedDragController; private final float mOverviewModeShrinkFactor; - // State variable that indicates whether the pages are small (ie when you're - // in all apps or customize mode) - - public enum State { - NORMAL (false, ContainerType.WORKSPACE, false, 1, 0), - NORMAL_HIDDEN (false, ContainerType.ALLAPPS, false, 1, ALL_APPS_TRANSITION_MS), - SPRING_LOADED (true, ContainerType.WORKSPACE, true, 1, SPRING_LOADED_TRANSITION_MS), - OVERVIEW (true, ContainerType.OVERVIEW, true, 0, OVERVIEW_TRANSITION_MS); - - public final boolean hasMultipleVisiblePages; - public final int containerType; - - // Properties related to state transition animation. - public final boolean hasScrim; - public final float hotseatAlpha; - public final int transitionDuration; - - State(boolean hasMultipleVisiblePages, int containerType, - boolean hasScrim, float hotseatAlpha, int transitionDuration) { - this.hasMultipleVisiblePages = hasMultipleVisiblePages; - this.containerType = containerType; - this.hasScrim = hasScrim; - this.hotseatAlpha = hotseatAlpha; - this.transitionDuration = transitionDuration; - } - } - // Direction used for moving the workspace and hotseat UI public enum Direction { X (TRANSLATION_X), @@ -238,7 +210,7 @@ public class Workspace extends PagedView private final float[] mHotseatAlpha = new float[] {1, 1, 1}; @ViewDebug.ExportedProperty(category = "launcher") - private State mState = State.NORMAL; + private LauncherState mState = LauncherState.NORMAL; private boolean mIsSwitchingState = false; boolean mChildrenLayersEnabled = true; @@ -1447,16 +1419,16 @@ public class Workspace extends PagedView } public boolean workspaceInModalState() { - return mState != State.NORMAL; + return mState != LauncherState.NORMAL; } /** Returns whether a drag should be allowed to be started from the current workspace state. */ public boolean workspaceIconsCanBeDragged() { - return mState == State.NORMAL || mState == State.SPRING_LOADED; + return mState == LauncherState.NORMAL || mState == LauncherState.SPRING_LOADED; } private void updateChildrenLayersEnabled() { - boolean small = mState == State.OVERVIEW || mIsSwitchingState; + boolean small = mState == LauncherState.OVERVIEW || mIsSwitchingState; boolean enableChildrenLayers = small || isPageInTransition(); if (enableChildrenLayers != mChildrenLayersEnabled) { @@ -1576,7 +1548,7 @@ public class Workspace extends PagedView } public boolean isInOverviewMode() { - return mState == State.OVERVIEW; + return mState == LauncherState.OVERVIEW; } public void snapToPageFromOverView(int whichPage) { @@ -1626,9 +1598,9 @@ public class Workspace extends PagedView /** - * Sets the current workspace {@link State} and updates the UI without any animations + * Sets the current workspace {@link LauncherState} and updates the UI without any animations */ - public void setState(State toState) { + public void setState(LauncherState toState) { // Update the current state mState = toState; mStateTransitionAnimation.setState(mState); @@ -1640,11 +1612,11 @@ public class Workspace extends PagedView } /** - * Sets the current workspace {@link State}, while animating the UI + * Sets the current workspace {@link LauncherState}, then animates the UI */ - public void setStateWithAnimation(State toState, AnimationLayerSet layerViews, AnimatorSet anim, - AnimationConfig config) { - final State fromState = mState; + public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews, + AnimatorSet anim, AnimationConfig config) { + final LauncherState fromState = mState; // Update the current state mState = toState; @@ -1662,7 +1634,7 @@ public class Workspace extends PagedView anim.addListener(listener); } - public State getState() { + public LauncherState getState() { return mState; } @@ -1673,14 +1645,12 @@ public class Workspace extends PagedView for (int i = 0; i < total; i++) { updateAccessibilityFlags((CellLayout) getPageAt(i), i); } - setImportantForAccessibility((mState == State.NORMAL || mState == State.OVERVIEW) - ? IMPORTANT_FOR_ACCESSIBILITY_AUTO - : IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); + setImportantForAccessibility(mState.workspaceAccessibilityFlag); } } private void updateAccessibilityFlags(CellLayout page, int pageNo) { - if (mState == State.OVERVIEW) { + if (mState == LauncherState.OVERVIEW) { page.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); page.getShortcutsAndWidgets().setImportantForAccessibility( IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); @@ -1694,11 +1664,9 @@ public class Workspace extends PagedView page.setAccessibilityDelegate(mPagesAccessibilityDelegate); } } else { - int accessible = mState == State.NORMAL ? - IMPORTANT_FOR_ACCESSIBILITY_AUTO : - IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS; page.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); - page.getShortcutsAndWidgets().setImportantForAccessibility(accessible); + page.getShortcutsAndWidgets() + .setImportantForAccessibility(mState.workspaceAccessibilityFlag); page.setContentDescription(null); page.setAccessibilityDelegate(null); } @@ -1717,11 +1685,11 @@ public class Workspace extends PagedView } private void onStartStateTransition() { - if (mState == State.SPRING_LOADED) { + if (mState == LauncherState.SPRING_LOADED) { // Show the page indicator at the same time as the rest of the transition. showPageIndicatorAtCurrentScroll(); } - getPageIndicator().setShouldAutoHide(mState != State.SPRING_LOADED); + getPageIndicator().setShouldAutoHide(mState != LauncherState.SPRING_LOADED); } public void onEndStateTransition() { @@ -1730,7 +1698,7 @@ public class Workspace extends PagedView mForceDrawAdjacentPages = false; mTransitionProgress = 1; - if (mState == State.OVERVIEW) { + if (mState == LauncherState.OVERVIEW) { enableFreeScroll(); } else { disableFreeScroll(); @@ -1840,7 +1808,7 @@ public class Workspace extends PagedView private boolean transitionStateShouldAllowDrop() { return ((!isSwitchingState() || mTransitionProgress > ALLOW_DROP_TRANSITION_PROGRESS) && - (mState == State.NORMAL || mState == State.SPRING_LOADED)); + (mState == LauncherState.NORMAL || mState == LauncherState.SPRING_LOADED)); } /** @@ -2111,7 +2079,7 @@ public class Workspace extends PagedView dropTargetLayout, mTargetCell, distance, false, d.dragView) || addToExistingFolderIfNecessary(cell, dropTargetLayout, mTargetCell, distance, d, false)) { - mLauncher.exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); + mLauncher.exitSpringLoadedDragMode(SPRING_LOADED_EXIT_DELAY); return; } @@ -2250,7 +2218,7 @@ public class Workspace extends PagedView parent.onDropChild(cell); mLauncher.exitSpringLoadedDragMode( - SPRING_LOADED_EXIT_SHORT_TIMEOUT, onCompleteRunnable); + SPRING_LOADED_EXIT_DELAY, onCompleteRunnable); } if (d.stateAnnouncer != null && !droppedOnOriginalCell) { @@ -2782,7 +2750,7 @@ public class Workspace extends PagedView final long screenId = getIdForScreen(cellLayout); if (!mLauncher.isHotseatLayout(cellLayout) && screenId != getScreenIdForPageIndex(mCurrentPage) - && mState != State.SPRING_LOADED) { + && mState != LauncherState.SPRING_LOADED) { snapToPage(getPageIndexForScreenId(screenId)); } @@ -2857,7 +2825,7 @@ public class Workspace extends PagedView animationStyle, finalView, true); } else { // This is for other drag/drop cases, like dragging from All Apps - mLauncher.exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); + mLauncher.exitSpringLoadedDragMode(SPRING_LOADED_EXIT_DELAY); View view; @@ -3601,7 +3569,7 @@ public class Workspace extends PagedView @Override public boolean enableFreeScroll() { - if (getState() == State.OVERVIEW) { + if (getState() == LauncherState.OVERVIEW) { return super.enableFreeScroll(); } else { Log.w(TAG, "enableFreeScroll called but not in overview: state=" + getState()); diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java index 9d9e9fb1a9..8e215b0336 100644 --- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java +++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java @@ -33,7 +33,6 @@ import android.view.accessibility.AccessibilityManager; import android.view.animation.DecelerateInterpolator; import com.android.launcher3.LauncherStateTransitionAnimation.AnimationConfig; -import com.android.launcher3.Workspace.State; import com.android.launcher3.anim.AnimationLayerSet; /** @@ -163,17 +162,17 @@ public class WorkspaceStateTransitionAnimation { mWorkspaceFadeInAdjacentScreens = grid.shouldFadeAdjacentWorkspaceScreens(); } - public void setState(Workspace.State toState) { + public void setState(LauncherState toState) { setWorkspaceProperty(toState, NO_ANIM_PROPERTY_SETTER); } - public void setStateWithAnimation(Workspace.State fromState, Workspace.State toState, + public void setStateWithAnimation(LauncherState fromState, LauncherState toState, AnimatorSet anim, AnimationLayerSet layerViews, AnimationConfig config) { - long duration = config.getDuration(toState == State.NORMAL + long duration = config.getDuration(toState == LauncherState.NORMAL ? fromState.transitionDuration : toState.transitionDuration); - AnimatedPropertySetter proertSetter = + AnimatedPropertySetter propertySetter = new AnimatedPropertySetter(duration, layerViews, anim); - setWorkspaceProperty(toState, proertSetter); + setWorkspaceProperty(toState, propertySetter); } public float getFinalScale() { @@ -183,7 +182,7 @@ public class WorkspaceStateTransitionAnimation { /** * Starts a transition animation for the workspace. */ - private void setWorkspaceProperty(Workspace.State state, PropertySetter propertySetter) { + private void setWorkspaceProperty(LauncherState state, PropertySetter propertySetter) { // Update the workspace state int finalBackgroundAlpha = state.hasScrim ? 255 : 0; @@ -211,13 +210,13 @@ public class WorkspaceStateTransitionAnimation { // Only animate the page alpha when we actually fade pages if (mWorkspaceFadeInAdjacentScreens) { - float finalAlpha = state == State.NORMAL && i != toPage ? 0 : 1f; + float finalAlpha = state == LauncherState.NORMAL && i != toPage ? 0 : 1f; propertySetter.setFloat(cl.getShortcutsAndWidgets(), View.ALPHA, finalAlpha, mZoomInInterpolator); } } - float finalHotseatAlpha = state.hotseatAlpha; + float finalHotseatAlpha = state.hideHotseat ? 0f : 1f; // This is true when transitioning between: // - Overview <-> Workspace diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java index 8386f8ffac..10bd67de8e 100644 --- a/src/com/android/launcher3/dragndrop/DragController.java +++ b/src/com/android/launcher3/dragndrop/DragController.java @@ -16,7 +16,7 @@ package com.android.launcher3.dragndrop; -import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_SHORT_TIMEOUT; +import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; import android.content.ComponentName; import android.content.res.Resources; @@ -263,7 +263,7 @@ public class DragController implements DragDriver.EventListener, TouchController if (!accepted) { // If it was not accepted, cleanup the state. If it was accepted, it is the // responsibility of the drop target to cleanup the state. - mLauncher.exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); + mLauncher.exitSpringLoadedDragMode(SPRING_LOADED_EXIT_DELAY); mDragObject.deferDragViewCleanupPostAnimation = false; } diff --git a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java index 1da78349d6..52167bb8bf 100644 --- a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java +++ b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java @@ -83,7 +83,7 @@ class PinShortcutRequestActivityInfo extends ShortcutConfigActivityInfo { public com.android.launcher3.ShortcutInfo createShortcutInfo() { // Total duration for the drop animation to complete. long duration = mContext.getResources().getInteger(R.integer.config_dropAnimMaxDuration) + - LauncherAnimUtils.SPRING_LOADED_EXIT_SHORT_TIMEOUT + + LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY + LauncherAnimUtils.SPRING_LOADED_TRANSITION_MS; // Delay the actual accept() call until the drop animation is complete. return LauncherAppsCompatVO.createShortcutInfoFromPinItemRequest( diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index fae420eef1..fcc4f0efc3 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -16,7 +16,7 @@ package com.android.launcher3.folder; -import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_SHORT_TIMEOUT; +import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -1243,7 +1243,7 @@ public class Folder extends AbstractFloatingView implements DragSource, View.OnC mInfo.setOption(FolderInfo.FLAG_MULTI_PAGE_ANIMATION, true, mLauncher.getModelWriter()); } - mLauncher.exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); + mLauncher.exitSpringLoadedDragMode(SPRING_LOADED_EXIT_DELAY); if (d.stateAnnouncer != null) { d.stateAnnouncer.completeAction(R.string.item_moved); }