diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 08f1503887..ffd83b1ac5 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -27,12 +27,12 @@ 48dp 16dp - 48dp + 50dp 16dp 48dp - 12dp + 28dp 8dp 16dp diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java index 0b41f15b42..4720f55549 100644 --- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java @@ -253,6 +253,7 @@ public abstract class BaseQuickstepLauncher extends Launcher new SplitSelectStateController(mHandler, SystemUiProxy.INSTANCE.get(this)) ); overviewPanel.init(mActionsView, mSplitPlaceholderView); + mActionsView.setDp(getDeviceProfile()); mActionsView.updateVerticalMargin(SysUINavigationMode.getMode(this)); mAppTransitionManager = new QuickstepTransitionManager(this); diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 86bf1194bb..2696cbeb79 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -59,6 +59,7 @@ import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.SplitScreenBounds; +import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.ThumbnailData; @@ -212,7 +213,7 @@ public abstract class BaseActivityInterface extends FrameLayo private float mModalness; private float mModalTransformY; + protected DeviceProfile mDp; + public OverviewActionsView(Context context) { this(context, null); } @@ -205,36 +207,25 @@ public class OverviewActionsView extends FrameLayo /** Updates vertical margins for different navigation mode or configuration changes. */ public void updateVerticalMargin(Mode mode) { + if (mDp == null) { + return; + } LayoutParams actionParams = (LayoutParams) findViewById( R.id.action_buttons).getLayoutParams(); actionParams.setMargins( - actionParams.leftMargin, actionParams.topMargin, actionParams.rightMargin, - getBottomVerticalMargin(mode)); + actionParams.leftMargin, getOverviewActionsTopMarginPx(mode, mDp), + actionParams.rightMargin, getOverviewActionsBottomMarginPx(mode, mDp)); } /** * Set the device profile for this view to draw with. */ public void setDp(DeviceProfile dp) { + mDp = dp; + updateVerticalMargin(SysUINavigationMode.getMode(getContext())); requestLayout(); } - protected int getBottomVerticalMargin(Mode mode) { - int bottomMargin; - int orientation = getResources().getConfiguration().orientation; - if (orientation == Configuration.ORIENTATION_LANDSCAPE) { - bottomMargin = 0; - } else if (mode == Mode.THREE_BUTTONS) { - bottomMargin = getResources() - .getDimensionPixelSize(R.dimen.overview_actions_bottom_margin_three_button); - } else { - bottomMargin = getResources() - .getDimensionPixelSize(R.dimen.overview_actions_bottom_margin_gesture); - } - bottomMargin += mInsets.bottom; - return bottomMargin; - } - /** * The current task is fully modal (modalness = 1) when it is shown on its own in a modal * way. Modalness 0 means the task is shown in context with all the other tasks. @@ -257,4 +248,35 @@ public class OverviewActionsView extends FrameLayo float progress = ACCEL_DEACCEL.getInterpolation(mModalness); return Utilities.mapRange(progress, 0, endTranslation); } + + /** Get the top margin associated with the action buttons in Overview. */ + public static int getOverviewActionsTopMarginPx( + SysUINavigationMode.Mode mode, DeviceProfile dp) { + // In vertical bar, use the smaller task margin for the top regardless of mode + if (dp.isVerticalBarLayout()) { + return dp.overviewTaskMarginPx; + } + + if (mode == SysUINavigationMode.Mode.THREE_BUTTONS) { + return dp.overviewActionsMarginThreeButtonPx; + } + + return dp.overviewActionsMarginGesturePx; + } + + /** Get the bottom margin associated with the action buttons in Overview. */ + public static int getOverviewActionsBottomMarginPx( + SysUINavigationMode.Mode mode, DeviceProfile dp) { + int inset = dp.getInsets().bottom; + + if (dp.isVerticalBarLayout()) { + return inset; + } + + if (mode == SysUINavigationMode.Mode.THREE_BUTTONS) { + return dp.overviewActionsMarginThreeButtonPx + inset; + } + + return dp.overviewActionsMarginGesturePx + inset; + } } diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index cfac32cb09..b2a7b1b85d 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -132,6 +132,12 @@ public class TaskView extends FrameLayout implements Reusable { @IntDef({FLAG_UPDATE_ALL, FLAG_UPDATE_ICON, FLAG_UPDATE_THUMBNAIL}) public @interface TaskDataChanges {} + /** + * Should the layout account for space for a proactive action (or chip) to be added under + * the task. + */ + public static final boolean SHOW_PROACTIVE_ACTIONS = false; + /** The maximum amount that a task view can be scrimmed, dimmed or tinted. */ public static final float MAX_PAGE_SCRIM_ALPHA = 0.4f; diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 2882b1f108..394aecb140 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -296,6 +296,8 @@ 0dp 0dp 0dp + 0dp + 0dp 22dp diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 812667371d..cdc09f10d6 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -170,6 +170,8 @@ public class DeviceProfile { public int overviewTaskMarginPx; public int overviewTaskIconSizePx; public int overviewTaskThumbnailTopMarginPx; + public final int overviewActionsMarginThreeButtonPx; + public final int overviewActionsMarginGesturePx; // Widgets public final PointF appWidgetScale = new PointF(1.0f, 1.0f); @@ -338,6 +340,10 @@ public class DeviceProfile { R.dimen.task_thumbnail_icon_size_grid) : res.getDimensionPixelSize( R.dimen.task_thumbnail_icon_size); overviewTaskThumbnailTopMarginPx = overviewTaskIconSizePx + overviewTaskMarginPx * 2; + overviewActionsMarginGesturePx = res.getDimensionPixelSize( + R.dimen.overview_actions_bottom_margin_gesture); + overviewActionsMarginThreeButtonPx = res.getDimensionPixelSize( + R.dimen.overview_actions_bottom_margin_three_button); // Calculate all of the remaining variables. extraSpace = updateAvailableDimensions(res);