Preference
(SESL variant) The basic building block that represents an individual setting displayed to a user in the preference hierarchy. This class provides the data that will be displayed to the user and has a reference to the SharedPreferences or PreferenceDataStore instance that persists the preference's values.
When specifying a preference hierarchy in XML, each element can point to a subclass of Preference, similar to the view hierarchy and layouts.
This class contains a key
that that represents the key that is used to persist the value to the device. It is up to the subclass to decide how to store the value.
Inheritors
Constructors
Link copied to clipboard
constructor(@NonNull context: Context, @Nullable attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int)
Perform inflation from XML and apply a class-specific base style.
Perform inflation from XML and apply a class-specific base style.
Constructor that is called when inflating a preference from XML.
Constructor to create a preference.
Types
Link copied to clipboard
A base class for managing the instance state of a Preference.
Link copied to clipboard
interface OnPreferenceChangeListener
Interface definition for a callback to be invoked when the value of this Preference has been changed by the user and is about to be set and/or persisted.
Link copied to clipboard
interface OnPreferenceClickListener
Interface definition for a callback to be invoked when a Preference is clicked.
Link copied to clipboard
Interface definition for a callback to be invoked when the summary of this Preference is requested (typically when this preference is added to the hierarchy or its value is updated).
Properties
Link copied to clipboard
Specify for setOrder if a specific order is not required.
Functions
Link copied to clipboard
Call this method after the user changes the preference, but before the internal state is set.
Link copied to clipboard
Compares preference objects based on order (if set), otherwise alphabetically on the titles.
Link copied to clipboard
Returns the Context of this preference.
Link copied to clipboard
Returns the key of the dependency on this preference.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Return the fragment class name associated with this preference.
Link copied to clipboard
Gets the key for this preference, which is also the key used for storing values into SharedPreferences or PreferenceDataStore.
Link copied to clipboard
Gets the layout resource that will be shown as the View for this preference.
Link copied to clipboard
Returns the callback to be invoked when this preference is changed by the user (but before the internal state has been updated).
Link copied to clipboard
Returns the callback to be invoked when this preference is clicked.
Link copied to clipboard
Returns the PreferenceGroup which is this preference assigned to or
null
if this preference is not assigned to any group or is a root preference.Link copied to clipboard
Attempts to get a persisted set of Strings if this preference is persistent.
Link copied to clipboard
Returns PreferenceDataStore used by this preference.
Link copied to clipboard
Gets the PreferenceManager that manages this preference object's tree.
Link copied to clipboard
Returns the SharedPreferences where this preference can read its value(s).
Link copied to clipboard
Checks whether this preference should disable its view when it's action is disabled.
Link copied to clipboard
Returns the summary of this preference.
Link copied to clipboard
Returns the SummaryProvider used to configure the summary of this preference.
Link copied to clipboard
Returns the title of this preference.
Link copied to clipboard
Gets the layout resource for the controllable widget portion of this preference.
Link copied to clipboard
Returns whether the summary of this preference can be copied to the clipboard by long pressing on the preference.
Link copied to clipboard
Returns whether the space of this preference icon view is reserved.
Link copied to clipboard
Checks whether this preference is persistent.
Link copied to clipboard
Checks whether this preference should be selectable in the list.
Link copied to clipboard
Gets whether the title of this preference is constrained to a single line.
Link copied to clipboard
Notifies any listening dependents of a change that affects the dependency.
Link copied to clipboard
Called when the preference hierarchy has been attached to the list of preferences.
Link copied to clipboard
Binds the created View to the data for this preference.
Link copied to clipboard
Called when the dependency changes.
Link copied to clipboard
Called when the preference hierarchy has been detached from the list of preferences.
Link copied to clipboard
Initializes an android.view.accessibility.AccessibilityNodeInfo with information about the View for this preference.
Link copied to clipboard
Called when the implicit parent dependency changes.
Link copied to clipboard
Return the extras Bundle object associated with this preference, returning
null
if there is not currently one.Link copied to clipboard
Called when a click should be performed.
Link copied to clipboard
Attempts to persist a set of Strings if this preference is persistent.
Link copied to clipboard
Restore this preference hierarchy's previously saved state from the given container.
Link copied to clipboard
Store this preference hierarchy's frozen state into the given container.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Sets whether the summary of this preference can be copied to the clipboard by long pressing on the preference.
Link copied to clipboard
Sets the default value for this preference, which will be set either if persistence is off or persistence is on and the preference is not found in the persistent storage.
Link copied to clipboard
Sets the key of a preference that this preference will depend on.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Sets whether this preference is enabled.
Link copied to clipboard
Sets the class name of a fragment to be shown when this preference is clicked.
Link copied to clipboard
Sets whether to reserve the space of this preference icon view when no icon is provided.
Link copied to clipboard
Sets the key for this preference, which is used as a key to the SharedPreferences or PreferenceDataStore.
Link copied to clipboard
Sets the layout resource that is inflated as the View to be shown for this preference.
Link copied to clipboard
open fun setOnPreferenceChangeListener(@Nullable onPreferenceChangeListener: Preference.OnPreferenceChangeListener)
Sets the callback to be invoked when this preference is changed by the user (but before the internal state has been updated).
Link copied to clipboard
open fun setOnPreferenceClickListener(@Nullable onPreferenceClickListener: Preference.OnPreferenceClickListener)
Sets the callback to be invoked when this preference is clicked.
Link copied to clipboard
Sets whether this preference is persistent.
Link copied to clipboard
Sets a PreferenceDataStore to be used by this preference instead of using SharedPreferences.
Link copied to clipboard
Sets whether this preference is selectable.
Link copied to clipboard
Sets whether this preference should disable its view when it gets disabled.
Link copied to clipboard
Sets whether to constrain the title of this preference to a single line instead of letting it wrap onto multiple lines.
Link copied to clipboard
Sets the summary for this preference with a resource ID.
Sets the summary for this preference with a CharSequence.
Link copied to clipboard
Set a SummaryProvider that will be invoked whenever the summary of this preference is requested.
Link copied to clipboard
Sets whether this preference should be visible to the user.
Link copied to clipboard
Sets the layout for the controllable widget portion of this preference.
Link copied to clipboard
Checks whether this preference's dependents should currently be disabled.