diff --git a/quickstep/src/com/android/launcher3/uioverrides/EdgeSwipeController.java b/quickstep/src/com/android/launcher3/uioverrides/EdgeSwipeController.java index 356a144b78..fa09f237ec 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/EdgeSwipeController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/EdgeSwipeController.java @@ -26,6 +26,7 @@ import static com.android.quickstep.TouchInteractionService.EDGE_NAV_BAR; import android.graphics.Rect; import android.view.MotionEvent; +import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.anim.SpringAnimationHandler; import com.android.launcher3.dragndrop.DragLayer; @@ -56,11 +57,7 @@ public class EdgeSwipeController extends VerticalSwipeController { @Override protected boolean isTransitionFlipped() { - if (mLauncher.getDeviceProfile().isVerticalBarLayout()) { - Rect insets = mLauncher.getDragLayer().getInsets(); - return insets.left > insets.right; - } - return false; + return mLauncher.getDeviceProfile().isSeascape(); } @Override @@ -82,9 +79,10 @@ public class EdgeSwipeController extends VerticalSwipeController { RecentsView.getPageRect(launcher.getDeviceProfile(), launcher, sTempRect); DragLayer dl = launcher.getDragLayer(); Rect insets = dl.getInsets(); + DeviceProfile dp = launcher.getDeviceProfile(); - if (launcher.getDeviceProfile().isVerticalBarLayout()) { - if (insets.left > insets.right) { + if (dp.isVerticalBarLayout()) { + if (dp.isSeascape()) { return insets.left + sTempRect.left; } else { return dl.getWidth() - sTempRect.right + insets.right; diff --git a/quickstep/src/com/android/quickstep/RecentsView.java b/quickstep/src/com/android/quickstep/RecentsView.java index 31f8058afc..b35d31bfe8 100644 --- a/quickstep/src/com/android/quickstep/RecentsView.java +++ b/quickstep/src/com/android/quickstep/RecentsView.java @@ -176,7 +176,7 @@ public class RecentsView extends PagedView implements Insettable { if (dp.isVerticalBarLayout()) { boolean wasScrimOnLeft = mScrimOnLeft; - mScrimOnLeft = insets.left > insets.right; + mScrimOnLeft = dp.isSeascape(); if (mScrim == null || wasScrimOnLeft != mScrimOnLeft) { Drawable scrim = getContext().getDrawable(mScrimOnLeft diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 164efe54a7..5789755cae 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -412,7 +412,7 @@ public class DeviceProfile { padding.bottom = edgeMarginPx; padding.left = hotseatBarSidePaddingPx; padding.right = hotseatBarSidePaddingPx; - if (mInsets.left > mInsets.right) { + if (isSeascape()) { padding.left += hotseatBarSizePx; padding.right += pageIndicatorSizePx; } else { @@ -480,6 +480,11 @@ public class DeviceProfile { return isLandscape && transposeLayoutWithOrientation; } + public boolean isSeascape() { + // TODO: This might not hold true for multi window mode, use configuration insead. + return isVerticalBarLayout() && mInsets.left > mInsets.right; + } + public boolean shouldFadeAdjacentWorkspaceScreens() { return isVerticalBarLayout() || isLargeTablet; } diff --git a/src/com/android/launcher3/DropTargetBar.java b/src/com/android/launcher3/DropTargetBar.java index d78043d886..cc6a58f9a4 100644 --- a/src/com/android/launcher3/DropTargetBar.java +++ b/src/com/android/launcher3/DropTargetBar.java @@ -93,8 +93,8 @@ public class DropTargetBar extends FrameLayout if (grid.isVerticalBarLayout()) { lp.width = grid.dropTargetBarSizePx; lp.height = grid.availableHeightPx - 2 * grid.edgeMarginPx; - lp.gravity = insets.left > insets.right ? Gravity.RIGHT : Gravity.LEFT; - tooltipLocation = insets.left > insets.right ? TOOLTIP_LEFT : TOOLTIP_RIGHT; + lp.gravity = grid.isSeascape() ? Gravity.RIGHT : Gravity.LEFT; + tooltipLocation = grid.isSeascape() ? TOOLTIP_LEFT : TOOLTIP_RIGHT; } else { int gap; if (grid.isTablet) { diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 25eacb52f2..9d2bb070e0 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -164,7 +164,7 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett mContent.setGridSize(1, grid.inv.numHotseatIcons); lp.height = ViewGroup.LayoutParams.MATCH_PARENT; - if (insets.left > insets.right) { + if (grid.isSeascape()) { lp.gravity = Gravity.LEFT; lp.width = grid.hotseatBarSizePx + insets.left + grid.hotseatBarSidePaddingPx; getLayout().setPadding( diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java index fca3e47806..a56c8b816f 100644 --- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java +++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java @@ -21,7 +21,6 @@ import android.support.animation.FloatValueHolder; import android.support.animation.SpringAnimation; import android.support.animation.SpringForce; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.text.Selection; import android.text.Spannable; import android.text.SpannableString; @@ -126,8 +125,9 @@ public class AppsSearchContainerLayout extends FrameLayout @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - if (!mLauncher.getDeviceProfile().isVerticalBarLayout()) { - getLayoutParams().height = mLauncher.getDragLayer().getInsets().top + mMinHeight; + DeviceProfile dp = mLauncher.getDeviceProfile(); + if (!dp.isVerticalBarLayout()) { + getLayoutParams().height = dp.getInsets().top + mMinHeight; } super.onMeasure(widthMeasureSpec, heightMeasureSpec); } @@ -212,7 +212,7 @@ public class AppsSearchContainerLayout extends FrameLayout int oldLeft, int oldTop, int oldRight, int oldBottom) { DeviceProfile dp = mLauncher.getDeviceProfile(); if (!dp.isVerticalBarLayout()) { - Rect insets = mLauncher.getDragLayer().getInsets(); + Rect insets = dp.getInsets(); int hotseatBottom = bottom - dp.hotseatBarBottomPaddingPx - insets.bottom; int searchTopMargin = insets.top + (mMinHeight - mSearchBoxHeight) + ((MarginLayoutParams) getLayoutParams()).bottomMargin; diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java index 677694f749..a32f6b1dc2 100644 --- a/src/com/android/launcher3/dragndrop/DragLayer.java +++ b/src/com/android/launcher3/dragndrop/DragLayer.java @@ -52,7 +52,6 @@ import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.keyboard.ViewGroupFocusHelper; import com.android.launcher3.uioverrides.UiFactory; -import com.android.launcher3.util.Themes; import com.android.launcher3.util.Thunk; import com.android.launcher3.util.TouchController; diff --git a/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java b/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java index 4cbf6736cc..3e4bd3100f 100644 --- a/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java +++ b/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java @@ -253,7 +253,7 @@ public class WorkspacePageIndicator extends PageIndicator implements Insettable, FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams(); if (mIsLandscapeUi) { - if (insets.left > insets.right) { + if (grid.isSeascape()) { lp.leftMargin = grid.hotseatBarSidePaddingPx; lp.rightMargin = insets.right; lp.gravity = Gravity.RIGHT | Gravity.BOTTOM;