diff options
author | satok <satok@google.com> | 2011-01-18 08:48:54 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-01-18 08:48:54 -0800 |
commit | ea9e3c99b17a2e07e27a7a9faeb7c58a6f063d1a (patch) | |
tree | 1c1c84268b064717122258f1b8b59f9a21b715a7 /packages | |
parent | c93e7f4d35886d424562bba2c8c71e2a1783fadf (diff) | |
parent | a2409fe82fe26e23c5c4c4499118e77049449e1c (diff) | |
download | frameworks_base-ea9e3c99b17a2e07e27a7a9faeb7c58a6f063d1a.zip frameworks_base-ea9e3c99b17a2e07e27a7a9faeb7c58a6f063d1a.tar.gz frameworks_base-ea9e3c99b17a2e07e27a7a9faeb7c58a6f063d1a.tar.bz2 |
am a2409fe8: am 8c05b54f: Merge "Update package manager when panel is loaded." into honeycomb
* commit 'a2409fe82fe26e23c5c4c4499118e77049449e1c':
Update package manager when panel is loaded.
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) { |