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

Commit 5bb14d69 authored by Bruno Martins's avatar Bruno Martins
Browse files

NavigationBarView: Fix cursor keys visibility with gestural mode enabled

When gestural mode is enabled and the IME is being shown
the cursor keys must be hidden, otherwise there's an overlap.

Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/1730
Change-Id: I2f34810d7b137573360a140bbf267028363e6a28
parent 242d9527
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -639,20 +639,25 @@ public class NavigationBarView extends FrameLayout implements

        updateRecentsIcon();

        final boolean isImeShown =
                (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0;
        final boolean showCursorKeys = mShowCursorKeys
        boolean showCursorKeys = mShowCursorKeys
                && (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0;
        final boolean showImeSwitcher = isImeShown
        final boolean showImeSwitcher = mImeVisible &&
                // IME switcher can be shown while gestural mode is enabled because
                // the cursor keys must be hidden anyway
                (isGesturalMode(mNavBarMode) ||
                // IME switcher in 3-button mode and cursor keys take the same spot in
                // the view, so one can only use one or the other
                && (!isLegacyMode(mNavBarMode) || !showCursorKeys);
                (!isLegacyMode(mNavBarMode) || !showCursorKeys));

        // Update IME button visibility, a11y and rotate button always overrides the appearance
        mContextualButtonGroup.setButtonVisibility(R.id.ime_switcher, showImeSwitcher);

        mBarTransitions.reapplyDarkIntensity();

        if (isGesturalMode(mNavBarMode)) {
            // With gestural mode enabled, ensure that cursor keys are not shown if IME is visible
            showCursorKeys &= !mImeVisible;
        }
        final int cursorKeyVisibility = showCursorKeys ? View.VISIBLE : View.INVISIBLE;

        getCursorLeftButton().setVisibility(cursorKeyVisibility);