@Override public void onResume() { super.onResume(); // Manually initialize the preference views that require massaging. Prefs that require // massaging include: // 1. a prefs UI control that does not map 1:1 to storage // 2. a pref that must obtain its initial value from migrated storage, and for which we // don't want to always persist a migrated value final int autoAdvanceModeIndex = prefValueToWidgetIndex( AUTO_ADVANCE_VALUES, mMailPrefs.getAutoAdvanceMode(), AutoAdvance.DEFAULT); mAutoAdvance.setValueIndex(autoAdvanceModeIndex); final String removalAction = mMailPrefs.getRemovalAction(supportsArchive()); updateListSwipeTitle(removalAction); listenForPreferenceChange( PreferenceKeys.REMOVAL_ACTION, PreferenceKeys.CONVERSATION_LIST_SWIPE, PreferenceKeys.SHOW_SENDER_IMAGES, PreferenceKeys.DEFAULT_REPLY_ALL, PreferenceKeys.CONVERSATION_OVERVIEW_MODE, AUTO_ADVANCE_WIDGET, PreferenceKeys.CONFIRM_DELETE, PreferenceKeys.CONFIRM_ARCHIVE, PreferenceKeys.CONFIRM_SEND); }
@Override public void onStop() { super.onStop(); if (mClearSearchHistoryDialog != null && mClearSearchHistoryDialog.isShowing()) { mClearSearchHistoryDialog.dismiss(); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); mMailPrefs = MailPrefs.get(getActivity()); // Set the shared prefs name to use prefs auto-persist behavior by default. // Any pref more complex than the default (say, involving migration), should set // "persistent=false" in the XML and manually handle preference initialization and change. getPreferenceManager().setSharedPreferencesName(mMailPrefs.getSharedPreferencesName()); addPreferencesFromResource(R.xml.general_preferences); mAutoAdvance = (ListPreference) findPreference(AUTO_ADVANCE_WIDGET); }