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

Commit 849a0c4e authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Show IME switcher only when physical keyboard is connected in 3 button nav...

Show IME switcher only when physical keyboard is connected in 3 button nav (instead of also when virtual keyboard is visible)

Bug: 226489759
Test: connect to a physical keyboard in 3 button nav and make sure the ime switcher shows; and doesn't show with virtual keyboard
Change-Id: Ib9a5880eb1bd6d5b877a9f3789ce858f399c4910
parent 804feb76
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -108,8 +108,6 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
    private static final int FLAG_SCREEN_PINNING_ACTIVE = 1 << 11;
    private static final int FLAG_VOICE_INTERACTION_WINDOW_SHOWING = 1 << 12;

    private static final int MASK_IME_SWITCHER_VISIBLE = FLAG_SWITCHER_SUPPORTED | FLAG_IME_VISIBLE;

    private static final String NAV_BUTTONS_SEPARATE_WINDOW_TITLE = "Taskbar Nav Buttons";

    public static final int ALPHA_INDEX_IMMERSIVE_MODE = 0;
@@ -191,7 +189,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
                    isThreeButtonNav ? mStartContextualContainer : mEndContextualContainer,
                    mControllers.navButtonController, R.id.ime_switcher);
            mPropertyHolders.add(new StatePropertyHolder(imeSwitcherButton,
                    flags -> ((flags & MASK_IME_SWITCHER_VISIBLE) != 0)
                    flags -> ((flags & FLAG_SWITCHER_SUPPORTED) != 0)
                            && ((flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0)));
        }

@@ -506,6 +504,13 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
        return (mState & FLAG_IME_VISIBLE) != 0;
    }

    /**
     * Returns true if IME switcher is visible
     */
    public boolean isImeSwitcherVisible() {
        return (mState & FLAG_SWITCHER_SUPPORTED) != 0;
    }

    /**
     * Returns true if the home button is disabled
     */
+2 −0
Original line number Diff line number Diff line
@@ -463,6 +463,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
                fromInit);
        mControllers.taskbarViewController.setImeIsVisible(
                mControllers.navbarButtonsViewController.isImeVisible());
        mControllers.taskbarViewController.setIsImeSwitcherVisible(
                mControllers.navbarButtonsViewController.isImeSwitcherVisible());
        int shadeExpandedFlags = SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED
                | SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
        onNotificationShadeExpandChanged((systemUiStateFlags & shadeExpandedFlags) != 0, fromInit);
+10 −1
Original line number Diff line number Diff line
@@ -68,7 +68,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
    public static final int ALPHA_INDEX_RECENTS_DISABLED = 3;
    public static final int ALPHA_INDEX_NOTIFICATION_EXPANDED = 4;
    public static final int ALPHA_INDEX_ASSISTANT_INVOKED = 5;
    private static final int NUM_ALPHA_CHANNELS = 6;
    public static final int ALPHA_INDEX_IME_BUTTON_NAV = 6;
    private static final int NUM_ALPHA_CHANNELS = 7;

    private final TaskbarActivityContext mActivity;
    private final TaskbarView mTaskbarView;
@@ -142,6 +143,14 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
        mTaskbarView.setTouchesEnabled(!isImeVisible);
    }

    /**
     * Should be called when the IME switcher visibility changes.
     */
    public void setIsImeSwitcherVisible(boolean isImeSwitcherVisible) {
        mTaskbarIconAlpha.getProperty(ALPHA_INDEX_IME_BUTTON_NAV).setValue(
                isImeSwitcherVisible ? 0 : 1);
    }

    /**
     * Should be called when the recents button is disabled, so we can hide taskbar icons as well.
     */