TwoStatePreference

Common base class for preferences that have two selectable states, save a boolean value, and may have dependent preferences that are enabled/disabled based on the current state.

Inheritors

Constructors

Link copied to clipboard
constructor(@NonNull context: Context, @Nullable attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int)
constructor(@NonNull context: Context, @Nullable attrs: AttributeSet, defStyleAttr: Int)
constructor(@NonNull context: Context, @Nullable attrs: AttributeSet)
constructor(@NonNull context: Context)

Functions

Link copied to clipboard
Returns whether dependents are disabled when this preference is on (true) or when this preference is off (false).
Link copied to clipboard
Returns the summary to be shown when unchecked.
Link copied to clipboard
Returns the summary to be shown when checked.
Link copied to clipboard
open fun isChecked(): Boolean
Returns the checked state.
Link copied to clipboard
open fun setChecked(checked: Boolean)
Sets the checked state and saves it.
Link copied to clipboard
open fun setDisableDependentsState(disableDependentsState: Boolean)
Sets whether dependents are disabled when this preference is on (true) or when this preference is off (false).
Link copied to clipboard
open fun setSummaryOff(summaryResId: Int)

open fun setSummaryOff(@Nullable summary: CharSequence)
Sets the summary to be shown when unchecked.
Link copied to clipboard
open fun setSummaryOn(summaryResId: Int)

open fun setSummaryOn(@Nullable summary: CharSequence)
Sets the summary to be shown when checked.
Link copied to clipboard
Checks whether this preference's dependents should currently be disabled.