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

Commit ce5a4940 authored by Sukesh Ram's avatar Sukesh Ram Committed by Android (Google) Code Review
Browse files

Merge "Remove Close Button From Handle Menu in Freeform" into main

parents 15f7885a 27a5e9c9
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -428,9 +428,12 @@
    <!-- The height of the handle menu's "Windowing" pill in desktop mode. -->
    <dimen name="desktop_mode_handle_menu_windowing_pill_height">52dp</dimen>

    <!-- The height of the handle menu's "More Actions" pill in desktop mode. -->
    <!-- The height of the handle menu's "More Actions" pill in desktop mode, but not freeform. -->
    <dimen name="desktop_mode_handle_menu_more_actions_pill_height">156dp</dimen>

    <!-- The height of the handle menu's "More Actions" pill in freeform desktop windowing mode. -->
    <dimen name="desktop_mode_handle_menu_more_actions_pill_freeform_height">104dp</dimen>

    <!-- The top margin of the handle menu in desktop mode. -->
    <dimen name="desktop_mode_handle_menu_margin_top">4dp</dimen>

+18 −5
Original line number Diff line number Diff line
@@ -186,7 +186,12 @@ class HandleMenu {
        // More Actions pill setup.
        final View moreActionsPillView = mMoreActionsPill.mWindowViewHost.getView();
        final Button closeBtn = moreActionsPillView.findViewById(R.id.close_button);
        if (mTaskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM) {
            closeBtn.setVisibility(View.GONE);
        } else {
            closeBtn.setVisibility(View.VISIBLE);
            closeBtn.setOnClickListener(mOnClickListener);
        }
        final Button selectBtn = moreActionsPillView.findViewById(R.id.select_button);
        selectBtn.setOnClickListener(mOnClickListener);
    }
@@ -228,7 +233,6 @@ class HandleMenu {

    /**
     * Update pill layout, in case task changes have caused positioning to change.
     * @param t
     */
    void relayout(SurfaceControl.Transaction t) {
        if (mAppInfoPill != null) {
@@ -245,10 +249,12 @@ class HandleMenu {
                    mMoreActionsPillPosition.x, mMoreActionsPillPosition.y);
        }
    }

    /**
     * Check a passed MotionEvent if a click has occurred on any button on this caption
     * Note this should only be called when a regular onClick is not possible
     * (i.e. the button was clicked through status bar layer)
     *
     * @param ev the MotionEvent to compare against.
     */
    void checkClickEvent(MotionEvent ev) {
@@ -267,6 +273,7 @@ class HandleMenu {
     * A valid menu input is one of the following:
     * An input that happens in the menu views.
     * Any input before the views have been laid out.
     *
     * @param inputPoint the input to compare against.
     */
    boolean isValidMenuInput(PointF inputPoint) {
@@ -297,7 +304,6 @@ class HandleMenu {

    /**
     * Check if the views for handle menu can be seen.
     * @return
     */
    private boolean viewsLaidOut() {
        return mAppInfoPill.mWindowViewHost.getView().isLaidOut();
@@ -318,8 +324,7 @@ class HandleMenu {
                R.dimen.desktop_mode_handle_menu_app_info_pill_height);
        mWindowingPillHeight = loadDimensionPixelSize(resources,
                R.dimen.desktop_mode_handle_menu_windowing_pill_height);
        mMoreActionsPillHeight = loadDimensionPixelSize(resources,
                R.dimen.desktop_mode_handle_menu_more_actions_pill_height);
        mMoreActionsPillHeight = shouldShowCloseButton(resources);
        mShadowRadius = loadDimensionPixelSize(resources,
                R.dimen.desktop_mode_handle_menu_shadow_radius);
        mCornerRadius = loadDimensionPixelSize(resources,
@@ -333,6 +338,14 @@ class HandleMenu {
        return resources.getDimensionPixelSize(resourceId);
    }

    private int shouldShowCloseButton(Resources resources) {
        return (mTaskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM)
                ? loadDimensionPixelSize(resources,
                R.dimen.desktop_mode_handle_menu_more_actions_pill_freeform_height)
                : loadDimensionPixelSize(resources,
                        R.dimen.desktop_mode_handle_menu_more_actions_pill_height);
    }

    void close() {
        mAppInfoPill.releaseView();
        mAppInfoPill = null;