Java Code Examples for androidx.preference.PreferenceFragmentCompat#addPreferencesFromResource()

The following examples show how to use androidx.preference.PreferenceFragmentCompat#addPreferencesFromResource() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PreferenceSettingsUtils.java    From talkback with Apache License 2.0 5 votes vote down vote up
/**
 * Inflates the given XML resource and adds the preference hierarchy to the current preference
 * hierarchy. {@link PreferenceFragmentCompat#addPreferencesFromResource}
 */
public static void addPreferencesFromResource(
    PreferenceFragmentCompat preferenceFragment, @XmlRes int preferencesResId) {
  // Set preferences to use device-protected storage.
  if (BuildVersionUtils.isAtLeastN()) {
    preferenceFragment.getPreferenceManager().setStorageDeviceProtected();
  }
  preferenceFragment.addPreferencesFromResource(preferencesResId);
}
 
Example 2
Source File: WizardActivity.java    From AndroidPreferenceActivity with Apache License 2.0 4 votes vote down vote up
@Override
public final void onCreateNavigation(
        @NonNull final PreferenceFragmentCompat preferenceFragment) {
    preferenceFragment.addPreferencesFromResource(R.xml.wizard_navigation);
}
 
Example 3
Source File: DynamicSettingsActivity.java    From AndroidPreferenceActivity with Apache License 2.0 4 votes vote down vote up
@Override
protected final void onCreateNavigation(@NonNull final PreferenceFragmentCompat fragment) {
    fragment.addPreferencesFromResource(R.xml.dynamic_navigation);
    addNavigationPreference();
}
 
Example 4
Source File: SettingsActivity.java    From AndroidPreferenceActivity with Apache License 2.0 4 votes vote down vote up
@Override
public final void onCreateNavigation(@NonNull final PreferenceFragmentCompat fragment) {
    fragment.addPreferencesFromResource(R.xml.navigation);
    initializeAppearanceNavigationPreference(fragment);
    initializeBehaviorNavigationPreference(fragment);
}