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

Commit 32403910 authored by Ats Jenk's avatar Ats Jenk Committed by Android (Google) Code Review
Browse files

Merge "Hide IME first when clicking on area outside bubble" into main

parents 5d74e93b c0dec4f2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -456,5 +456,7 @@ class BubbleStackViewTest {
        override fun isStackExpanded(): Boolean = false

        override fun isShowingAsBubbleBar(): Boolean = false

        override fun hideCurrentInputMethod() {}
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -592,11 +592,12 @@ public class BubbleController implements ConfigurationChangeListener,
     * Hides the current input method, wherever it may be focused, via InputMethodManagerInternal.
     */
    void hideCurrentInputMethod() {
        mBubblePositioner.setImeVisible(false /* visible */, 0 /* height */);
        int displayId = mWindowManager.getDefaultDisplay().getDisplayId();
        try {
            mBarService.hideCurrentInputMethodForBubbles(displayId);
        } catch (RemoteException e) {
            e.printStackTrace();
            Log.e(TAG, "Failed to hide IME", e);
        }
    }

+5 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ interface BubbleExpandedViewManager {
    fun setAppBubbleTaskId(key: String, taskId: Int)
    fun isStackExpanded(): Boolean
    fun isShowingAsBubbleBar(): Boolean
    fun hideCurrentInputMethod()

    companion object {
        /**
@@ -73,6 +74,10 @@ interface BubbleExpandedViewManager {
                override fun isStackExpanded(): Boolean = controller.isStackExpanded

                override fun isShowingAsBubbleBar(): Boolean = controller.isShowingAsBubbleBar

                override fun hideCurrentInputMethod() {
                    controller.hideCurrentInputMethod()
                }
            }
        }
    }
+0 −1
Original line number Diff line number Diff line
@@ -2324,7 +2324,6 @@ public class BubbleStackView extends FrameLayout
     * not.
     */
    void hideCurrentInputMethod() {
        mPositioner.setImeVisible(false, 0);
        mManager.hideCurrentInputMethod();
    }

+20 −6
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView
    private static final int INVALID_TASK_ID = -1;

    private BubbleExpandedViewManager mManager;
    private BubblePositioner mPositioner;
    private boolean mIsOverflow;
    private BubbleTaskViewHelper mBubbleTaskViewHelper;
    private BubbleBarMenuViewController mMenuViewController;
@@ -160,6 +161,7 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView
            boolean isOverflow,
            @Nullable BubbleTaskView bubbleTaskView) {
        mManager = expandedViewManager;
        mPositioner = positioner;
        mIsOverflow = isOverflow;

        if (mIsOverflow) {
@@ -290,15 +292,27 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView
    }

    /**
     * Hides the current modal menu view or collapses the bubble stack.
     * Called from {@link BubbleBarLayerView}
     * Hides the current modal menu if it is visible
     * @return {@code true} if menu was visible and is hidden
     */
    public void hideMenuOrCollapse() {
    public boolean hideMenuIfVisible() {
        if (mMenuViewController.isMenuVisible()) {
            mMenuViewController.hideMenu(/* animated = */ true);
        } else {
            mManager.collapseStack();
            mMenuViewController.hideMenu(true /* animated */);
            return true;
        }
        return false;
    }

    /**
     * Hides the IME if it is visible
     * @return {@code true} if IME was visible
     */
    public boolean hideImeIfVisible() {
        if (mPositioner.isImeVisible()) {
            mManager.hideCurrentInputMethod();
            return true;
        }
        return false;
    }

    /** Updates the bubble shown in the expanded view. */
Loading