public class RestrictedPreferenceHelper extends Object
Constructor and Description |
---|
RestrictedPreferenceHelper(Context context,
Preference preference,
AttributeSet attrs) |
Modifier and Type | Method and Description |
---|---|
void |
checkRestrictionAndSetDisabled(String userRestriction,
int userId)
Set the user restriction that is used to disable this preference.
|
boolean |
isDisabledByAdmin() |
void |
onAttachedToHierarchy()
Disable / enable if we have been passed the restriction in the xml.
|
void |
onBindViewHolder(PreferenceViewHolder holder)
Modify PreferenceViewHolder to add padlock if restriction is disabled.
|
boolean |
performClick()
Check if the preference is disabled if so handle the click by informing the user.
|
boolean |
setDisabledByAdmin(RestrictedLockUtils.EnforcedAdmin admin)
Disable this preference based on the enforce admin.
|
void |
useAdminDisabledSummary(boolean useSummary) |
public RestrictedPreferenceHelper(Context context, Preference preference, AttributeSet attrs)
public void onBindViewHolder(PreferenceViewHolder holder)
public void useAdminDisabledSummary(boolean useSummary)
public boolean performClick()
public void onAttachedToHierarchy()
public void checkRestrictionAndSetDisabled(String userRestriction, int userId)
userRestriction
- constant from UserManager
userId
- user to check the restriction for.public boolean setDisabledByAdmin(RestrictedLockUtils.EnforcedAdmin admin)
EnforcedAdmin
- Details of the admin who enforced the restriction. If it
is null
, then this preference will be enabled. Otherwise, it will be disabled.public boolean isDisabledByAdmin()