Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d9de4b05 authored by Uwais Ashraf's avatar Uwais Ashraf
Browse files

Add max height logic and avoidance of taskbar into task menu

Fix: 329842207
Test: Manually tested, see video in bug
Flag: NA
Change-Id: I08079f14cee63fe7973ba751529109ca66423bb6
parent c752dd03
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -23,6 +23,10 @@
    android:orientation="vertical"
    android:visibility="invisible">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:id="@+id/menu_option_layout"
            android:layout_width="match_parent"
@@ -30,4 +34,6 @@
            android:orientation="vertical"
            android:showDividers="middle" />

    </ScrollView>

</com.android.quickstep.views.TaskMenuViewWithArrow>
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -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
+19 −0
Original line number Diff line number Diff line
@@ -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