SimplePreferenceComparisonCallback

open class SimplePreferenceComparisonCallback : PreferenceManager.PreferenceComparisonCallback
kotlin.Any
   ↳ androidx.preference.PreferenceManager.PreferenceComparisonCallback
   ↳ androidx.preference.PreferenceManager.SimplePreferenceComparisonCallback

A basic implementation of PreferenceComparisonCallback suitable for use with the default Preference classes. If the PreferenceScreen contains custom Preference subclasses, you must override #arePreferenceContentsTheSame(Preference, Preference).

Summary

Public constructors

Public methods
open Boolean

Called to determine if two Preference objects will display the same data

open Boolean

Called to determine if two Preference objects represent the same item

Public constructors

<init>

SimplePreferenceComparisonCallback()

Public methods

arePreferenceContentsTheSame

open fun arePreferenceContentsTheSame(p1: Preference!, p2: Preference!): Boolean

Called to determine if two Preference objects will display the same data

The result of this method is only valid for the default Preference objects, and custom subclasses which do not override Preference#onBindViewHolder(PreferenceViewHolder). This method also assumes that if a preference object is being replaced by a new instance, the old instance was not modified after being removed from its containing PreferenceGroup.

Parameters
p1 Preference!: Preference object to compare
p2 Preference!: Preference object to compare
Return
Boolean: true if the objects are visually identical

arePreferenceItemsTheSame

open fun arePreferenceItemsTheSame(p1: Preference!, p2: Preference!): Boolean

Called to determine if two Preference objects represent the same item

This method will not be able to track replaced Preference objects if they do not have a unique key.

Parameters
p1 Preference!: Preference object to compare
p2 Preference!: Preference object to compare
Return
Boolean: true if the objects represent the same item