From 06e0744e9e1a04a07e2e1bf9279124223bd674da Mon Sep 17 00:00:00 2001 From: satok Date: Tue, 2 Nov 2010 19:46:55 +0900 Subject: Update the subtype icon properly. Change-Id: Ib89959d1ea13f1e6f56e6280f90532e6695c4a00 --- .../statusbar/tablet/InputMethodButton.java | 9 ++++----- .../android/server/InputMethodManagerService.java | 7 +++++++ .../android/server/StatusBarManagerService.java | 23 +++++++++++----------- 3 files changed, 23 insertions(+), 16 deletions(-) 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 c416ff4..a025d63 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java @@ -16,10 +16,7 @@ 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.os.Handler; @@ -36,13 +33,12 @@ 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 { private static final String TAG = "StatusBar/InputMethodButton"; + private static final boolean DEBUG = false; private boolean mKeyboardShown; private ImageView mIcon; @@ -94,6 +90,9 @@ public class InputMethodButton extends ImageView { InputMethodSubtype subtype = mImm.getCurrentInputMethodSubtype(); Drawable icon = null; if (imi != null) { + if (DEBUG) { + Log.d(TAG, "--- Update icons of IME: " + imi.getPackageName() + "," + subtype); + } if (subtype != null) { return pm.getDrawable(imi.getPackageName(), subtype.getIconResId(), imi.getServiceInfo().applicationInfo); diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 20e8bbe..155c397 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -993,6 +993,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (mCurMethod != null) { try { putSelectedInputMethodSubtype(info, subtypeId); + mCurrentSubtype = subtype; + if (mInputShown) { + // If mInputShown is false, there is no IME button on the + // system bar. + // Thus there is no need to make it invisible explicitly. + mStatusBar.setIMEButtonVisible(true); + } mCurMethod.changeInputMethodSubtype(subtype); } catch (RemoteException e) { return; diff --git a/services/java/com/android/server/StatusBarManagerService.java b/services/java/com/android/server/StatusBarManagerService.java index 0eeef38..596db57 100644 --- a/services/java/com/android/server/StatusBarManagerService.java +++ b/services/java/com/android/server/StatusBarManagerService.java @@ -263,19 +263,20 @@ public class StatusBarManagerService extends IStatusBarService.Stub if (SPEW) Slog.d(TAG, (visible?"showing":"hiding") + " IME Button"); synchronized(mLock) { - if (mIMEButtonVisible != visible) { - mIMEButtonVisible = visible; - mHandler.post(new Runnable() { - public void run() { - if (mBar != null) { - try { - mBar.setIMEButtonVisible(visible); - } catch (RemoteException ex) { - } + // In case of IME change, we need to call up setIMEButtonVisible() regardless of + // mIMEButtonVisible because mIMEButtonVisible may not have been set to false when the + // previous IME was destroyed. + mIMEButtonVisible = visible; + mHandler.post(new Runnable() { + public void run() { + if (mBar != null) { + try { + mBar.setIMEButtonVisible(visible); + } catch (RemoteException ex) { } } - }); - } + } + }); } } -- cgit v1.1