Merge "Overview - Remove the space withheld for proactive chips" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-05-26 00:11:18 +00:00
committed by Android (Google) Code Review
7 changed files with 64 additions and 33 deletions

View File

@@ -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>

View File

@@ -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);

View File

@@ -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<STATE_TYPE extends BaseState<STATE_T
} 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 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
}
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 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
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);
}

View File

@@ -93,6 +93,8 @@ public class OverviewActionsView<T extends OverlayUICallbacks> 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<T extends OverlayUICallbacks> 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<T extends OverlayUICallbacks> 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;
}
}

View File

@@ -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;

View File

@@ -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>

View File

@@ -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);