summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/inputmethod/InputMethodPreference.java
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-09-27 15:46:42 +0900
committersatok <satok@google.com>2011-09-27 16:08:46 +0900
commit054fc44cae0d412ca5e72c709f0d5e3deb7768a7 (patch)
tree12fae9d3fa51f9a5b5115979627d0fc9969205b7 /src/com/android/settings/inputmethod/InputMethodPreference.java
parentbde64e3d93b0144cd8b7c0ff65103ffb63fddba7 (diff)
downloadpackages_apps_Settings-054fc44cae0d412ca5e72c709f0d5e3deb7768a7.zip
packages_apps_Settings-054fc44cae0d412ca5e72c709f0d5e3deb7768a7.tar.gz
packages_apps_Settings-054fc44cae0d412ca5e72c709f0d5e3deb7768a7.tar.bz2
Tweak IME settings
Change-Id: I13b044abdcb1215306ecfd5070d6e1a16e2d92d7
Diffstat (limited to 'src/com/android/settings/inputmethod/InputMethodPreference.java')
-rw-r--r--src/com/android/settings/inputmethod/InputMethodPreference.java59
1 files changed, 36 insertions, 23 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodPreference.java b/src/com/android/settings/inputmethod/InputMethodPreference.java
index 5cc7ad0..4b926e2 100644
--- a/src/com/android/settings/inputmethod/InputMethodPreference.java
+++ b/src/com/android/settings/inputmethod/InputMethodPreference.java
@@ -59,6 +59,24 @@ public class InputMethodPreference extends CheckBoxPreference
private TextView mSummaryText;
private View mInputMethodPref;
+ private final OnClickListener mPrefOnclickListener = new OnClickListener() {
+ @Override
+ public void onClick(View arg0) {
+ if (!isEnabled()) {
+ return;
+ }
+ if (isChecked()) {
+ setChecked(false);
+ } else {
+ if (mIsSystemIme) {
+ setChecked(true);
+ } else {
+ showSecurityWarnDialog(mImi, InputMethodPreference.this);
+ }
+ }
+ }
+ };
+
public InputMethodPreference(SettingsPreferenceFragment fragment, Intent settingsIntent,
InputMethodManager imm, InputMethodInfo imi, int imiCount) {
super(fragment.getActivity(), null, R.style.InputMethodPreferenceStyle);
@@ -80,36 +98,23 @@ public class InputMethodPreference extends CheckBoxPreference
protected void onBindView(View view) {
super.onBindView(view);
mInputMethodPref = view.findViewById(R.id.inputmethod_pref);
- mInputMethodPref.setOnClickListener(
- new OnClickListener() {
- @Override
- public void onClick(View arg0) {
- if (isChecked()) {
- setChecked(false);
- } else {
- if (mIsSystemIme) {
- setChecked(true);
- } else {
- showSecurityWarnDialog(mImi, InputMethodPreference.this);
- }
- }
- }
- });
+ mInputMethodPref.setOnClickListener(mPrefOnclickListener);
mInputMethodSettingsButton = (ImageView)view.findViewById(R.id.inputmethod_settings);
mTitleText = (TextView)view.findViewById(android.R.id.title);
-
+ mSummaryText = (TextView)view.findViewById(android.R.id.summary);
final boolean hasSubtypes = mImi.getSubtypeCount() > 1;
final String imiId = mImi.getId();
- mSummaryText = (TextView)view.findViewById(android.R.id.summary);
- mSummaryText.setOnClickListener(new OnClickListener() {
+ mInputMethodPref.setOnLongClickListener(new OnLongClickListener() {
@Override
- public void onClick(View arg0) {
+ public boolean onLongClick(View arg0) {
final Bundle bundle = new Bundle();
bundle.putString(Settings.EXTRA_INPUT_METHOD_ID, imiId);
startFragment(mFragment, InputMethodAndSubtypeEnabler.class.getName(),
0, bundle);
+ return true;
}
});
+
if (mSettingsIntent != null) {
mInputMethodSettingsButton.setOnClickListener(
new OnClickListener() {
@@ -141,17 +146,17 @@ public class InputMethodPreference extends CheckBoxPreference
if (mSettingsIntent == null) {
mInputMethodSettingsButton.setVisibility(View.GONE);
} else {
- enableSettingsButton();
+ updatePreferenceViews();
}
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
- enableSettingsButton();
+ updatePreferenceViews();
}
- private void enableSettingsButton() {
+ private void updatePreferenceViews() {
final boolean checked = isChecked();
if (mInputMethodSettingsButton != null) {
mInputMethodSettingsButton.setEnabled(checked);
@@ -166,7 +171,15 @@ public class InputMethodPreference extends CheckBoxPreference
}
if (mSummaryText != null) {
mSummaryText.setEnabled(checked);
- mSummaryText.setClickable(checked);
+ }
+ if (mInputMethodPref != null) {
+ mInputMethodPref.setEnabled(true);
+ mInputMethodPref.setLongClickable(checked);
+ final boolean enabled = isEnabled();
+ mInputMethodPref.setOnClickListener(enabled ? mPrefOnclickListener : null);
+ if (!enabled) {
+ mInputMethodPref.setBackgroundColor(0);
+ }
}
}