diff options
author | satok <satok@google.com> | 2011-01-17 22:02:00 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-17 22:02:00 -0800 |
commit | 8c05b54f237879c48796eadbe6c8c4b17ce5f743 (patch) | |
tree | 190ac3d7822e6d02728f96bec7a02959f61f4160 /packages | |
parent | ca0f49ed6e79423b5fa946935dbefa7269dce02a (diff) | |
parent | 913f42d26a32621ad7dd52c52b8d150eedf4f8fe (diff) | |
download | frameworks_base-8c05b54f237879c48796eadbe6c8c4b17ce5f743.zip frameworks_base-8c05b54f237879c48796eadbe6c8c4b17ce5f743.tar.gz frameworks_base-8c05b54f237879c48796eadbe6c8c4b17ce5f743.tar.bz2 |
Merge "Update package manager when panel is loaded." into honeycomb
Diffstat (limited to 'packages')
4 files changed, 32 insertions, 7 deletions
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_ime_pressed.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_ime_pressed.png Binary files differindex 993ea55..3359602 100644 --- a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_ime_pressed.png +++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_ime_pressed.png 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 69bc161..7012ddc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java @@ -188,6 +188,12 @@ public class InputMethodButton extends ImageView { Settings.Secure.INPUT_METHOD_SELECTOR_VISIBILITY, ID_IME_BUTTON_VISIBILITY_AUTO); } + public void setIconImage(int resId) { + if (mIcon != null) { + mIcon.setImageResource(resId); + } + } + public void setIMEButtonVisible(IBinder token, boolean keyboardVisible) { mToken = token; mKeyboardVisible = keyboardVisible; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java index add67b1..cc200e3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.tablet; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; -import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.os.IBinder; import android.provider.Settings; @@ -53,11 +52,12 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O new HashMap<InputMethodInfo, List<InputMethodSubtype>>(); private final HashMap<View, Pair<InputMethodInfo, InputMethodSubtype>> mRadioViewAndImiMap = new HashMap<View, Pair<InputMethodInfo, InputMethodSubtype>>(); - private final PackageManager mPackageManager; private Context mContext; private IBinder mToken; + private InputMethodButton mInputMethodSwitchButton; private LinearLayout mInputMethodMenuList; + private PackageManager mPackageManager; private String mEnabledInputMethodAndSubtypesCacheStr; private View mConfigureImeShortcut; @@ -69,7 +69,6 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O super(context, attrs, defStyle); mContext = context; mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); - mPackageManager = context.getPackageManager(); } @Override @@ -90,8 +89,17 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O @Override protected void onVisibilityChanged(View changedView, int visibility) { super.onVisibilityChanged(changedView, visibility); - if (visibility == View.VISIBLE && changedView == this) { - updateUiElements(); + if (changedView == this) { + if (visibility == View.VISIBLE) { + updateUiElements(); + if (mInputMethodSwitchButton != null) { + mInputMethodSwitchButton.setIconImage(R.drawable.ic_sysbar_ime_pressed); + } + } else { + if (mInputMethodSwitchButton != null) { + mInputMethodSwitchButton.setIconImage(R.drawable.ic_sysbar_ime); + } + } } } @@ -180,6 +188,8 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O // TODO: Reuse subtype views. mInputMethodMenuList.removeAllViews(); mRadioViewAndImiMap.clear(); + mPackageManager = mContext.getPackageManager(); + HashMap<InputMethodInfo, List<InputMethodSubtype>> enabledIMIs = getEnabledInputMethodAndSubtypeList(); // TODO: Sort by alphabet and mode. @@ -198,10 +208,14 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O updateRadioButtons(); } - public void setIMEToken(IBinder token) { + public void setImeToken(IBinder token) { mToken = token; } + public void setImeSwitchButton(InputMethodButton imb) { + mInputMethodSwitchButton = imb; + } + private void setInputMethodAndSubtype(InputMethodInfo imi, InputMethodSubtype subtype) { if (mToken != null) { mImm.setInputMethodAndSubtype(mToken, imi.getId(), subtype); @@ -308,6 +322,10 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O private CharSequence getSubtypeName(InputMethodInfo imi, InputMethodSubtype subtype) { if (imi == null || subtype == null) return null; + if (DEBUG) { + Log.d(TAG, "Get text from: " + imi.getPackageName() + subtype.getNameResId() + + imi.getServiceInfo().applicationInfo); + } // TODO: Change the language of subtype name according to subtype's locale. return mPackageManager.getText( imi.getPackageName(), subtype.getNameResId(), imi.getServiceInfo().applicationInfo); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 825877a..6db74d1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -272,6 +272,7 @@ public class TabletStatusBar extends StatusBar implements mInputMethodsPanel.setVisibility(View.GONE); mInputMethodsPanel.setOnTouchListener(new TouchOutsideListener( MSG_CLOSE_INPUT_METHODS_PANEL, mInputMethodsPanel)); + mInputMethodsPanel.setImeSwitchButton(mInputMethodSwitchButton); mStatusBarView.setIgnoreChildren(3, mInputMethodSwitchButton, mInputMethodsPanel); lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, @@ -853,7 +854,7 @@ public class TabletStatusBar extends StatusBar implements if (oldVisibility != mInputMethodSwitchButton.getVisibility()) { updateNotificationIcons(); } - mInputMethodsPanel.setIMEToken(token); + mInputMethodsPanel.setImeToken(token); mBackButton.setImageResource( visible ? R.drawable.ic_sysbar_back_ime : R.drawable.ic_sysbar_back); if (FAKE_SPACE_BAR) { |