Support different task icon margin for grid tasks

- Focused and non focused grid now have differnt margin between icon and snapshot
- The overall margin above snapshot is still the same
- Invoke updateChildTaskOrientations when focus task changes to update the margin
- Also lowered the row spacing according to spec

Bug: 194194694
Test: manual
Change-Id: I25267bef19d5a8b1dc1cf96fc1babdc3ebc39330
This commit is contained in:
Alex Chau
2021-08-17 12:56:15 +01:00
parent 40f86763bc
commit eaa6d682d4
5 changed files with 18 additions and 11 deletions
@@ -788,8 +788,11 @@ public class TaskView extends FrameLayout implements Reusable {
LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
snapshotParams.topMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
int taskIconMargin = deviceProfile.overviewTaskMarginPx;
boolean isGridTask = deviceProfile.overviewShowAsGrid && !isFocusedTask();
int taskIconHeight = deviceProfile.overviewTaskIconSizePx;
int taskMargin = isGridTask ? deviceProfile.overviewTaskMarginGridPx
: deviceProfile.overviewTaskMarginPx;
int taskIconMargin = snapshotParams.topMargin - taskIconHeight - taskMargin;
LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams();
switch (orientationHandler.getRotation()) {
case ROTATION_90:
@@ -821,6 +824,9 @@ public class TaskView extends FrameLayout implements Reusable {
iconParams.width = iconParams.height = taskIconHeight;
mIconView.setLayoutParams(iconParams);
mIconView.setRotation(orientationHandler.getDegreesRotated());
int iconDrawableSize = isGridTask ? deviceProfile.overviewTaskIconDrawableSizeGridPx
: deviceProfile.overviewTaskIconDrawableSizePx;
mIconView.setDrawableSize(iconDrawableSize, iconDrawableSize);
snapshotParams.topMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
mSnapshotView.setLayoutParams(snapshotParams);
mSnapshotView.getTaskOverlay().updateOrientationState(orientationState);
@@ -1364,7 +1370,6 @@ public class TaskView extends FrameLayout implements Reusable {
float boxTranslationY;
int expectedWidth;
int expectedHeight;
int iconDrawableSize;
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
if (deviceProfile.overviewShowAsGrid) {
final int thumbnailPadding = deviceProfile.overviewTaskThumbnailTopMarginPx;
@@ -1380,13 +1385,11 @@ public class TaskView extends FrameLayout implements Reusable {
// that is associated with the original orientation of the focused task.
boxWidth = taskWidth;
boxHeight = taskHeight;
iconDrawableSize = deviceProfile.overviewTaskIconDrawableSizePx;
} else {
// Otherwise task is in grid, and should use lastComputedGridTaskSize.
Rect lastComputedGridTaskSize = getRecentsView().getLastComputedGridTaskSize();
boxWidth = lastComputedGridTaskSize.width();
boxHeight = lastComputedGridTaskSize.height();
iconDrawableSize = deviceProfile.overviewTaskIconDrawableSizeGridPx;
}
// Bound width/height to the box size.
@@ -1403,7 +1406,6 @@ public class TaskView extends FrameLayout implements Reusable {
boxTranslationY = 0f;
expectedWidth = ViewGroup.LayoutParams.MATCH_PARENT;
expectedHeight = ViewGroup.LayoutParams.MATCH_PARENT;
iconDrawableSize = deviceProfile.overviewTaskIconDrawableSizePx;
}
setNonGridScale(nonGridScale);
@@ -1413,7 +1415,6 @@ public class TaskView extends FrameLayout implements Reusable {
params.height = expectedHeight;
setLayoutParams(params);
}
mIconView.setDrawableSize(iconDrawableSize, iconDrawableSize);
}
private float getGridTrans(float endTranslation) {