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 Original line Diff line number Diff line
@@ -456,5 +456,7 @@ class BubbleStackViewTest {
        override fun isStackExpanded(): Boolean = false
        override fun isStackExpanded(): Boolean = false


        override fun isShowingAsBubbleBar(): Boolean = false
        override fun isShowingAsBubbleBar(): Boolean = false

        override fun hideCurrentInputMethod() {}
    }
    }
}
}
+2 −1
Original line number Original line 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.
     * Hides the current input method, wherever it may be focused, via InputMethodManagerInternal.
     */
     */
    void hideCurrentInputMethod() {
    void hideCurrentInputMethod() {
        mBubblePositioner.setImeVisible(false /* visible */, 0 /* height */);
        int displayId = mWindowManager.getDefaultDisplay().getDisplayId();
        int displayId = mWindowManager.getDefaultDisplay().getDisplayId();
        try {
        try {
            mBarService.hideCurrentInputMethodForBubbles(displayId);
            mBarService.hideCurrentInputMethodForBubbles(displayId);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            e.printStackTrace();
            Log.e(TAG, "Failed to hide IME", e);
        }
        }
    }
    }


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


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


                override fun isShowingAsBubbleBar(): Boolean = controller.isShowingAsBubbleBar
                override fun isShowingAsBubbleBar(): Boolean = controller.isShowingAsBubbleBar

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


+20 −6
Original line number Original line 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 static final int INVALID_TASK_ID = -1;


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


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


    /**
    /**
     * Hides the current modal menu view or collapses the bubble stack.
     * Hides the current modal menu if it is visible
     * Called from {@link BubbleBarLayerView}
     * @return {@code true} if menu was visible and is hidden
     */
     */
    public void hideMenuOrCollapse() {
    public boolean hideMenuIfVisible() {
        if (mMenuViewController.isMenuVisible()) {
        if (mMenuViewController.isMenuVisible()) {
            mMenuViewController.hideMenu(/* animated = */ true);
            mMenuViewController.hideMenu(true /* animated */);
        } else {
            return true;
            mManager.collapseStack();
        }
        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. */
    /** Updates the bubble shown in the expanded view. */
Loading