mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Merge "Set max height on TaskMenuView and scroll if too many elements" into main
This commit is contained in:
@@ -35,11 +35,17 @@
|
||||
android:paddingBottom="@dimen/task_menu_edge_padding"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_option_layout"
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
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="horizontal"
|
||||
android:showDividers="middle" />
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</com.android.quickstep.views.TaskMenuView>
|
||||
@@ -136,6 +136,17 @@ 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);
|
||||
}
|
||||
}
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
public void onRotationChanged() {
|
||||
if (mOpenCloseAnimator != null && mOpenCloseAnimator.isRunning()) {
|
||||
mOpenCloseAnimator.end();
|
||||
@@ -393,6 +404,18 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||
return new RoundedRectRevealOutlineProvider(radius, radius, fromRect, toRect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates max height based on how much space we have available.
|
||||
* If not enough space then the view will scroll. The maximum menu size will sit inside the task
|
||||
* 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());
|
||||
}
|
||||
|
||||
private void setOnClosingStartCallback(Runnable onClosingStartCallback) {
|
||||
mOnClosingStartCallback = onClosingStartCallback;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user