Simplify the logic for LanguageSettings.

Change-Id: Id065df20fc9a94dd03612eecdcdb310bc033bb4d
This commit is contained in:
Daisuke Miyakawa
2010-09-12 13:51:10 -07:00
parent cc0e4db618
commit c88c6bbcd0

View File

@@ -236,15 +236,6 @@ public class LanguageSettings extends SettingsPreferenceFragment {
if (Utils.isMonkeyRunning()) { if (Utils.isMonkeyRunning()) {
return false; return false;
} }
final String fragmentClass = preference.getFragment();
if (fragmentClass != null) {
final Activity activity = getActivity();
if (activity instanceof com.android.settings.Settings) {
return ((com.android.settings.Settings) activity).showFragment(preference);
} else {
Log.w(TAG, "Fragment is available while the parent is not Settings Activity.");
}
}
if (preference instanceof CheckBoxPreference) { if (preference instanceof CheckBoxPreference) {
final CheckBoxPreference chkPref = (CheckBoxPreference) preference; final CheckBoxPreference chkPref = (CheckBoxPreference) preference;
@@ -301,7 +292,9 @@ public class LanguageSettings extends SettingsPreferenceFragment {
mLastTickedInputMethodId = null; mLastTickedInputMethodId = null;
} }
} else if (preference instanceof PreferenceScreen) { } else if (preference instanceof PreferenceScreen) {
if (KEY_INPUT_METHOD.equals(preference.getKey())) { if (preference.getFragment() != null) {
// Fragment will be handled correctly by the super class.
} else if (KEY_INPUT_METHOD.equals(preference.getKey())) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showInputMethodPicker(); imm.showInputMethodPicker();
} else if (preference.getIntent() == null) { } else if (preference.getIntent() == null) {