diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java index 5cf61a8d8c8e7..ce5306ffda4b4 100644 --- a/core/java/android/app/StatusBarManager.java +++ b/core/java/android/app/StatusBarManager.java @@ -60,6 +60,7 @@ public class StatusBarManager { | DISABLE_SEARCH; public static final int NAVIGATION_HINT_BACK_ALT = 1 << 0; + public static final int NAVIGATION_HINT_IME_SHOWN = 1 << 1; public static final int WINDOW_STATUS_BAR = 1; public static final int WINDOW_NAVIGATION_BAR = 2; diff --git a/packages/SystemUI/res/drawable-hdpi/ic_ime_switcher_default.png b/packages/SystemUI/res/drawable-hdpi/ic_ime_switcher_default.png new file mode 100644 index 0000000000000..369c88d317077 Binary files /dev/null and b/packages/SystemUI/res/drawable-hdpi/ic_ime_switcher_default.png differ diff --git a/packages/SystemUI/res/drawable-mdpi/ic_ime_switcher_default.png b/packages/SystemUI/res/drawable-mdpi/ic_ime_switcher_default.png new file mode 100644 index 0000000000000..7d97eb575f2a8 Binary files /dev/null and b/packages/SystemUI/res/drawable-mdpi/ic_ime_switcher_default.png differ diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_ime_switcher_default.png b/packages/SystemUI/res/drawable-xhdpi/ic_ime_switcher_default.png new file mode 100644 index 0000000000000..900801a4d3d70 Binary files /dev/null and b/packages/SystemUI/res/drawable-xhdpi/ic_ime_switcher_default.png differ diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_ime_switcher_default.png b/packages/SystemUI/res/drawable-xxhdpi/ic_ime_switcher_default.png new file mode 100644 index 0000000000000..6c8222ec50b72 Binary files /dev/null and b/packages/SystemUI/res/drawable-xxhdpi/ic_ime_switcher_default.png differ diff --git a/packages/SystemUI/res/layout-ldrtl/navigation_bar.xml b/packages/SystemUI/res/layout-ldrtl/navigation_bar.xml index aa7256bfaf333..5f1270666447d 100644 --- a/packages/SystemUI/res/layout-ldrtl/navigation_bar.xml +++ b/packages/SystemUI/res/layout-ldrtl/navigation_bar.xml @@ -43,7 +43,7 @@ - + android:layout_weight="0" > + + + @@ -187,16 +200,29 @@ > - + + + + - + android:layout_marginEnd="2dp" > + + + @@ -184,7 +199,7 @@ - + android:layout_weight="0" > + + + diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml index 23988493b24ac..74704090aa5a6 100644 --- a/packages/SystemUI/res/layout/navigation_bar.xml +++ b/packages/SystemUI/res/layout/navigation_bar.xml @@ -88,16 +88,31 @@ systemui:glowBackground="@drawable/ic_sysbar_highlight" android:contentDescription="@string/accessibility_recent" /> - + android:layout_weight="0" > + + + + + @@ -190,18 +205,33 @@ android:id="@+id/nav_buttons" android:animateLayoutChanges="true" > - + - + android:layout_width="match_parent" + android:layout_height="40dp" > + + + + + 280dip + + 48dip + 200dp 177dp diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 9837d9b2beacb..c6298deb4afe3 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -128,8 +128,8 @@ 80dip - - 40dip + + 40dip 40dip diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 3fae3f06fa6a7..089757a087fc6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -39,6 +39,7 @@ import android.view.ViewGroup; import android.view.WindowManager; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener; +import android.view.inputmethod.InputMethodManager; import android.widget.ImageView; import android.widget.LinearLayout; @@ -142,6 +143,14 @@ public class NavigationBarView extends LinearLayout { } }; + private final OnClickListener mImeSwitcherClickListener = new OnClickListener() { + @Override + public void onClick(View view) { + ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) + .showInputMethodPicker(); + } + }; + private class H extends Handler { public void handleMessage(Message m) { switch (m.what) { @@ -233,6 +242,10 @@ public class NavigationBarView extends LinearLayout { return mCurrentView.findViewById(R.id.home); } + public View getImeSwitchButton() { + return mCurrentView.findViewById(R.id.ime_switcher); + } + // for when home is disabled, but search isn't public View getSearchLight() { return mCurrentView.findViewById(R.id.search_light); @@ -283,6 +296,12 @@ public class NavigationBarView extends LinearLayout { ((ImageView)getRecentsButton()).setImageDrawable(mVertical ? mRecentLandIcon : mRecentIcon); + final boolean showImeButton = ((hints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0); + getImeSwitchButton().setVisibility(showImeButton ? View.VISIBLE : View.INVISIBLE); + // Update menu button in case the IME state has changed. + setMenuVisibility(mShowMenu, true); + + setDisabledFlags(mDisabledFlags, true); } @@ -363,7 +382,10 @@ public class NavigationBarView extends LinearLayout { mShowMenu = show; - getMenuButton().setVisibility(mShowMenu ? View.VISIBLE : View.INVISIBLE); + // Only show Menu if IME switcher not shown. + final boolean shouldShow = mShowMenu && + ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) == 0); + getMenuButton().setVisibility(shouldShow ? View.VISIBLE : View.INVISIBLE); } @Override @@ -379,6 +401,8 @@ public class NavigationBarView extends LinearLayout { mCurrentView = mRotatedViews[Surface.ROTATION_0]; + getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); + watchForAccessibilityChanges(); } @@ -424,6 +448,8 @@ public class NavigationBarView extends LinearLayout { mCurrentView = mRotatedViews[rot]; mCurrentView.setVisibility(View.VISIBLE); + getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); + mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone); // force the low profile & disabled states into compliance diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 8ad3bb0e6d651..0c3462cb8de8d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone; import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT; +import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SHOWN; import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN; import static android.app.StatusBarManager.WINDOW_STATE_SHOWING; import static android.app.StatusBarManager.windowStateToString; @@ -2209,12 +2210,20 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { @Override public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { - boolean altBack = (backDisposition == InputMethodService.BACK_DISPOSITION_WILL_DISMISS) - || ((vis & InputMethodService.IME_VISIBLE) != 0); + boolean imeShown = (vis & InputMethodService.IME_VISIBLE) != 0; + int flags = mNavigationIconHints; + if ((backDisposition == InputMethodService.BACK_DISPOSITION_WILL_DISMISS) || imeShown) { + flags |= NAVIGATION_HINT_BACK_ALT; + } else { + flags &= ~NAVIGATION_HINT_BACK_ALT; + } + if (imeShown) { + flags |= NAVIGATION_HINT_IME_SHOWN; + } else { + flags &= ~NAVIGATION_HINT_IME_SHOWN; + } - setNavigationIconHints( - altBack ? (mNavigationIconHints | NAVIGATION_HINT_BACK_ALT) - : (mNavigationIconHints & ~NAVIGATION_HINT_BACK_ALT)); + setNavigationIconHints(flags); if (mQS != null) mQS.setImeWindowStatus(vis > 0); }