diff options
| author | satok <satok@google.com> | 2010-10-29 11:37:18 +0900 |
|---|---|---|
| committer | satok <satok@google.com> | 2010-10-30 03:17:40 +0900 |
| commit | 06487a58be22b100daf3f950b9a1d25c3ea42aa2 (patch) | |
| tree | 51f435300301f0be1256da96ce25abc77112e2ee /packages | |
| parent | e12774d4a81b3658de65e9d2848a7757d8612e0f (diff) | |
| download | frameworks_base-06487a58be22b100daf3f950b9a1d25c3ea42aa2.zip frameworks_base-06487a58be22b100daf3f950b9a1d25c3ea42aa2.tar.gz frameworks_base-06487a58be22b100daf3f950b9a1d25c3ea42aa2.tar.bz2 | |
Add a functionarity for showing / hiding IME button on the system bar
Bug: 3077030
- IME communicates with status bar directly.
Change-Id: Ic5b6b5b7a2b8ea62372dcc9b9c36d81b9f2db651
Diffstat (limited to 'packages')
5 files changed, 38 insertions, 8 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index c164eb4..ed2ed1c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -55,6 +55,7 @@ public class CommandQueue extends IStatusBar.Stub { private static final int MSG_SET_LIGHTS_ON = 0x00070000; private static final int MSG_SHOW_MENU = 0x00080000; + private static final int MSG_SHOW_IME_BUTTON = 0x00090000; private StatusBarIconList mList; private Callbacks mCallbacks; @@ -81,6 +82,7 @@ public class CommandQueue extends IStatusBar.Stub { public void animateCollapse(); public void setLightsOn(boolean on); public void setMenuKeyVisible(boolean visible); + public void setIMEButtonVisible(boolean visible); } public CommandQueue(Callbacks callbacks, StatusBarIconList list) { @@ -163,6 +165,13 @@ public class CommandQueue extends IStatusBar.Stub { } } + public void setIMEButtonVisible(boolean visible) { + synchronized (mList) { + mHandler.removeMessages(MSG_SHOW_IME_BUTTON); + mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, visible ? 1 : 0, 0, null).sendToTarget(); + } + } + private final class H extends Handler { public void handleMessage(Message msg) { final int what = msg.what & MSG_MASK; @@ -223,6 +232,9 @@ public class CommandQueue extends IStatusBar.Stub { case MSG_SHOW_MENU: mCallbacks.setMenuKeyVisible(msg.arg1 != 0); break; + case MSG_SHOW_IME_BUTTON: + mCallbacks.setIMEButtonVisible(msg.arg1 != 0); + break; } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java index bf58b37..b174973 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java @@ -1014,6 +1014,7 @@ public class PhoneStatusBarService extends StatusBarService { // Not supported public void setMenuKeyVisible(boolean visible) { } + public void setIMEButtonVisible(boolean visible) { } private class Launcher implements View.OnClickListener { private PendingIntent mIntent; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java index ae1fdbd..256386b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java @@ -65,7 +65,7 @@ public abstract class StatusBarService extends SystemUI implements CommandQueue. mCommandQueue = new CommandQueue(this, iconList); mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); - boolean[] switches = new boolean[2]; + boolean[] switches = new boolean[3]; try { mBarService.registerStatusBar(mCommandQueue, iconList, notificationKeys, notifications, switches); @@ -75,6 +75,7 @@ public abstract class StatusBarService extends SystemUI implements CommandQueue. setLightsOn(switches[0]); setMenuKeyVisible(switches[1]); + setIMEButtonVisible(switches[2]); // Set up the initial icon state int N = iconList.size(); @@ -119,6 +120,7 @@ public abstract class StatusBarService extends SystemUI implements CommandQueue. + " icons=" + iconList.size() + " lights=" + (switches[0]?"on":"off") + " menu=" + (switches[1]?"visible":"invisible") + + " imeButton=" + (switches[2]?"visible":"invisible") ); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java index 56b4f24..c52bd4d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java @@ -16,7 +16,10 @@ package com.android.systemui.statusbar.tablet; +import android.content.BroadcastReceiver; import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.provider.Settings; @@ -32,7 +35,9 @@ import android.widget.ImageView; import com.android.server.InputMethodManagerService; import com.android.systemui.R; +import java.util.Calendar; import java.util.List; +import java.util.TimeZone; public class InputMethodButton extends ImageView { @@ -61,8 +66,10 @@ public class InputMethodButton extends ImageView { }); } + @Override protected void onAttachedToWindow() { mIcon = (ImageView) findViewById(R.id.imeButton); + refreshStatusIcon(mKeyboardShown); } @@ -127,13 +134,8 @@ public class InputMethodButton extends ImageView { }); } - public void showSoftInput() { - mKeyboardShown = true; - postRefreshStatusIcon(); - } - - public void hideSoftInput() { - mKeyboardShown = false; + public void setIMEButtonVisible(boolean visible) { + mKeyboardShown = visible; postRefreshStatusIcon(); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java index 6e9b456..9dc7850 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java @@ -95,6 +95,8 @@ public class TabletStatusBarService extends StatusBarService { View mMenuButton; View mRecentButton; + InputMethodButton mInputMethodButton; + NotificationPanel mNotificationPanel; SystemPanel mSystemPanel; NotificationPanel mNotificationPeekWindow; @@ -305,6 +307,9 @@ public class TabletStatusBarService extends StatusBarService { mNavigationArea = sb.findViewById(R.id.navigationArea); mMenuButton = mNavigationArea.findViewById(R.id.menu); + // The bar contents buttons + mInputMethodButton = (InputMethodButton) mBarContents.findViewById(R.id.imeButton); + // set the initial view visibility setAreThereNotifications(); refreshNotificationTrigger(); @@ -690,6 +695,14 @@ public class TabletStatusBarService extends StatusBarService { visible ? R.anim.navigation_in : R.anim.navigation_out); } + public void setIMEButtonVisible(boolean visible) { + + if (DEBUG) { + Slog.d(TAG, (visible?"showing":"hiding") + " the IME button"); + } + mInputMethodButton.setIMEButtonVisible(visible); + } + private void setAreThereNotifications() { final boolean hasClearable = mNotns.hasClearableItems(); |
