Make input language selection settings work

This change also tweaks the padding of candidate strip for phone.

Change-Id: Iefe4dfeb7015e11d5b2d1566121f719d60b1377e
main
Tadashi G. Takaoka 2011-01-14 14:02:46 +09:00
parent eead8c8311
commit 41f7fb51b0
3 changed files with 26 additions and 8 deletions

View File

@ -51,7 +51,7 @@
<dimen name="candidate_strip_fading_edge_length">63dip</dimen> <dimen name="candidate_strip_fading_edge_length">63dip</dimen>
<dimen name="candidate_strip_padding">0dip</dimen> <dimen name="candidate_strip_padding">0dip</dimen>
<dimen name="candidate_min_width">0.3in</dimen> <dimen name="candidate_min_width">0.3in</dimen>
<dimen name="candidate_padding">0dip</dimen> <dimen name="candidate_padding">6dip</dimen>
<dimen name="candidate_text_size">18dip</dimen> <dimen name="candidate_text_size">18dip</dimen>
<dimen name="spacebar_vertical_correction">4dip</dimen> <dimen name="spacebar_vertical_correction">4dip</dimen>
<!-- If the screen height in landscape is larger than the below value, then the keyboard <!-- If the screen height in landscape is larger than the below value, then the keyboard

View File

@ -70,15 +70,10 @@
android:defaultValue="@string/voice_mode_main" android:defaultValue="@string/voice_mode_main"
/> />
<!-- TODO: Filter subtypes by IME in SubtypeEnabler -->
<!-- TODO: Maybe use this only for phone? -->
<PreferenceScreen <PreferenceScreen
android:key="subtype_settings" android:key="subtype_settings"
android:title="@string/language_selection_title" android:title="@string/language_selection_title"
android:summary="@string/language_selection_summary"> android:summary="@string/language_selection_summary" />
<intent
android:action="android.settings.INPUT_METHOD_AND_SUBTYPE_ENABLER"/>
</PreferenceScreen>
<PreferenceCategory <PreferenceCategory
android:title="@string/prediction_category" android:title="@string/prediction_category"

View File

@ -23,13 +23,17 @@ import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.backup.BackupManager; import android.app.backup.BackupManager;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.os.Vibrator; import android.os.Vibrator;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.preference.PreferenceGroup; import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.speech.SpeechRecognizer; import android.speech.SpeechRecognizer;
import android.text.AutoText; import android.text.AutoText;
import android.text.TextUtils; import android.text.TextUtils;
@ -41,7 +45,7 @@ import java.util.Locale;
public class Settings extends PreferenceActivity public class Settings extends PreferenceActivity
implements SharedPreferences.OnSharedPreferenceChangeListener, implements SharedPreferences.OnSharedPreferenceChangeListener,
DialogInterface.OnDismissListener { DialogInterface.OnDismissListener, OnPreferenceClickListener {
private static final String TAG = "Settings"; private static final String TAG = "Settings";
public static final String PREF_VIBRATE_ON = "vibrate_on"; public static final String PREF_VIBRATE_ON = "vibrate_on";
@ -64,6 +68,7 @@ public class Settings extends PreferenceActivity
// Dialog ids // Dialog ids
private static final int VOICE_INPUT_CONFIRM_DIALOG = 0; private static final int VOICE_INPUT_CONFIRM_DIALOG = 0;
private PreferenceScreen mInputLanguageSelection;
private CheckBoxPreference mQuickFixes; private CheckBoxPreference mQuickFixes;
private ListPreference mVoicePreference; private ListPreference mVoicePreference;
private ListPreference mSettingsKeyPreference; private ListPreference mSettingsKeyPreference;
@ -84,10 +89,13 @@ public class Settings extends PreferenceActivity
final String currentSetting = mAutoCorrectionThreshold.getValue(); final String currentSetting = mAutoCorrectionThreshold.getValue();
mBigramSuggestion.setEnabled(!currentSetting.equals(autoCorrectionOff)); mBigramSuggestion.setEnabled(!currentSetting.equals(autoCorrectionOff));
} }
@Override @Override
protected void onCreate(Bundle icicle) { protected void onCreate(Bundle icicle) {
super.onCreate(icicle); super.onCreate(icicle);
addPreferencesFromResource(R.xml.prefs); addPreferencesFromResource(R.xml.prefs);
mInputLanguageSelection = (PreferenceScreen) findPreference(PREF_SUBTYPES);
mInputLanguageSelection.setOnPreferenceClickListener(this);
mQuickFixes = (CheckBoxPreference) findPreference(PREF_QUICK_FIXES); mQuickFixes = (CheckBoxPreference) findPreference(PREF_QUICK_FIXES);
mVoicePreference = (ListPreference) findPreference(PREF_VOICE_SETTINGS_KEY); mVoicePreference = (ListPreference) findPreference(PREF_VOICE_SETTINGS_KEY);
mSettingsKeyPreference = (ListPreference) findPreference(PREF_SETTINGS_KEY); mSettingsKeyPreference = (ListPreference) findPreference(PREF_SETTINGS_KEY);
@ -169,6 +177,21 @@ public class Settings extends PreferenceActivity
updateSettingsKeySummary(); updateSettingsKeySummary();
} }
@Override
public boolean onPreferenceClick(Preference pref) {
if (pref == mInputLanguageSelection) {
final String action;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
action = "android.settings.INPUT_METHOD_AND_SUBTYPE_ENABLER";
} else {
action = "com.android.inputmethod.latin.INPUT_LANGUAGE_SELECTION";
}
startActivity(new Intent(action));
return true;
}
return false;
}
private void updateSettingsKeySummary() { private void updateSettingsKeySummary() {
mSettingsKeyPreference.setSummary( mSettingsKeyPreference.setSummary(
getResources().getStringArray(R.array.settings_key_modes) getResources().getStringArray(R.array.settings_key_modes)