Merge "Add max height logic and avoidance of taskbar into task menu" into main

This commit is contained in:
Treehugger Robot
2024-04-08 18:22:08 +00:00
committed by Android (Google) Code Review
3 changed files with 32 additions and 6 deletions

View File

@@ -23,11 +23,17 @@
android:orientation="vertical"
android:visibility="invisible">
<LinearLayout
android:id="@+id/menu_option_layout"
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:showDividers="middle" />
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/menu_option_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:showDividers="middle" />
</ScrollView>
</com.android.quickstep.views.TaskMenuViewWithArrow>

View File

@@ -213,7 +213,8 @@ public class PortraitPagedViewHandler extends DefaultPagedViewHandler implements
@Override
public int getTaskMenuHeight(float taskInsetMargin, DeviceProfile deviceProfile,
float taskMenuX, float taskMenuY) {
return (int) (deviceProfile.availableHeightPx - taskInsetMargin - taskMenuY);
return (int) (deviceProfile.heightPx - deviceProfile.getInsets().top - taskMenuY
- deviceProfile.getOverviewActionsClaimedSpaceBelow());
}
@Override

View File

@@ -124,6 +124,25 @@ class TaskMenuViewWithArrow<T : BaseDraggingActivity> : ArrowPopup<T> {
optionLayout = requireViewById(R.id.menu_option_layout)
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
val maxMenuHeight: Int = calculateMaxHeight()
val newHeightMeasureSpec =
if (MeasureSpec.getSize(heightMeasureSpec) > maxMenuHeight) {
MeasureSpec.makeMeasureSpec(maxMenuHeight, MeasureSpec.AT_MOST)
} else heightMeasureSpec
super.onMeasure(widthMeasureSpec, newHeightMeasureSpec)
}
private fun calculateMaxHeight(): Int {
val taskInsetMargin = resources.getDimension(R.dimen.task_card_margin)
return taskView.pagedOrientationHandler.getTaskMenuHeight(
taskInsetMargin,
mActivityContext.deviceProfile,
translationX,
translationY
)
}
private fun populateAndShowForTask(
taskContainer: TaskIdAttributeContainer,
alignedOptionIndex: Int