PreferenceManager.SimplePreferenceComparisonCallback

public class PreferenceManager.SimplePreferenceComparisonCallback extends PreferenceManager.PreferenceComparisonCallback


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

Summary

Public constructors

Public methods

boolean

Called to determine if two objects will display the same data

boolean

Called to determine if two objects represent the same item

Public constructors

SimplePreferenceComparisonCallback

Added in 1.0.0
public SimplePreferenceComparisonCallback()

Public methods

arePreferenceContentsTheSame

Added in 1.3.0-alpha01
public boolean arePreferenceContentsTheSame(
    @NonNull Preference p1,
    @NonNull Preference p2
)

Called to determine if two 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 onBindViewHolder. 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.

arePreferenceItemsTheSame

Added in 1.3.0-alpha01
public boolean arePreferenceItemsTheSame(@NonNull Preference p1, @NonNull Preference p2)

Called to determine if two objects represent the same item

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

See also
setKey