Tweak IME settings
Change-Id: I13b044abdcb1215306ecfd5070d6e1a16e2d92d7
This commit is contained in:
@@ -61,7 +61,7 @@
|
|||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textSize="13sp"
|
android:textSize="13sp"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:focusable="false"
|
||||||
android:maxLines="4" />
|
android:maxLines="4" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@@ -59,6 +59,24 @@ public class InputMethodPreference extends CheckBoxPreference
|
|||||||
private TextView mSummaryText;
|
private TextView mSummaryText;
|
||||||
private View mInputMethodPref;
|
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,
|
public InputMethodPreference(SettingsPreferenceFragment fragment, Intent settingsIntent,
|
||||||
InputMethodManager imm, InputMethodInfo imi, int imiCount) {
|
InputMethodManager imm, InputMethodInfo imi, int imiCount) {
|
||||||
super(fragment.getActivity(), null, R.style.InputMethodPreferenceStyle);
|
super(fragment.getActivity(), null, R.style.InputMethodPreferenceStyle);
|
||||||
@@ -80,36 +98,23 @@ public class InputMethodPreference extends CheckBoxPreference
|
|||||||
protected void onBindView(View view) {
|
protected void onBindView(View view) {
|
||||||
super.onBindView(view);
|
super.onBindView(view);
|
||||||
mInputMethodPref = view.findViewById(R.id.inputmethod_pref);
|
mInputMethodPref = view.findViewById(R.id.inputmethod_pref);
|
||||||
mInputMethodPref.setOnClickListener(
|
mInputMethodPref.setOnClickListener(mPrefOnclickListener);
|
||||||
new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View arg0) {
|
|
||||||
if (isChecked()) {
|
|
||||||
setChecked(false);
|
|
||||||
} else {
|
|
||||||
if (mIsSystemIme) {
|
|
||||||
setChecked(true);
|
|
||||||
} else {
|
|
||||||
showSecurityWarnDialog(mImi, InputMethodPreference.this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mInputMethodSettingsButton = (ImageView)view.findViewById(R.id.inputmethod_settings);
|
mInputMethodSettingsButton = (ImageView)view.findViewById(R.id.inputmethod_settings);
|
||||||
mTitleText = (TextView)view.findViewById(android.R.id.title);
|
mTitleText = (TextView)view.findViewById(android.R.id.title);
|
||||||
|
mSummaryText = (TextView)view.findViewById(android.R.id.summary);
|
||||||
final boolean hasSubtypes = mImi.getSubtypeCount() > 1;
|
final boolean hasSubtypes = mImi.getSubtypeCount() > 1;
|
||||||
final String imiId = mImi.getId();
|
final String imiId = mImi.getId();
|
||||||
mSummaryText = (TextView)view.findViewById(android.R.id.summary);
|
mInputMethodPref.setOnLongClickListener(new OnLongClickListener() {
|
||||||
mSummaryText.setOnClickListener(new OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View arg0) {
|
public boolean onLongClick(View arg0) {
|
||||||
final Bundle bundle = new Bundle();
|
final Bundle bundle = new Bundle();
|
||||||
bundle.putString(Settings.EXTRA_INPUT_METHOD_ID, imiId);
|
bundle.putString(Settings.EXTRA_INPUT_METHOD_ID, imiId);
|
||||||
startFragment(mFragment, InputMethodAndSubtypeEnabler.class.getName(),
|
startFragment(mFragment, InputMethodAndSubtypeEnabler.class.getName(),
|
||||||
0, bundle);
|
0, bundle);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mSettingsIntent != null) {
|
if (mSettingsIntent != null) {
|
||||||
mInputMethodSettingsButton.setOnClickListener(
|
mInputMethodSettingsButton.setOnClickListener(
|
||||||
new OnClickListener() {
|
new OnClickListener() {
|
||||||
@@ -141,17 +146,17 @@ public class InputMethodPreference extends CheckBoxPreference
|
|||||||
if (mSettingsIntent == null) {
|
if (mSettingsIntent == null) {
|
||||||
mInputMethodSettingsButton.setVisibility(View.GONE);
|
mInputMethodSettingsButton.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
enableSettingsButton();
|
updatePreferenceViews();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setEnabled(boolean enabled) {
|
public void setEnabled(boolean enabled) {
|
||||||
super.setEnabled(enabled);
|
super.setEnabled(enabled);
|
||||||
enableSettingsButton();
|
updatePreferenceViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableSettingsButton() {
|
private void updatePreferenceViews() {
|
||||||
final boolean checked = isChecked();
|
final boolean checked = isChecked();
|
||||||
if (mInputMethodSettingsButton != null) {
|
if (mInputMethodSettingsButton != null) {
|
||||||
mInputMethodSettingsButton.setEnabled(checked);
|
mInputMethodSettingsButton.setEnabled(checked);
|
||||||
@@ -166,7 +171,15 @@ public class InputMethodPreference extends CheckBoxPreference
|
|||||||
}
|
}
|
||||||
if (mSummaryText != null) {
|
if (mSummaryText != null) {
|
||||||
mSummaryText.setEnabled(checked);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user