Source:
private void updateEditorSettings() { if (!AppPrefs.isVisualEditorAvailable()) { PreferenceScreen preferenceScreen = (PreferenceScreen) findPreference(getActivity().getString(R.string.pref_key_account_settings_root)); PreferenceCategory editor = (PreferenceCategory) findPreference(getActivity() .getString( R.string.pref_key_editor)); if (preferenceScreen != null && editor != null) { preferenceScreen.removePreference(editor); } } else { final ListPreference editorTypePreference = (ListPreference) findPreference(getActivity().getString(R.string.pref_key_editor_type)); editorTypePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object value) { if (value != null) { int index = Integer.parseInt(value.toString()); CharSequence[] entries = editorTypePreference.getEntries(); editorTypePreference.setSummary(entries[index]); editorTypePreference.setValue(value.toString()); switch (index) { case IDX_VISUAL_EDITOR: AppPrefs.setAztecEditorEnabled(false); AppPrefs.setVisualEditorEnabled(true); break; case IDX_AZTEC_EDITOR: AppPrefs.setAztecEditorEnabled(true); AppPrefs.setVisualEditorEnabled(false); break; default: AppPrefs.setAztecEditorEnabled(false); AppPrefs.setVisualEditorEnabled(false); break; } return true; } else { return false; } } }); final int editorTypeSetting; if (AppPrefs.isAztecEditorEnabled()) { editorTypeSetting = IDX_AZTEC_EDITOR; } else if (AppPrefs.isVisualEditorEnabled()) { editorTypeSetting = IDX_VISUAL_EDITOR; } else { editorTypeSetting = IDX_LEGACY_EDITOR; } CharSequence[] entries = editorTypePreference.getEntries(); editorTypePreference.setSummary(entries[editorTypeSetting]); editorTypePreference.setValueIndex(editorTypeSetting); } }

Target:
private void updateEditorSettings() { if (!AppPrefs.isVisualEditorAvailable()) { PreferenceScreen preferenceScreen = (PreferenceScreen) findPreference(getActivity().getString(R.string.pref_key_account_settings_root)); PreferenceCategory editor = (PreferenceCategory) findPreference(getActivity() .getString( R.string.pref_key_editor)); if (preferenceScreen != null && editor != null) { preferenceScreen.removePreference(editor); } } else { final DetailListPreference editorTypePreference = (DetailListPreference) findPreference(getActivity().getString(R.string.pref_key_editor_type)); editorTypePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object value) { if (value != null) { int index = Integer.parseInt(value.toString()); CharSequence[] entries = editorTypePreference.getEntries(); editorTypePreference.setSummary(entries[index]); editorTypePreference.setValue(value.toString()); switch (index) { case IDX_VISUAL_EDITOR: AppPrefs.setAztecEditorEnabled(false); AppPrefs.setVisualEditorEnabled(true); break; case IDX_AZTEC_EDITOR: AppPrefs.setAztecEditorEnabled(true); AppPrefs.setVisualEditorEnabled(false); break; default: AppPrefs.setAztecEditorEnabled(false); AppPrefs.setVisualEditorEnabled(false); break; } return true; } else { return false; } } }); final int editorTypeSetting; if (AppPrefs.isAztecEditorEnabled()) { editorTypeSetting = IDX_AZTEC_EDITOR; } else if (AppPrefs.isVisualEditorEnabled()) { editorTypeSetting = IDX_VISUAL_EDITOR; } else { editorTypeSetting = IDX_LEGACY_EDITOR; } CharSequence[] entries = editorTypePreference.getEntries(); editorTypePreference.setSummary(entries[editorTypeSetting]); editorTypePreference.setValueIndex(editorTypeSetting); } }