diff options
author | Tadashi G. Takaoka <takaoka@google.com> | 2011-01-31 08:47:12 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-31 08:47:12 -0800 |
commit | 81f4b582d4f3547bcd432da6bcb21d4ef414723d (patch) | |
tree | 8739ca89e275f6a791c9ce86ea7591cd08a76b7d /packages/SystemUI | |
parent | 22e883dd4a400122003506f47b228378000dd12f (diff) | |
parent | 1c9debfb18acae293dff5ce02bb200d2a6b04ba9 (diff) | |
download | frameworks_base-81f4b582d4f3547bcd432da6bcb21d4ef414723d.zip frameworks_base-81f4b582d4f3547bcd432da6bcb21d4ef414723d.tar.gz frameworks_base-81f4b582d4f3547bcd432da6bcb21d4ef414723d.tar.bz2 |
Merge "Fix hardware keyboard switch listener" into honeycomb
Diffstat (limited to 'packages/SystemUI')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java | 38 |
1 files changed, 23 insertions, 15 deletions
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 502e0fe..0c2909a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.tablet; +import com.android.systemui.R; + import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -23,18 +25,16 @@ import android.content.IntentFilter; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.os.IBinder; -import android.os.RemoteException; import android.provider.Settings; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.util.Pair; -import android.util.Slog; import android.view.View; -import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodSubtype; +import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RadioButton; @@ -48,10 +48,8 @@ import java.util.Map; import java.util.Set; import java.util.TreeMap; -import com.android.internal.statusbar.IStatusBarService; -import com.android.systemui.R; - -public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, OnClickListener { +public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, View.OnClickListener, + CompoundButton.OnCheckedChangeListener { private static final boolean DEBUG = TabletStatusBar.DEBUG; private static final String TAG = "InputMethodsPanel"; @@ -144,8 +142,8 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O mInputMethodMenuList = (LinearLayout) findViewById(R.id.input_method_menu_list); mHardKeyboardSection = (LinearLayout) findViewById(R.id.hard_keyboard_section); mHardKeyboardSwitch = (Switch) findViewById(R.id.hard_keyboard_switch); - mHardKeyboardSwitch.setOnClickListener(this); - mConfigureImeShortcut = ((View) findViewById(R.id.ime_settings_shortcut)); + mHardKeyboardSwitch.setOnCheckedChangeListener(this); + mConfigureImeShortcut = findViewById(R.id.ime_settings_shortcut); mConfigureImeShortcut.setOnClickListener(this); // TODO: If configurations for IME are not changed, do not update // by checking onConfigurationChanged. @@ -179,9 +177,17 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O if (view == mConfigureImeShortcut) { showConfigureInputMethods(); onFinishPanel(true); - } else if (view == mHardKeyboardSwitch) { - mHardKeyboardEnabled = mHardKeyboardSwitch.isChecked(); - mHardKeyboardEnabledChangeListener.onHardKeyboardEnabledChange(mHardKeyboardEnabled); + } + } + + @Override + public void onCheckedChanged(CompoundButton button, boolean checked) { + if (button == mHardKeyboardSwitch) { + if (mHardKeyboardEnabled != checked) { + mHardKeyboardEnabled = checked; + if (mHardKeyboardEnabledChangeListener != null) + mHardKeyboardEnabledChangeListener.onHardKeyboardEnabledChange(checked); + } } } @@ -247,9 +253,9 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O subtypeView, new Pair<InputMethodInfo, InputMethodSubtype> (imi, subtype)); subtypeView.setOnClickListener(new View.OnClickListener() { @Override - public void onClick(View view) { + public void onClick(View v) { Pair<InputMethodInfo, InputMethodSubtype> imiAndSubtype = - updateRadioButtonsByView(view); + updateRadioButtonsByView(v); onFinishPanel(false); setInputMethodAndSubtype(imiAndSubtype.first, imiAndSubtype.second); } @@ -310,7 +316,9 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O private void updateHardKeyboardSection() { if (mHardKeyboardAvailable) { mHardKeyboardSection.setVisibility(View.VISIBLE); - mHardKeyboardSwitch.setChecked(mHardKeyboardEnabled); + if (mHardKeyboardSwitch.isChecked() != mHardKeyboardEnabled) { + mHardKeyboardSwitch.setChecked(mHardKeyboardEnabled); + } } else { mHardKeyboardSection.setVisibility(View.GONE); } |