diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2018-03-02 12:24:41 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2018-03-03 00:41:09 -0800 |
commit | 623eddd7e80784e1d3dd758503fe014a15f6c1c8 (patch) | |
tree | b07ca08881131bfb21d6cd3203bee60ca81c7488 /src/com/android/launcher3/states/SpringLoadedState.java | |
parent | 85f1eed52de4c983c1e279523a1c9b35d6ccb842 (diff) | |
download | android_packages_apps_Trebuchet-623eddd7e80784e1d3dd758503fe014a15f6c1c8.tar.gz android_packages_apps_Trebuchet-623eddd7e80784e1d3dd758503fe014a15f6c1c8.tar.bz2 android_packages_apps_Trebuchet-623eddd7e80784e1d3dd758503fe014a15f6c1c8.zip |
Updating Launcher rotation logic
When auto-rotate is on, launcher allways allows rotation. This allows uses to use
locked rotation feature is available on the device
When auto-rotate is off, workspace does not allow rotation, but overview in quickstep
will allow rotation
Bug: 73872056
Change-Id: Ie12365c268fd5e4958634ed97b5a33dcadc691e2
Diffstat (limited to 'src/com/android/launcher3/states/SpringLoadedState.java')
-rw-r--r-- | src/com/android/launcher3/states/SpringLoadedState.java | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/com/android/launcher3/states/SpringLoadedState.java b/src/com/android/launcher3/states/SpringLoadedState.java index 4f8456f25..89a9e2d7d 100644 --- a/src/com/android/launcher3/states/SpringLoadedState.java +++ b/src/com/android/launcher3/states/SpringLoadedState.java @@ -16,10 +16,9 @@ package com.android.launcher3.states; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_TRANSITION_MS; +import static com.android.launcher3.states.RotationHelper.REQUEST_LOCK; -import android.content.pm.ActivityInfo; import android.graphics.Rect; -import android.os.Handler; import android.view.View; import com.android.launcher3.DeviceProfile; @@ -38,10 +37,6 @@ public class SpringLoadedState extends LauncherState { FLAG_DISABLE_ACCESSIBILITY | FLAG_DISABLE_RESTORE | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED | FLAG_DISABLE_PAGE_CLIPPING | FLAG_PAGE_BACKGROUNDS; - // Determines how long to wait after a rotation before restoring the screen orientation to - // match the sensor state. - private static final int RESTORE_SCREEN_ORIENTATION_DELAY = 500; - public SpringLoadedState(int id) { super(id, ContainerType.OVERVIEW, SPRING_LOADED_TRANSITION_MS, STATE_FLAGS); } @@ -84,30 +79,16 @@ public class SpringLoadedState extends LauncherState { ws.showPageIndicatorAtCurrentScroll(); ws.getPageIndicator().setShouldAutoHide(false); - // Lock the orientation: - if (launcher.isRotationEnabled()) { - launcher.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED); - } - // Prevent any Un/InstallShortcutReceivers from updating the db while we are // in spring loaded mode InstallShortcutReceiver.enableInstallQueue(InstallShortcutReceiver.FLAG_DRAG_AND_DROP); + launcher.getRotationHelper().setCurrentStateRequest(REQUEST_LOCK); } @Override public void onStateDisabled(final Launcher launcher) { launcher.getWorkspace().getPageIndicator().setShouldAutoHide(true); - // Unlock rotation lock - if (launcher.isRotationEnabled()) { - new Handler().postDelayed(new Runnable() { - @Override - public void run() { - launcher.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); - } - }, RESTORE_SCREEN_ORIENTATION_DELAY); - } - // Re-enable any Un/InstallShortcutReceiver and now process any queued items InstallShortcutReceiver.disableAndFlushInstallQueue( InstallShortcutReceiver.FLAG_DRAG_AND_DROP, launcher); |