Allow Task menu to draw down to screen bottom

- Use all available spaces minus inset to draw the task menu
- Also enabled scrolling for app chi1p menu

Fix: 329271577
Bug: 326952853
Test: manual
Flag: Nonee
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:26e487c6acd86c668518d379f90cb84f3d89a486)
Merged-In: Ibdff07043f2c64495f97e11e80209bcc3f5dcb4f
Change-Id: Ibdff07043f2c64495f97e11e80209bcc3f5dcb4f
This commit is contained in:
Alex Chau
2024-03-12 17:48:33 +00:00
committed by Cherrypicker Worker
parent 98569d474e
commit b9351e4edd
5 changed files with 26 additions and 8 deletions
@@ -304,6 +304,12 @@ public class LandscapePagedViewHandler implements RecentsPagedOrientationHandler
}
}
@Override
public int getTaskMenuHeight(float taskInsetMargin, DeviceProfile deviceProfile,
float taskMenuX, float taskMenuY) {
return (int) (taskMenuX - taskInsetMargin);
}
@Override
public void setTaskOptionsMenuLayoutOrientation(DeviceProfile deviceProfile,
LinearLayout taskMenuLayout, int dividerSpacing,
@@ -209,6 +209,12 @@ public class PortraitPagedViewHandler extends DefaultPagedViewHandler implements
: thumbnailView.getMeasuredWidth()) - (2 * padding);
}
@Override
public int getTaskMenuHeight(float taskInsetMargin, DeviceProfile deviceProfile,
float taskMenuX, float taskMenuY) {
return (int) (deviceProfile.availableHeightPx - taskInsetMargin - taskMenuY);
}
@Override
public void setTaskOptionsMenuLayoutOrientation(DeviceProfile deviceProfile,
LinearLayout taskMenuLayout, int dividerSpacing,
@@ -176,6 +176,9 @@ public interface RecentsPagedOrientationHandler extends PagedOrientationHandler
View taskMenuView, float taskInsetMargin, View taskViewIcon);
int getTaskMenuWidth(View thumbnailView, DeviceProfile deviceProfile,
@StagePosition int stagePosition);
int getTaskMenuHeight(float taskInsetMargin, DeviceProfile deviceProfile, float taskMenuX,
float taskMenuY);
/**
* Sets linear layout orientation for {@link com.android.launcher3.popup.SystemShortcut} items
* inside task menu view.
@@ -113,6 +113,12 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
}
}
@Override
public int getTaskMenuHeight(float taskInsetMargin, DeviceProfile deviceProfile,
float taskMenuX, float taskMenuY) {
return (int) (deviceProfile.availableWidthPx - taskInsetMargin - taskMenuX);
}
@Override
public void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect, SplitBounds splitInfo,
int desiredStagePosition) {
@@ -140,11 +140,9 @@ public class TaskMenuView extends AbstractFloatingView {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (!enableOverviewIconMenu()) {
int maxMenuHeight = calculateMaxHeight();
if (MeasureSpec.getSize(heightMeasureSpec) > maxMenuHeight) {
heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxMenuHeight, MeasureSpec.AT_MOST);
}
int maxMenuHeight = calculateMaxHeight();
if (MeasureSpec.getSize(heightMeasureSpec) > maxMenuHeight) {
heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxMenuHeight, MeasureSpec.AT_MOST);
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@@ -416,10 +414,9 @@ public class TaskMenuView extends AbstractFloatingView {
* with a margin on the top and bottom.
*/
private int calculateMaxHeight() {
float taskBottom = mTaskView.getHeight() + mTaskView.getPersistentTranslationY();
float taskInsetMargin = getResources().getDimension(R.dimen.task_card_margin);
return (int) (taskBottom - taskInsetMargin - getTranslationY());
return mTaskView.getPagedOrientationHandler().getTaskMenuHeight(taskInsetMargin,
mActivity.getDeviceProfile(), getTranslationX(), getTranslationY());
}
private void setOnClosingStartCallback(Runnable onClosingStartCallback) {