/** {@inheritDoc} */ @Override @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void onBuildHeaders(List<PreferenceActivity.Header> target) { if (!SettingsActivity.isSimplePreferences(this)) { this.loadHeadersFromResource(R.xml.pref_headers, target); } }
/** * Shows the simplified settings UI if the device configuration dictates that a simplified, * single-pane UI should be shown. */ @SuppressWarnings("deprecation") private void setupSimplePreferencesScreen() { if (!SettingsActivity.isSimplePreferences(this)) { return; } // In the simplified UI, fragments are not used at all and we instead // use the older PreferenceActivity APIs. // Add 'general' preferences. this.addPreferencesFromResource(R.xml.pref_general); // Add 'notifications' preferences, and a corresponding header. PreferenceCategory preferencesFakeHeader = new PreferenceCategory(this); preferencesFakeHeader.setTitle(R.string.pref_header_notifications); this.getPreferenceScreen().addPreference(preferencesFakeHeader); this.addPreferencesFromResource(R.xml.pref_notification); // Add 'Other' preferences, and a corresponding header. PreferenceCategory otherFakeHeader = new PreferenceCategory(this); otherFakeHeader.setTitle(R.string.pref_header_other); this.getPreferenceScreen().addPreference(otherFakeHeader); this.addPreferencesFromResource(R.xml.pref_other); // Bind the summaries of EditText/List/Dialog/Ringtone preferences to their values. // When their values change, their summaries are updated to reflect the new value, per the // Android Design guidelines. SettingsActivity.bindPreferenceSummaryToValue( this.findPreference(this.getString(R.string.pref_key_notifications_alarms_ringtone))); }
/** {@inheritDoc} */ @Override public boolean onIsMultiPane() { return SettingsActivity.isXLargeTablet(this) && !SettingsActivity.isSimplePreferences(this); }