public abstract class PreferenceFragmentCompat
extends android.support.v7.preference.PreferenceFragmentCompat
| Modifier and Type | Field and Description |
|---|---|
protected static java.util.HashMap<java.lang.Class<? extends Preference>,java.lang.Class<? extends Fragment>> |
dialogPreferences |
| Constructor and Description |
|---|
PreferenceFragmentCompat() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
displayPreferenceDialog(Fragment fragment,
java.lang.String key) |
protected void |
displayPreferenceDialog(Fragment fragment,
java.lang.String key,
android.os.Bundle bundle) |
void |
onActivityResult(int requestCode,
int resultCode,
android.content.Intent data) |
protected void |
onActivityResult(PreferenceGroup group,
int requestCode,
int resultCode,
android.content.Intent data)
Traverses a
PreferenceGroup to notify all eligible preferences about the results
of a returning activity. |
void |
onCreate(android.os.Bundle savedInstanceState) |
protected RecyclerView.Adapter |
onCreateAdapter(PreferenceScreen preferenceScreen) |
void |
onCreatePreferences(android.os.Bundle savedInstanceState,
java.lang.String rootKey)
Deprecated.
Use
onCreatePreferencesFix(Bundle, String) instead. |
abstract void |
onCreatePreferencesFix(android.os.Bundle savedInstanceState,
java.lang.String rootKey)
Called during onCreate(Bundle) to supply the preferences for this fragment.
|
void |
onDisplayPreferenceDialog(Preference preference) |
boolean |
onPreferenceTreeClick(Preference preference) |
static void |
registerPreferenceFragment(java.lang.Class<? extends Preference> prefClass,
java.lang.Class<? extends Fragment> fragmentClass)
Sets a
Preference to use the supplied Fragment as a dialog. |
protected static java.util.HashMap<java.lang.Class<? extends Preference>,java.lang.Class<? extends Fragment>> dialogPreferences
public void onCreate(android.os.Bundle savedInstanceState)
protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen)
@Deprecated
public void onCreatePreferences(android.os.Bundle savedInstanceState,
java.lang.String rootKey)
onCreatePreferencesFix(Bundle, String) instead.savedInstanceState - If the fragment is being re-created from a previous saved state,
this is the state.rootKey - If non-null, this preference fragment should be rooted at the
PreferenceScreen with this key.public abstract void onCreatePreferencesFix(android.os.Bundle savedInstanceState,
java.lang.String rootKey)
savedInstanceState - If the fragment is being re-created from a previous saved state,
this is the state.rootKey - If non-null, this preference fragment should be rooted at the
PreferenceScreen with this key.public void onDisplayPreferenceDialog(Preference preference)
protected void displayPreferenceDialog(Fragment fragment,
java.lang.String key)
protected void displayPreferenceDialog(Fragment fragment,
java.lang.String key,
android.os.Bundle bundle)
public boolean onPreferenceTreeClick(Preference preference)
public void onActivityResult(int requestCode,
int resultCode,
android.content.Intent data)
protected void onActivityResult(PreferenceGroup group,
int requestCode,
int resultCode,
android.content.Intent data)
PreferenceGroup to notify all eligible preferences about the results
of a returning activity.group - The PreferenceGroup to traverse.requestCode - The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from.resultCode - The integer result code returned by the child activity through its setResult().data - An Intent, which can return result data to the caller (various data can be attached to Intent "extras").public static void registerPreferenceFragment(java.lang.Class<? extends Preference> prefClass,
java.lang.Class<? extends Fragment> fragmentClass)
Preference to use the supplied Fragment as a dialog.
NOTE
If prefClass is not a subclass of DialogPreference, you must call
PreferenceManager#showDialog(Preference) to execute the dialog showing logic when the
user clicks on the preference.
WARNING
If fragmentClass is not a subclass of DialogFragment, the fragment will be
added to the fragment manager with the tag FRAGMENT_DIALOG_TAG and using
FragmentTransaction#commit(). You must ensure that the fragment is removed from the
manager when it's done with its work.
If you want to handle how the fragment is being added to the manager, implement
PreferenceActivityResultListener instead and use the fragment from
PreferenceActivityResultListener.onPreferenceClick(PreferenceFragmentCompat, Preference)
to add it manually.
prefClass - the Preference class to be usedfragmentClass - the Preference class to be instantiated and displayed / added