Loading go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java +6 −0 Original line number Diff line number Diff line Loading @@ -21,10 +21,12 @@ import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import android.view.View; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherStateManager.StateHandler; import com.android.launcher3.Utilities; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.RotationMode; import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController; import com.android.launcher3.uioverrides.touchcontrollers.LandscapeStatesTouchController; import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController; Loading Loading @@ -102,4 +104,8 @@ public abstract class RecentsUiFactory { * @param launcher the launcher activity */ public static void onLauncherStateOrResumeChanged(Launcher launcher) {} public static RotationMode getRotationMode(DeviceProfile dp) { return RotationMode.NORMAL; } } quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java +79 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,11 @@ import static android.view.View.VISIBLE; import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import android.content.Context; import android.graphics.Rect; import android.view.Gravity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; Loading @@ -28,6 +33,7 @@ import com.android.launcher3.LauncherStateManager.StateHandler; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.RotationMode; import com.android.launcher3.uioverrides.touchcontrollers.FlingAndHoldTouchController; import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController; import com.android.launcher3.uioverrides.touchcontrollers.NavBarToHomeTouchController; Loading Loading @@ -58,12 +64,83 @@ public abstract class RecentsUiFactory { // Scale recents takes before animating in private static final float RECENTS_PREPARE_SCALE = 1.33f; public static RotationMode ROTATION_LANDSCAPE = new RotationMode(-90) { @Override public void mapRect(int left, int top, int right, int bottom, Rect out) { out.left = top; out.top = right; out.right = bottom; out.bottom = left; } @Override public void mapInsets(Context context, Rect insets, Rect out) { if (SysUINavigationMode.getMode(context) == NO_BUTTON) { out.set(insets); } else { out.top = Math.max(insets.top, insets.left); out.bottom = insets.right; out.left = insets.bottom; out.right = 0; } } }; public static RotationMode ROTATION_SEASCAPE = new RotationMode(90) { @Override public void mapRect(int left, int top, int right, int bottom, Rect out) { out.left = bottom; out.top = left; out.right = top; out.bottom = right; } @Override public void mapInsets(Context context, Rect insets, Rect out) { if (SysUINavigationMode.getMode(context) == NO_BUTTON) { out.set(insets); } else { out.top = Math.max(insets.top, insets.right); out.bottom = insets.left; out.right = insets.bottom; out.left = 0; } } @Override public int toNaturalGravity(int absoluteGravity) { int horizontalGravity = absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK; int verticalGravity = absoluteGravity & Gravity.VERTICAL_GRAVITY_MASK; if (horizontalGravity == Gravity.RIGHT) { horizontalGravity = Gravity.LEFT; } else if (horizontalGravity == Gravity.LEFT) { horizontalGravity = Gravity.RIGHT; } if (verticalGravity == Gravity.TOP) { verticalGravity = Gravity.BOTTOM; } else if (verticalGravity == Gravity.BOTTOM) { verticalGravity = Gravity.TOP; } return ((absoluteGravity & ~Gravity.HORIZONTAL_GRAVITY_MASK) & ~Gravity.VERTICAL_GRAVITY_MASK) | horizontalGravity | verticalGravity; } }; public static RotationMode getRotationMode(DeviceProfile dp) { return !dp.isVerticalBarLayout() ? RotationMode.NORMAL : (dp.isSeascape() ? ROTATION_SEASCAPE : ROTATION_LANDSCAPE); } public static TouchController[] createTouchControllers(Launcher launcher) { Mode mode = SysUINavigationMode.getMode(launcher); ArrayList<TouchController> list = new ArrayList<>(); list.add(launcher.getDragController()); if (mode == Mode.NO_BUTTON) { if (mode == NO_BUTTON) { list.add(new QuickSwitchTouchController(launcher)); list.add(new NavBarToHomeTouchController(launcher)); list.add(new FlingAndHoldTouchController(launcher)); Loading Loading @@ -106,7 +183,7 @@ public abstract class RecentsUiFactory { * @param launcher the launcher activity */ public static void prepareToShowOverview(Launcher launcher) { if (SysUINavigationMode.getMode(launcher) == Mode.NO_BUTTON) { if (SysUINavigationMode.getMode(launcher) == NO_BUTTON) { // Overview lives on the side, so doesn't scale in from above. return; } Loading quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +4 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; import static android.view.MotionEvent.INVALID_POINTER_ID; import static com.android.launcher3.Utilities.EDGE_NAV_BAR; import static com.android.launcher3.uioverrides.RecentsUiFactory.ROTATION_LANDSCAPE; import static com.android.launcher3.uioverrides.RecentsUiFactory.ROTATION_SEASCAPE; import static com.android.launcher3.util.RaceConditionTracker.ENTER; import static com.android.launcher3.util.RaceConditionTracker.EXIT; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; Loading Loading @@ -171,8 +173,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC && !mRecentsViewDispatcher.hasConsumer()) { mRecentsViewDispatcher.setConsumer(mInteractionHandler.getRecentsViewDispatcher( isNavBarOnLeft() ? RotationMode.SEASCAPE : (isNavBarOnRight() ? RotationMode.LANDSCAPE : RotationMode.NORMAL))); ? ROTATION_SEASCAPE : (isNavBarOnRight() ? ROTATION_LANDSCAPE : RotationMode.NORMAL))); } int edgeFlags = ev.getEdgeFlags(); ev.setEdgeFlags(edgeFlags | EDGE_NAV_BAR); Loading src/com/android/launcher3/Launcher.java +6 −5 Original line number Diff line number Diff line Loading @@ -431,8 +431,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, @Override protected void reapplyUi() { if (FeatureFlags.FAKE_LANDSCAPE_UI.get()) { mRotationMode = mStableDeviceProfile == null ? RotationMode.NORMAL : (mDeviceProfile.isSeascape() ? RotationMode.SEASCAPE : RotationMode.LANDSCAPE); mRotationMode = mStableDeviceProfile == null ? RotationMode.NORMAL : UiFactory.getRotationMode(mDeviceProfile); } getRootView().dispatchInsets(); getStateManager().reapplyState(true /* cancelCurrentAnimation */); Loading Loading @@ -489,8 +489,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, if (FeatureFlags.FAKE_LANDSCAPE_UI.get() && mDeviceProfile.isVerticalBarLayout() && !mDeviceProfile.isMultiWindowMode) { mStableDeviceProfile = mDeviceProfile.inv.portraitProfile; mRotationMode = mDeviceProfile.isSeascape() ? RotationMode.SEASCAPE : RotationMode.LANDSCAPE; mRotationMode = UiFactory.getRotationMode(mDeviceProfile); } else { mStableDeviceProfile = null; mRotationMode = RotationMode.NORMAL; Loading @@ -503,7 +502,9 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, public void updateInsets(Rect insets) { mDeviceProfile.updateInsets(insets); if (mStableDeviceProfile != null) { mStableDeviceProfile.updateInsets(insets); Rect r = mStableDeviceProfile.getInsets(); mRotationMode.mapInsets(this, insets, r); mStableDeviceProfile.updateInsets(r); } } Loading src/com/android/launcher3/Workspace.java +1 −1 Original line number Diff line number Diff line Loading @@ -302,7 +302,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator> rotationMode.mapRect(padding, mTempRect); setPadding(mTempRect.left, mTempRect.top, mTempRect.right, mTempRect.bottom); rotationMode.mapRect(insets, mInsets); rotationMode.mapRect(stableGrid.getInsets(), mInsets); if (mWorkspaceFadeInAdjacentScreens) { // In landscape mode the page spacing is set to the default. Loading Loading
go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java +6 −0 Original line number Diff line number Diff line Loading @@ -21,10 +21,12 @@ import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import android.view.View; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherStateManager.StateHandler; import com.android.launcher3.Utilities; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.RotationMode; import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController; import com.android.launcher3.uioverrides.touchcontrollers.LandscapeStatesTouchController; import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController; Loading Loading @@ -102,4 +104,8 @@ public abstract class RecentsUiFactory { * @param launcher the launcher activity */ public static void onLauncherStateOrResumeChanged(Launcher launcher) {} public static RotationMode getRotationMode(DeviceProfile dp) { return RotationMode.NORMAL; } }
quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java +79 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,11 @@ import static android.view.View.VISIBLE; import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import android.content.Context; import android.graphics.Rect; import android.view.Gravity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; Loading @@ -28,6 +33,7 @@ import com.android.launcher3.LauncherStateManager.StateHandler; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.RotationMode; import com.android.launcher3.uioverrides.touchcontrollers.FlingAndHoldTouchController; import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController; import com.android.launcher3.uioverrides.touchcontrollers.NavBarToHomeTouchController; Loading Loading @@ -58,12 +64,83 @@ public abstract class RecentsUiFactory { // Scale recents takes before animating in private static final float RECENTS_PREPARE_SCALE = 1.33f; public static RotationMode ROTATION_LANDSCAPE = new RotationMode(-90) { @Override public void mapRect(int left, int top, int right, int bottom, Rect out) { out.left = top; out.top = right; out.right = bottom; out.bottom = left; } @Override public void mapInsets(Context context, Rect insets, Rect out) { if (SysUINavigationMode.getMode(context) == NO_BUTTON) { out.set(insets); } else { out.top = Math.max(insets.top, insets.left); out.bottom = insets.right; out.left = insets.bottom; out.right = 0; } } }; public static RotationMode ROTATION_SEASCAPE = new RotationMode(90) { @Override public void mapRect(int left, int top, int right, int bottom, Rect out) { out.left = bottom; out.top = left; out.right = top; out.bottom = right; } @Override public void mapInsets(Context context, Rect insets, Rect out) { if (SysUINavigationMode.getMode(context) == NO_BUTTON) { out.set(insets); } else { out.top = Math.max(insets.top, insets.right); out.bottom = insets.left; out.right = insets.bottom; out.left = 0; } } @Override public int toNaturalGravity(int absoluteGravity) { int horizontalGravity = absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK; int verticalGravity = absoluteGravity & Gravity.VERTICAL_GRAVITY_MASK; if (horizontalGravity == Gravity.RIGHT) { horizontalGravity = Gravity.LEFT; } else if (horizontalGravity == Gravity.LEFT) { horizontalGravity = Gravity.RIGHT; } if (verticalGravity == Gravity.TOP) { verticalGravity = Gravity.BOTTOM; } else if (verticalGravity == Gravity.BOTTOM) { verticalGravity = Gravity.TOP; } return ((absoluteGravity & ~Gravity.HORIZONTAL_GRAVITY_MASK) & ~Gravity.VERTICAL_GRAVITY_MASK) | horizontalGravity | verticalGravity; } }; public static RotationMode getRotationMode(DeviceProfile dp) { return !dp.isVerticalBarLayout() ? RotationMode.NORMAL : (dp.isSeascape() ? ROTATION_SEASCAPE : ROTATION_LANDSCAPE); } public static TouchController[] createTouchControllers(Launcher launcher) { Mode mode = SysUINavigationMode.getMode(launcher); ArrayList<TouchController> list = new ArrayList<>(); list.add(launcher.getDragController()); if (mode == Mode.NO_BUTTON) { if (mode == NO_BUTTON) { list.add(new QuickSwitchTouchController(launcher)); list.add(new NavBarToHomeTouchController(launcher)); list.add(new FlingAndHoldTouchController(launcher)); Loading Loading @@ -106,7 +183,7 @@ public abstract class RecentsUiFactory { * @param launcher the launcher activity */ public static void prepareToShowOverview(Launcher launcher) { if (SysUINavigationMode.getMode(launcher) == Mode.NO_BUTTON) { if (SysUINavigationMode.getMode(launcher) == NO_BUTTON) { // Overview lives on the side, so doesn't scale in from above. return; } Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +4 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; import static android.view.MotionEvent.INVALID_POINTER_ID; import static com.android.launcher3.Utilities.EDGE_NAV_BAR; import static com.android.launcher3.uioverrides.RecentsUiFactory.ROTATION_LANDSCAPE; import static com.android.launcher3.uioverrides.RecentsUiFactory.ROTATION_SEASCAPE; import static com.android.launcher3.util.RaceConditionTracker.ENTER; import static com.android.launcher3.util.RaceConditionTracker.EXIT; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; Loading Loading @@ -171,8 +173,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC && !mRecentsViewDispatcher.hasConsumer()) { mRecentsViewDispatcher.setConsumer(mInteractionHandler.getRecentsViewDispatcher( isNavBarOnLeft() ? RotationMode.SEASCAPE : (isNavBarOnRight() ? RotationMode.LANDSCAPE : RotationMode.NORMAL))); ? ROTATION_SEASCAPE : (isNavBarOnRight() ? ROTATION_LANDSCAPE : RotationMode.NORMAL))); } int edgeFlags = ev.getEdgeFlags(); ev.setEdgeFlags(edgeFlags | EDGE_NAV_BAR); Loading
src/com/android/launcher3/Launcher.java +6 −5 Original line number Diff line number Diff line Loading @@ -431,8 +431,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, @Override protected void reapplyUi() { if (FeatureFlags.FAKE_LANDSCAPE_UI.get()) { mRotationMode = mStableDeviceProfile == null ? RotationMode.NORMAL : (mDeviceProfile.isSeascape() ? RotationMode.SEASCAPE : RotationMode.LANDSCAPE); mRotationMode = mStableDeviceProfile == null ? RotationMode.NORMAL : UiFactory.getRotationMode(mDeviceProfile); } getRootView().dispatchInsets(); getStateManager().reapplyState(true /* cancelCurrentAnimation */); Loading Loading @@ -489,8 +489,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, if (FeatureFlags.FAKE_LANDSCAPE_UI.get() && mDeviceProfile.isVerticalBarLayout() && !mDeviceProfile.isMultiWindowMode) { mStableDeviceProfile = mDeviceProfile.inv.portraitProfile; mRotationMode = mDeviceProfile.isSeascape() ? RotationMode.SEASCAPE : RotationMode.LANDSCAPE; mRotationMode = UiFactory.getRotationMode(mDeviceProfile); } else { mStableDeviceProfile = null; mRotationMode = RotationMode.NORMAL; Loading @@ -503,7 +502,9 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, public void updateInsets(Rect insets) { mDeviceProfile.updateInsets(insets); if (mStableDeviceProfile != null) { mStableDeviceProfile.updateInsets(insets); Rect r = mStableDeviceProfile.getInsets(); mRotationMode.mapInsets(this, insets, r); mStableDeviceProfile.updateInsets(r); } } Loading
src/com/android/launcher3/Workspace.java +1 −1 Original line number Diff line number Diff line Loading @@ -302,7 +302,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator> rotationMode.mapRect(padding, mTempRect); setPadding(mTempRect.left, mTempRect.top, mTempRect.right, mTempRect.bottom); rotationMode.mapRect(insets, mInsets); rotationMode.mapRect(stableGrid.getInsets(), mInsets); if (mWorkspaceFadeInAdjacentScreens) { // In landscape mode the page spacing is set to the default. Loading