summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-04-29 16:50:53 -0400
committerJason Monk <jmonk@google.com>2014-05-02 09:39:41 -0400
commitf1ff209523a2474cb0e7aab0e083596c4afbe37f (patch)
tree37e9c1a5eb651ae9ac5123fdf3bfd264bebebb27
parent627aad9c200cb19aa505504dcd232a3710e96a25 (diff)
downloadframeworks_base-f1ff209523a2474cb0e7aab0e083596c4afbe37f.zip
frameworks_base-f1ff209523a2474cb0e7aab0e083596c4afbe37f.tar.gz
frameworks_base-f1ff209523a2474cb0e7aab0e083596c4afbe37f.tar.bz2
Add IME Switcher icon to Navigation Bar
Adds button in the same location as the menu button and overrides it when present. The setNavigationHintIconHints lets it know when the button should be shown. Bug: 14257632 Change-Id: Ia80de7fd2390cd8b083e37cbe58b7ee53555e619
-rw-r--r--core/java/android/app/StatusBarManager.java1
-rw-r--r--packages/SystemUI/res/drawable-hdpi/ic_ime_switcher_default.pngbin0 -> 755 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_ime_switcher_default.pngbin0 -> 642 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/ic_ime_switcher_default.pngbin0 -> 1012 bytes
-rw-r--r--packages/SystemUI/res/drawable-xxhdpi/ic_ime_switcher_default.pngbin0 -> 1183 bytes
-rw-r--r--packages/SystemUI/res/layout-ldrtl/navigation_bar.xml66
-rw-r--r--packages/SystemUI/res/layout-sw600dp/navigation_bar.xml70
-rw-r--r--packages/SystemUI/res/layout/navigation_bar.xml68
-rw-r--r--packages/SystemUI/res/values-sw600dp/dimens.xml3
-rw-r--r--packages/SystemUI/res/values/dimens.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java28
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java19
12 files changed, 192 insertions, 67 deletions
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java
index 5cf61a8..ce5306f 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 0000000..369c88d
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_ime_switcher_default.png
Binary files 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 0000000..7d97eb5
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_ime_switcher_default.png
Binary files 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 0000000..900801a
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_ime_switcher_default.png
Binary files 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 0000000..6c8222e
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xxhdpi/ic_ime_switcher_default.png
Binary files differ
diff --git a/packages/SystemUI/res/layout-ldrtl/navigation_bar.xml b/packages/SystemUI/res/layout-ldrtl/navigation_bar.xml
index aa7256b..5f12706 100644
--- a/packages/SystemUI/res/layout-ldrtl/navigation_bar.xml
+++ b/packages/SystemUI/res/layout-ldrtl/navigation_bar.xml
@@ -43,7 +43,7 @@
<!-- navigation controls -->
<View
- android:layout_width="40dp"
+ android:layout_width="@dimen/navigation_extra_key_width"
android:layout_height="match_parent"
android:layout_weight="0"
android:visibility="invisible"
@@ -88,16 +88,29 @@
systemui:glowBackground="@drawable/ic_sysbar_highlight"
android:contentDescription="@string/accessibility_recent"
/>
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
- android:layout_width="@dimen/navigation_menu_key_width"
+ <FrameLayout
+ android:layout_width="@dimen/navigation_extra_key_width"
android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_menu"
- systemui:keyCode="82"
- android:layout_weight="0"
- android:visibility="invisible"
- android:contentDescription="@string/accessibility_menu"
- systemui:glowBackground="@drawable/ic_sysbar_highlight"
- />
+ android:layout_weight="0" >
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/menu"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:contentDescription="@string/accessibility_menu"
+ android:src="@drawable/ic_sysbar_menu"
+ android:visibility="invisible"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight"
+ systemui:keyCode="82" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/ime_switcher"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:contentDescription="@string/accessibility_ime_switch_button"
+ android:scaleType="centerInside"
+ android:src="@drawable/ic_ime_switcher_default"
+ android:visibility="invisible"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight" />
+ </FrameLayout>
</LinearLayout>
<!-- lights out layout to match exactly -->
@@ -187,16 +200,29 @@
>
<!-- navigation controls -->
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
- android:layout_height="40dp"
- android:layout_width="match_parent"
- android:src="@drawable/ic_sysbar_menu_land"
- systemui:keyCode="82"
- android:layout_weight="0"
- android:visibility="invisible"
- android:contentDescription="@string/accessibility_menu"
- systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
- />
+ <FrameLayout
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:layout_weight="0" >
+ <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
+ android:layout_height="@dimen/navigation_extra_key_width"
+ android:layout_width="match_parent"
+ android:src="@drawable/ic_sysbar_menu_land"
+ systemui:keyCode="82"
+ android:layout_weight="0"
+ android:visibility="invisible"
+ android:contentDescription="@string/accessibility_menu"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/ime_switcher"
+ android:layout_height="@dimen/navigation_extra_key_width"
+ android:layout_width="match_parent"
+ android:contentDescription="@string/accessibility_ime_switch_button"
+ android:scaleType="centerInside"
+ android:src="@drawable/ic_ime_switcher_default"
+ android:visibility="invisible"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight" />
+ </FrameLayout>
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
android:layout_height="80dp"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
index b9ad799..6a2e3c6 100644
--- a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
+++ b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
@@ -42,7 +42,7 @@
<!-- navigation controls -->
<View
- android:layout_width="48dp"
+ android:layout_width="@dimen/navigation_extra_key_width"
android:layout_height="match_parent"
android:layout_weight="0"
android:layout_marginStart="2dp"
@@ -85,17 +85,32 @@
android:layout_height="match_parent"
android:layout_weight="1"
/>
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
- android:layout_width="48dp"
+ <FrameLayout
+ android:layout_width="@dimen/navigation_extra_key_width"
android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_menu"
- android:layout_marginEnd="2dp"
- systemui:keyCode="82"
android:layout_weight="0"
- android:visibility="invisible"
- android:contentDescription="@string/accessibility_menu"
- systemui:glowBackground="@drawable/ic_sysbar_highlight"
- />
+ android:layout_marginEnd="2dp" >
+ <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_sysbar_menu"
+ android:layout_marginEnd="2dp"
+ systemui:keyCode="82"
+ android:visibility="invisible"
+ android:contentDescription="@string/accessibility_menu"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight"
+ />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/ime_switcher"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:layout_marginEnd="2dp"
+ android:scaleType="centerInside"
+ android:src="@drawable/ic_ime_switcher_default"
+ android:visibility="invisible"
+ android:contentDescription="@string/accessibility_ime_switch_button"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight" />
+ </FrameLayout>
</LinearLayout>
<!-- lights out layout to match exactly -->
@@ -184,7 +199,7 @@
<!-- navigation controls -->
<View
- android:layout_width="48dp"
+ android:layout_width="@dimen/navigation_extra_key_width"
android:layout_height="match_parent"
android:layout_weight="0"
android:layout_marginStart="2dp"
@@ -227,17 +242,32 @@
android:layout_height="match_parent"
android:layout_weight="1"
/>
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
- android:layout_width="48dp"
+ <FrameLayout
+ android:layout_width="@dimen/navigation_extra_key_width"
android:layout_height="match_parent"
android:layout_marginEnd="2dp"
- android:src="@drawable/ic_sysbar_menu"
- systemui:keyCode="82"
- android:layout_weight="0"
- android:visibility="invisible"
- android:contentDescription="@string/accessibility_menu"
- systemui:glowBackground="@drawable/ic_sysbar_highlight"
- />
+ android:layout_weight="0" >
+ <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:layout_marginEnd="2dp"
+ android:src="@drawable/ic_sysbar_menu"
+ systemui:keyCode="82"
+ android:visibility="invisible"
+ android:contentDescription="@string/accessibility_menu"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight"
+ />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/ime_switcher"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:layout_marginEnd="2dp"
+ android:src="@drawable/ic_ime_switcher_default"
+ android:visibility="invisible"
+ android:contentDescription="@string/accessibility_ime_switch_button"
+ android:scaleType="centerInside"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight" />
+ </FrameLayout>
</LinearLayout>
<!-- lights out layout to match exactly -->
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index 2398849..7470409 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"
/>
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
- android:layout_width="@dimen/navigation_menu_key_width"
+ <FrameLayout
+ android:layout_width="@dimen/navigation_extra_key_width"
android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_menu"
- systemui:keyCode="82"
- android:layout_weight="0"
- android:visibility="invisible"
- android:contentDescription="@string/accessibility_menu"
- systemui:glowBackground="@drawable/ic_sysbar_highlight"
- />
+ android:layout_weight="0" >
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/menu"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:contentDescription="@string/accessibility_menu"
+ android:src="@drawable/ic_sysbar_menu"
+ android:visibility="invisible"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight"
+ systemui:keyCode="82" />
+
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/ime_switcher"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:contentDescription="@string/accessibility_ime_switch_button"
+ android:scaleType="centerInside"
+ android:src="@drawable/ic_ime_switcher_default"
+ android:visibility="invisible"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight" />
+ </FrameLayout>
+
</LinearLayout>
<!-- lights out layout to match exactly -->
@@ -190,18 +205,33 @@
android:id="@+id/nav_buttons"
android:animateLayoutChanges="true"
>
-
+
<!-- navigation controls -->
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
- android:layout_height="40dp"
- android:layout_width="match_parent"
- android:src="@drawable/ic_sysbar_menu_land"
- systemui:keyCode="82"
+ <FrameLayout
android:layout_weight="0"
- android:visibility="invisible"
- android:contentDescription="@string/accessibility_menu"
- systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
- />
+ android:layout_width="match_parent"
+ android:layout_height="40dp" >
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/ime_switcher"
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:contentDescription="@string/accessibility_ime_switch_button"
+ android:scaleType="centerInside"
+ android:src="@drawable/ic_ime_switcher_default"
+ android:visibility="invisible"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight" />
+
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/menu"
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:contentDescription="@string/accessibility_menu"
+ android:src="@drawable/ic_sysbar_menu_land"
+ android:visibility="invisible"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
+ systemui:keyCode="82" />
+ </FrameLayout>
+
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps"
android:layout_height="80dp"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml
index 5b5587d..92e3885 100644
--- a/packages/SystemUI/res/values-sw600dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp/dimens.xml
@@ -36,6 +36,9 @@
<!-- Height of search panel including navigation bar height -->
<dimen name="navbar_search_panel_height">280dip</dimen>
+ <!-- The width of the view containing the menu/ime navigation bar icons -->
+ <dimen name="navigation_extra_key_width">48dip</dimen>
+
<!-- Size of application thumbnail -->
<dimen name="status_bar_recents_thumbnail_width">200dp</dimen>
<dimen name="status_bar_recents_thumbnail_height">177dp</dimen>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 176879e..aadeebe 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -128,8 +128,8 @@
<!-- The width of the view containing non-menu status bar icons -->
<dimen name="navigation_key_width">80dip</dimen>
- <!-- The width of the view containing the menu status bar icon -->
- <dimen name="navigation_menu_key_width">40dip</dimen>
+ <!-- The width of the view containing the menu/ime navigation bar icons -->
+ <dimen name="navigation_extra_key_width">40dip</dimen>
<!-- Default distance beyond which snaps to the matching target -->
<dimen name="navbar_search_snap_margin">40dip</dimen>
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 3fae3f0..089757a 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 545352c..e154b24 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;
@@ -2211,12 +2212,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);
}