Merge "Overview - Remove the space withheld for proactive chips" into sc-dev
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 08f1503..ffd83b1 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -27,12 +27,12 @@
<dimen name="overview_proactive_row_height">48dp</dimen>
<dimen name="overview_proactive_row_bottom_margin">16dp</dimen>
- <dimen name="overview_minimum_next_prev_size">48dp</dimen>
+ <dimen name="overview_minimum_next_prev_size">50dp</dimen>
<dimen name="overview_task_margin">16dp</dimen>
<!-- Overrideable in overlay that provides the Overview Actions. -->
<dimen name="overview_actions_height">48dp</dimen>
- <dimen name="overview_actions_bottom_margin_gesture">12dp</dimen>
+ <dimen name="overview_actions_bottom_margin_gesture">28dp</dimen>
<dimen name="overview_actions_bottom_margin_three_button">8dp</dimen>
<dimen name="overview_actions_horizontal_margin">16dp</dimen>
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index 0b41f15..4720f55 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -253,6 +253,7 @@
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 86bf119..2696cbe 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.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 @@
} else {
int taskMargin = dp.overviewTaskMarginPx;
int proactiveRowAndMargin;
- if (dp.isVerticalBarLayout()) {
+ if (!TaskView.SHOW_PROACTIVE_ACTIONS || dp.isVerticalBarLayout()) {
// In Vertical Bar Layout the proactive row doesn't have its own space, it's inside
// the actions row.
proactiveRowAndMargin = 0;
@@ -223,7 +224,7 @@
}
calculateTaskSizeInternal(context, dp,
dp.overviewTaskThumbnailTopMarginPx,
- proactiveRowAndMargin + getOverviewActionsHeight(context) + taskMargin,
+ proactiveRowAndMargin + getOverviewActionsHeight(context, dp),
res.getDimensionPixelSize(R.dimen.overview_minimum_next_prev_size) + taskMargin,
outRect);
}
@@ -314,23 +315,16 @@
calculateTaskSizeInternal(
context, dp,
dp.overviewTaskMarginPx,
- getOverviewActionsHeight(context) + dp.overviewTaskMarginPx,
+ getOverviewActionsHeight(context, dp),
dp.overviewTaskMarginPx,
outRect);
}
/** Gets the space that the overview actions will take, including bottom margin. */
- public final int getOverviewActionsHeight(Context context) {
+ private int getOverviewActionsHeight(Context context, DeviceProfile dp) {
Resources res = context.getResources();
- int actionsBottomMargin = 0;
- if (getMode(context) == Mode.THREE_BUTTONS) {
- actionsBottomMargin = res.getDimensionPixelSize(
- R.dimen.overview_actions_bottom_margin_three_button);
- } else {
- actionsBottomMargin = res.getDimensionPixelSize(
- R.dimen.overview_actions_bottom_margin_gesture);
- }
- return actionsBottomMargin
+ return OverviewActionsView.getOverviewActionsBottomMarginPx(getMode(context), dp)
+ + OverviewActionsView.getOverviewActionsTopMarginPx(getMode(context), dp)
+ res.getDimensionPixelSize(R.dimen.overview_actions_height);
}
diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
index 9adeea4..8c115e5 100644
--- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
+++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
@@ -93,6 +93,8 @@
private float mModalness;
private float mModalTransformY;
+ protected DeviceProfile mDp;
+
public OverviewActionsView(Context context) {
this(context, null);
}
@@ -205,36 +207,25 @@
/** 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 @@
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 cfac32c..b2a7b1b 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -132,6 +132,12 @@
@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 2882b1f..394aecb 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -296,6 +296,8 @@
<dimen name="task_thumbnail_icon_size">0dp</dimen>
<dimen name="task_thumbnail_icon_size_grid">0dp</dimen>
<dimen name="overview_task_margin">0dp</dimen>
+ <dimen name="overview_actions_bottom_margin_gesture">0dp</dimen>
+ <dimen name="overview_actions_bottom_margin_three_button">0dp</dimen>
<!-- Workspace grid visualization parameters -->
<dimen name="grid_visualization_rounding_radius">22dp</dimen>
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 8126673..cdc09f1 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -170,6 +170,8 @@
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 @@
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);