Loading res/values/config.xml +1 −8 Original line number Diff line number Diff line Loading @@ -46,20 +46,13 @@ <!-- AllApps & Launcher transitions --> <!-- The alpha of the AppsCustomize bg in spring loaded mode --> <integer name="config_workspaceScrimAlpha">30</integer> <integer name="config_allAppsTransitionTime">100</integer> <integer name="config_overviewTransitionTime">250</integer> <integer name="config_workspaceScrimAlpha">76</integer> <!-- Out of 100, the percent to shrink the workspace during spring loaded mode. --> <integer name="config_workspaceSpringLoadShrinkPercentage">90</integer> <!-- Out of 100, the percent to shrink the workspace during overview mode. --> <integer name="config_workspaceOverviewShrinkPercentage">70</integer> <!-- Fade/zoom in/out duration & scale in a Launcher overlay transition. Note: This should be less than the config_overlayTransitionTime as they happen together. --> <integer name="config_overlaySlideRevealTime">320</integer> <integer name="config_overlayTransitionTime">300</integer> <!-- This constant stores the ratio of the all apps button drawable which is used for internal (baked-in) padding --> <integer name="config_allAppsButtonPaddingPercent">17</integer> Loading src/com/android/launcher3/ButtonDropTarget.java +3 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.launcher3; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_NEXT_FRAME; import android.animation.AnimatorSet; import android.animation.FloatArrayEvaluator; import android.animation.ObjectAnimator; Loading Loading @@ -229,7 +231,7 @@ public abstract class ButtonDropTarget extends TextView public void run() { completeDrop(d); mDropTargetBar.onDragEnd(); mLauncher.exitSpringLoadedDragMode(true, 0); mLauncher.exitSpringLoadedDragMode(SPRING_LOADED_EXIT_NEXT_FRAME); } }; dragLayer.animateView(d.dragView, from, to, scale, 1f, 1f, 0.1f, 0.1f, Loading src/com/android/launcher3/CellLayout.java +4 −13 Original line number Diff line number Diff line Loading @@ -104,8 +104,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { private final ArrayList<PreviewBackground> mFolderBackgrounds = new ArrayList<>(); final PreviewBackground mFolderLeaveBehind = new PreviewBackground(); private float mBackgroundAlpha; private static final int[] BACKGROUND_STATE_ACTIVE = new int[] { android.R.attr.state_active }; private static final int[] BACKGROUND_STATE_DEFAULT = new int[0]; private final Drawable mBackground; Loading Loading @@ -221,7 +219,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { mBackground = res.getDrawable(R.drawable.bg_celllayout); mBackground.setCallback(this); mBackground.setAlpha((int) (mBackgroundAlpha * 255)); mBackground.setAlpha(0); mReorderPreviewAnimationMagnitude = (REORDER_PREVIEW_MAGNITUDE * grid.iconSizePx); Loading Loading @@ -440,7 +438,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { // When we're small, we are either drawn normally or in the "accepts drops" state (during // a drag). However, we also drag the mini hover background *over* one of those two // backgrounds if (mBackgroundAlpha > 0.0f) { if (mBackground.getAlpha() > 0) { mBackground.draw(canvas); } Loading Loading @@ -847,15 +845,8 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { return getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - (mCountX * mCellWidth); } public float getBackgroundAlpha() { return mBackgroundAlpha; } public void setBackgroundAlpha(float alpha) { if (mBackgroundAlpha != alpha) { mBackgroundAlpha = alpha; mBackground.setAlpha((int) (mBackgroundAlpha * 255)); } public Drawable getScrimBackground() { return mBackground; } @Override Loading src/com/android/launcher3/Launcher.java +27 −67 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ 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.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; Loading Loading @@ -117,6 +120,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.ActivityResultInfo; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.ItemInfoMatcher; Loading Loading @@ -205,15 +209,13 @@ public class Launcher extends BaseActivity static final String APPS_VIEW_SHOWN = "launcher.apps_view_shown"; /** The different states that Launcher can be in. */ enum State { WORKSPACE, WORKSPACE_SPRING_LOADED, APPS, APPS_SPRING_LOADED, WIDGETS, WIDGETS_SPRING_LOADED } enum State { WORKSPACE, WORKSPACE_SPRING_LOADED, APPS} @Thunk State mState = State.WORKSPACE; @Thunk LauncherStateTransitionAnimation mStateTransitionAnimation; private boolean mIsSafeModeEnabled; public static final int EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT = 500; private static final int ON_ACTIVITY_RESULT_ANIMATION_DELAY = 500; // How long to wait before the new-shortcut animation automatically pans the workspace Loading Loading @@ -366,9 +368,6 @@ public class Launcher extends BaseActivity mAppWidgetManager = AppWidgetManagerCompat.getInstance(this); mAppWidgetHost = new LauncherAppWidgetHost(this); if (Utilities.ATLEAST_MARSHMALLOW) { mAppWidgetHost.addProviderChangeListener(this); } mAppWidgetHost.startListening(); // If we are getting an onCreate, we can actually preempt onResume and unset mPaused here, Loading Loading @@ -582,8 +581,7 @@ public class Launcher extends BaseActivity Runnable exitSpringLoaded = new Runnable() { @Override public void run() { exitSpringLoadedDragMode((resultCode != RESULT_CANCELED), EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT); exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); } }; Loading Loading @@ -635,7 +633,7 @@ public class Launcher extends BaseActivity final Runnable onComplete = new Runnable() { @Override public void run() { exitSpringLoadedDragMode(false, 0); exitSpringLoadedDragMode(SPRING_LOADED_EXIT_NEXT_FRAME); } }; Loading Loading @@ -763,8 +761,7 @@ public class Launcher extends BaseActivity @Override public void run() { completeAddAppWidget(appWidgetId, requestArgs, layout, null); exitSpringLoadedDragMode((resultCode != RESULT_CANCELED), EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT); exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); } }; } else if (resultCode == RESULT_CANCELED) { Loading Loading @@ -1439,8 +1436,9 @@ public class Launcher extends BaseActivity if (topOpenView != null) { topOpenView.logActionCommand(Action.Command.HOME_INTENT); } else if (alreadyOnHome) { ued.logActionCommand(Action.Command.HOME_INTENT, mWorkspace.getState().containerType, mWorkspace.getCurrentPage()); Target target = newContainerTarget(mWorkspace.getState().containerType); target.pageIndex = mWorkspace.getCurrentPage(); ued.logActionCommand(Action.Command.HOME_INTENT, target); } // In all these cases, only animate if we're already on home Loading Loading @@ -1714,8 +1712,7 @@ public class Launcher extends BaseActivity @Override public void run() { // Exit spring loaded mode if necessary after adding the widget exitSpringLoadedDragMode(true, EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT ); exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); } }; completeAddAppWidget(appWidgetId, info, boundWidget, addFlowHandler.getProviderInfo(this)); Loading Loading @@ -1899,9 +1896,6 @@ public class Launcher extends BaseActivity } else if (isAppsViewVisible()) { ued.logActionCommand(Action.Command.BACK, ContainerType.ALLAPPS); showWorkspace(true); } else if (isWidgetsViewVisible()) { ued.logActionCommand(Action.Command.BACK, ContainerType.WIDGETS); showOverviewMode(true); } else if (mWorkspace.isInOverviewMode()) { ued.logActionCommand(Action.Command.BACK, ContainerType.OVERVIEW); showWorkspace(true); Loading Loading @@ -2444,10 +2438,6 @@ public class Launcher extends BaseActivity return mState == State.APPS; } public boolean isWidgetsViewVisible() { return mState == State.WIDGETS; } @Override public void onTrimMemory(int level) { super.onTrimMemory(level); Loading Loading @@ -2546,29 +2536,18 @@ public class Launcher extends BaseActivity /** * Shows the apps view. */ public void showAppsView(boolean animated) { markAppsViewShown(); showAppsOrWidgets(State.APPS, animated); } /** * Sets up the transition to show the apps/widgets view. * * @return whether the current from and to state allowed this operation */ // TODO: calling method should use the return value so that when {@code false} is returned // the workspace transition doesn't fall into invalid state. private boolean showAppsOrWidgets(State toState, boolean animated) { public boolean showAppsView(boolean animated) { markAppsViewShown(); if (!(mState == State.WORKSPACE || mState == State.APPS_SPRING_LOADED || mState == State.WIDGETS_SPRING_LOADED || (mState == State.APPS && mAllAppsController.isTransitioning()))) { return false; } if (toState != State.APPS && toState != State.WIDGETS) { return false; } // This is a safe and supported transition to bypass spring_loaded mode. if (mExitSpringLoadedModeRunnable != null) { Loading @@ -2576,14 +2555,10 @@ public class Launcher extends BaseActivity mExitSpringLoadedModeRunnable = null; } if (toState == State.APPS) { mStateTransitionAnimation.startAnimationToAllApps(animated); } else { mStateTransitionAnimation.startAnimationToWidgets(animated); } // Change the state *after* we've called all the transition code setState(toState); setState(State.APPS); AbstractFloatingView.closeAllOpenViews(this); // Send an accessibility event to announce the context change Loading Loading @@ -2613,12 +2588,11 @@ public class Launcher extends BaseActivity setState(State.WORKSPACE_SPRING_LOADED); } public void exitSpringLoadedDragMode(final boolean successfulDrop, int delay) { exitSpringLoadedDragMode(successfulDrop, delay, null); public void exitSpringLoadedDragMode(int delay) { exitSpringLoadedDragMode(delay, null); } public void exitSpringLoadedDragMode(final boolean successfulDrop, int delay, final Runnable onCompleteRunnable) { public void exitSpringLoadedDragMode(int delay, final Runnable onCompleteRunnable) { if (!isStateSpringLoaded()) return; // Unlock rotation lock Loading @@ -2634,18 +2608,12 @@ public class Launcher extends BaseActivity mExitSpringLoadedModeRunnable = new Runnable() { @Override public void run() { if (successfulDrop) { // 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); } else if (mState == State.APPS_SPRING_LOADED) { showAppsView(true /* animated */); } else if (mState == State.WORKSPACE_SPRING_LOADED) { showWorkspace(true); } mExitSpringLoadedModeRunnable = null; } }; Loading @@ -2653,8 +2621,7 @@ public class Launcher extends BaseActivity } boolean isStateSpringLoaded() { return mState == State.WORKSPACE_SPRING_LOADED || mState == State.APPS_SPRING_LOADED || mState == State.WIDGETS_SPRING_LOADED; return mState == State.WORKSPACE_SPRING_LOADED; } @Override Loading Loading @@ -3397,13 +3364,6 @@ public class Launcher extends BaseActivity } } @Override public void notifyWidgetProvidersChanged() { if (mWorkspace.getState().shouldUpdateWidget) { refreshAndBindWidgetsForPackageUser(null); } } /** * @param packageUser if null, refreshes all widgets and shortcuts, otherwise only * refreshes the widgets and shortcuts associated with the given package/user Loading src/com/android/launcher3/LauncherAnimUtils.java +24 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,16 @@ import java.util.HashSet; import java.util.WeakHashMap; public class LauncherAnimUtils { /** * Durations for various state animations. These are not defined in resources to allow * easier access from static classes and enums */ 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_NEXT_FRAME = 0; static WeakHashMap<Animator, Object> sAnimators = new WeakHashMap<Animator, Object>(); static Animator.AnimatorListener sEndAnimListener = new Animator.AnimatorListener() { public void onAnimationStart(Animator animation) { Loading Loading @@ -141,4 +151,18 @@ public class LauncherAnimUtils { drawable.setAlpha(alpha); } }; public static final Property<View, Float> SCALE_PROPERTY = new Property<View, Float>(Float.class, "scale") { @Override public Float get(View view) { return view.getScaleX(); } @Override public void set(View view, Float scale) { view.setScaleX(scale); view.setScaleY(scale); } }; } Loading
res/values/config.xml +1 −8 Original line number Diff line number Diff line Loading @@ -46,20 +46,13 @@ <!-- AllApps & Launcher transitions --> <!-- The alpha of the AppsCustomize bg in spring loaded mode --> <integer name="config_workspaceScrimAlpha">30</integer> <integer name="config_allAppsTransitionTime">100</integer> <integer name="config_overviewTransitionTime">250</integer> <integer name="config_workspaceScrimAlpha">76</integer> <!-- Out of 100, the percent to shrink the workspace during spring loaded mode. --> <integer name="config_workspaceSpringLoadShrinkPercentage">90</integer> <!-- Out of 100, the percent to shrink the workspace during overview mode. --> <integer name="config_workspaceOverviewShrinkPercentage">70</integer> <!-- Fade/zoom in/out duration & scale in a Launcher overlay transition. Note: This should be less than the config_overlayTransitionTime as they happen together. --> <integer name="config_overlaySlideRevealTime">320</integer> <integer name="config_overlayTransitionTime">300</integer> <!-- This constant stores the ratio of the all apps button drawable which is used for internal (baked-in) padding --> <integer name="config_allAppsButtonPaddingPercent">17</integer> Loading
src/com/android/launcher3/ButtonDropTarget.java +3 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.launcher3; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_NEXT_FRAME; import android.animation.AnimatorSet; import android.animation.FloatArrayEvaluator; import android.animation.ObjectAnimator; Loading Loading @@ -229,7 +231,7 @@ public abstract class ButtonDropTarget extends TextView public void run() { completeDrop(d); mDropTargetBar.onDragEnd(); mLauncher.exitSpringLoadedDragMode(true, 0); mLauncher.exitSpringLoadedDragMode(SPRING_LOADED_EXIT_NEXT_FRAME); } }; dragLayer.animateView(d.dragView, from, to, scale, 1f, 1f, 0.1f, 0.1f, Loading
src/com/android/launcher3/CellLayout.java +4 −13 Original line number Diff line number Diff line Loading @@ -104,8 +104,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { private final ArrayList<PreviewBackground> mFolderBackgrounds = new ArrayList<>(); final PreviewBackground mFolderLeaveBehind = new PreviewBackground(); private float mBackgroundAlpha; private static final int[] BACKGROUND_STATE_ACTIVE = new int[] { android.R.attr.state_active }; private static final int[] BACKGROUND_STATE_DEFAULT = new int[0]; private final Drawable mBackground; Loading Loading @@ -221,7 +219,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { mBackground = res.getDrawable(R.drawable.bg_celllayout); mBackground.setCallback(this); mBackground.setAlpha((int) (mBackgroundAlpha * 255)); mBackground.setAlpha(0); mReorderPreviewAnimationMagnitude = (REORDER_PREVIEW_MAGNITUDE * grid.iconSizePx); Loading Loading @@ -440,7 +438,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { // When we're small, we are either drawn normally or in the "accepts drops" state (during // a drag). However, we also drag the mini hover background *over* one of those two // backgrounds if (mBackgroundAlpha > 0.0f) { if (mBackground.getAlpha() > 0) { mBackground.draw(canvas); } Loading Loading @@ -847,15 +845,8 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { return getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - (mCountX * mCellWidth); } public float getBackgroundAlpha() { return mBackgroundAlpha; } public void setBackgroundAlpha(float alpha) { if (mBackgroundAlpha != alpha) { mBackgroundAlpha = alpha; mBackground.setAlpha((int) (mBackgroundAlpha * 255)); } public Drawable getScrimBackground() { return mBackground; } @Override Loading
src/com/android/launcher3/Launcher.java +27 −67 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ 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.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; Loading Loading @@ -117,6 +120,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.ActivityResultInfo; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.ItemInfoMatcher; Loading Loading @@ -205,15 +209,13 @@ public class Launcher extends BaseActivity static final String APPS_VIEW_SHOWN = "launcher.apps_view_shown"; /** The different states that Launcher can be in. */ enum State { WORKSPACE, WORKSPACE_SPRING_LOADED, APPS, APPS_SPRING_LOADED, WIDGETS, WIDGETS_SPRING_LOADED } enum State { WORKSPACE, WORKSPACE_SPRING_LOADED, APPS} @Thunk State mState = State.WORKSPACE; @Thunk LauncherStateTransitionAnimation mStateTransitionAnimation; private boolean mIsSafeModeEnabled; public static final int EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT = 500; private static final int ON_ACTIVITY_RESULT_ANIMATION_DELAY = 500; // How long to wait before the new-shortcut animation automatically pans the workspace Loading Loading @@ -366,9 +368,6 @@ public class Launcher extends BaseActivity mAppWidgetManager = AppWidgetManagerCompat.getInstance(this); mAppWidgetHost = new LauncherAppWidgetHost(this); if (Utilities.ATLEAST_MARSHMALLOW) { mAppWidgetHost.addProviderChangeListener(this); } mAppWidgetHost.startListening(); // If we are getting an onCreate, we can actually preempt onResume and unset mPaused here, Loading Loading @@ -582,8 +581,7 @@ public class Launcher extends BaseActivity Runnable exitSpringLoaded = new Runnable() { @Override public void run() { exitSpringLoadedDragMode((resultCode != RESULT_CANCELED), EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT); exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); } }; Loading Loading @@ -635,7 +633,7 @@ public class Launcher extends BaseActivity final Runnable onComplete = new Runnable() { @Override public void run() { exitSpringLoadedDragMode(false, 0); exitSpringLoadedDragMode(SPRING_LOADED_EXIT_NEXT_FRAME); } }; Loading Loading @@ -763,8 +761,7 @@ public class Launcher extends BaseActivity @Override public void run() { completeAddAppWidget(appWidgetId, requestArgs, layout, null); exitSpringLoadedDragMode((resultCode != RESULT_CANCELED), EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT); exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); } }; } else if (resultCode == RESULT_CANCELED) { Loading Loading @@ -1439,8 +1436,9 @@ public class Launcher extends BaseActivity if (topOpenView != null) { topOpenView.logActionCommand(Action.Command.HOME_INTENT); } else if (alreadyOnHome) { ued.logActionCommand(Action.Command.HOME_INTENT, mWorkspace.getState().containerType, mWorkspace.getCurrentPage()); Target target = newContainerTarget(mWorkspace.getState().containerType); target.pageIndex = mWorkspace.getCurrentPage(); ued.logActionCommand(Action.Command.HOME_INTENT, target); } // In all these cases, only animate if we're already on home Loading Loading @@ -1714,8 +1712,7 @@ public class Launcher extends BaseActivity @Override public void run() { // Exit spring loaded mode if necessary after adding the widget exitSpringLoadedDragMode(true, EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT ); exitSpringLoadedDragMode(SPRING_LOADED_EXIT_SHORT_TIMEOUT); } }; completeAddAppWidget(appWidgetId, info, boundWidget, addFlowHandler.getProviderInfo(this)); Loading Loading @@ -1899,9 +1896,6 @@ public class Launcher extends BaseActivity } else if (isAppsViewVisible()) { ued.logActionCommand(Action.Command.BACK, ContainerType.ALLAPPS); showWorkspace(true); } else if (isWidgetsViewVisible()) { ued.logActionCommand(Action.Command.BACK, ContainerType.WIDGETS); showOverviewMode(true); } else if (mWorkspace.isInOverviewMode()) { ued.logActionCommand(Action.Command.BACK, ContainerType.OVERVIEW); showWorkspace(true); Loading Loading @@ -2444,10 +2438,6 @@ public class Launcher extends BaseActivity return mState == State.APPS; } public boolean isWidgetsViewVisible() { return mState == State.WIDGETS; } @Override public void onTrimMemory(int level) { super.onTrimMemory(level); Loading Loading @@ -2546,29 +2536,18 @@ public class Launcher extends BaseActivity /** * Shows the apps view. */ public void showAppsView(boolean animated) { markAppsViewShown(); showAppsOrWidgets(State.APPS, animated); } /** * Sets up the transition to show the apps/widgets view. * * @return whether the current from and to state allowed this operation */ // TODO: calling method should use the return value so that when {@code false} is returned // the workspace transition doesn't fall into invalid state. private boolean showAppsOrWidgets(State toState, boolean animated) { public boolean showAppsView(boolean animated) { markAppsViewShown(); if (!(mState == State.WORKSPACE || mState == State.APPS_SPRING_LOADED || mState == State.WIDGETS_SPRING_LOADED || (mState == State.APPS && mAllAppsController.isTransitioning()))) { return false; } if (toState != State.APPS && toState != State.WIDGETS) { return false; } // This is a safe and supported transition to bypass spring_loaded mode. if (mExitSpringLoadedModeRunnable != null) { Loading @@ -2576,14 +2555,10 @@ public class Launcher extends BaseActivity mExitSpringLoadedModeRunnable = null; } if (toState == State.APPS) { mStateTransitionAnimation.startAnimationToAllApps(animated); } else { mStateTransitionAnimation.startAnimationToWidgets(animated); } // Change the state *after* we've called all the transition code setState(toState); setState(State.APPS); AbstractFloatingView.closeAllOpenViews(this); // Send an accessibility event to announce the context change Loading Loading @@ -2613,12 +2588,11 @@ public class Launcher extends BaseActivity setState(State.WORKSPACE_SPRING_LOADED); } public void exitSpringLoadedDragMode(final boolean successfulDrop, int delay) { exitSpringLoadedDragMode(successfulDrop, delay, null); public void exitSpringLoadedDragMode(int delay) { exitSpringLoadedDragMode(delay, null); } public void exitSpringLoadedDragMode(final boolean successfulDrop, int delay, final Runnable onCompleteRunnable) { public void exitSpringLoadedDragMode(int delay, final Runnable onCompleteRunnable) { if (!isStateSpringLoaded()) return; // Unlock rotation lock Loading @@ -2634,18 +2608,12 @@ public class Launcher extends BaseActivity mExitSpringLoadedModeRunnable = new Runnable() { @Override public void run() { if (successfulDrop) { // 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); } else if (mState == State.APPS_SPRING_LOADED) { showAppsView(true /* animated */); } else if (mState == State.WORKSPACE_SPRING_LOADED) { showWorkspace(true); } mExitSpringLoadedModeRunnable = null; } }; Loading @@ -2653,8 +2621,7 @@ public class Launcher extends BaseActivity } boolean isStateSpringLoaded() { return mState == State.WORKSPACE_SPRING_LOADED || mState == State.APPS_SPRING_LOADED || mState == State.WIDGETS_SPRING_LOADED; return mState == State.WORKSPACE_SPRING_LOADED; } @Override Loading Loading @@ -3397,13 +3364,6 @@ public class Launcher extends BaseActivity } } @Override public void notifyWidgetProvidersChanged() { if (mWorkspace.getState().shouldUpdateWidget) { refreshAndBindWidgetsForPackageUser(null); } } /** * @param packageUser if null, refreshes all widgets and shortcuts, otherwise only * refreshes the widgets and shortcuts associated with the given package/user Loading
src/com/android/launcher3/LauncherAnimUtils.java +24 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,16 @@ import java.util.HashSet; import java.util.WeakHashMap; public class LauncherAnimUtils { /** * Durations for various state animations. These are not defined in resources to allow * easier access from static classes and enums */ 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_NEXT_FRAME = 0; static WeakHashMap<Animator, Object> sAnimators = new WeakHashMap<Animator, Object>(); static Animator.AnimatorListener sEndAnimListener = new Animator.AnimatorListener() { public void onAnimationStart(Animator animation) { Loading Loading @@ -141,4 +151,18 @@ public class LauncherAnimUtils { drawable.setAlpha(alpha); } }; public static final Property<View, Float> SCALE_PROPERTY = new Property<View, Float>(Float.class, "scale") { @Override public Float get(View view) { return view.getScaleX(); } @Override public void set(View view, Float scale) { view.setScaleX(scale); view.setScaleY(scale); } }; }