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

Commit 27a5e9c9 authored by Sukesh Ram's avatar Sukesh Ram
Browse files

Remove Close Button From Handle Menu in Freeform

When in freeform desktop windowing mode, the close button should be removed.

Test: Manual
Bug: 296629876
Change-Id: Ic0f4c5aa7d22045c5cd7da46abd1c4beac08b6d2
parent 5f6a669b
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -428,9 +428,12 @@
    <!-- The height of the handle menu's "Windowing" pill in desktop mode. -->
    <!-- The height of the handle menu's "Windowing" pill in desktop mode. -->
    <dimen name="desktop_mode_handle_menu_windowing_pill_height">52dp</dimen>
    <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>
    <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. -->
    <!-- The top margin of the handle menu in desktop mode. -->
    <dimen name="desktop_mode_handle_menu_margin_top">4dp</dimen>
    <dimen name="desktop_mode_handle_menu_margin_top">4dp</dimen>


+18 −5
Original line number Original line Diff line number Diff line
@@ -186,7 +186,12 @@ class HandleMenu {
        // More Actions pill setup.
        // More Actions pill setup.
        final View moreActionsPillView = mMoreActionsPill.mWindowViewHost.getView();
        final View moreActionsPillView = mMoreActionsPill.mWindowViewHost.getView();
        final Button closeBtn = moreActionsPillView.findViewById(R.id.close_button);
        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);
            closeBtn.setOnClickListener(mOnClickListener);
        }
        final Button selectBtn = moreActionsPillView.findViewById(R.id.select_button);
        final Button selectBtn = moreActionsPillView.findViewById(R.id.select_button);
        selectBtn.setOnClickListener(mOnClickListener);
        selectBtn.setOnClickListener(mOnClickListener);
    }
    }
@@ -228,7 +233,6 @@ class HandleMenu {


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

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


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