Class DynamicPermission
java.lang.Object
com.pranavpandey.android.dynamic.support.model.DynamicPermission
- All Implemented Interfaces:
Parcelable
A model class to hold the permission details that will be used by the app.
It will be used internally by the DynamicPermissions.
-
Nested Class Summary
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Parcelable.Creator<DynamicPermission>Parcelable creator to create from parcel.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor to initialize the dynamic permission.Read an object of this class from the parcel.DynamicPermission(String permission) Constructor to initialize an object of this class.DynamicPermission(String permission, Drawable icon, String title) Constructor to initialize an object of this class.DynamicPermission(String permission, Drawable icon, String title, String subtitle) Constructor to initialize an object of this class.DynamicPermission(String permission, Drawable icon, String title, String subtitle, String description) Constructor to initialize an object of this class. -
Method Summary
Modifier and TypeMethodDescriptionintGet the description used by this permission.getIcon()Get the icon used by this permission.Get the permission string.Get the subtitle used by this permission.getTitle()Get the title used by this permission.booleanReturns whether this permission is granted.booleanReturns whether to request this permission again.booleanReturns whether this permission is dangerous.booleanChecks whether this permission must be granted after reinstalling the app.booleanReturns whether this permission is unknown or not.voidsetAllowed(boolean allowed) Sets this permission as granted or denied.voidsetAskAgain(boolean askAgain) Sets this permission to request again or not.voidsetDangerous(boolean dangerous) Sets this permission as dangerous or normal.voidsetDescription(String description) Sets the description for this permission.voidSets the icon for this permission.voidsetPermission(String permission) Sets the permission string.voidsetSubtitle(String subtitle) Sets the subtitle for this permission.voidSets the title for this permission.voidsetUnknown(boolean unknown) Sets whether this permission is unknown or not.voidwriteToParcel(Parcel dest, int flags)
-
Field Details
-
CREATOR
Parcelable creator to create from parcel.
-
-
Constructor Details
-
DynamicPermission
public DynamicPermission()Default constructor to initialize the dynamic permission. -
DynamicPermission
Constructor to initialize an object of this class.- Parameters:
permission- The permission string.
-
DynamicPermission
public DynamicPermission(@NonNull String permission, @Nullable Drawable icon, @Nullable String title) Constructor to initialize an object of this class.- Parameters:
permission- The permission string.icon- The icon used for this permission.title- The title for this permission.
-
DynamicPermission
public DynamicPermission(@NonNull String permission, @Nullable Drawable icon, @Nullable String title, @Nullable String subtitle) Constructor to initialize an object of this class.- Parameters:
permission- The permission string.icon- The icon used for this permission.title- The title for this permission.subtitle- The subtitle for this permission.
-
DynamicPermission
public DynamicPermission(@NonNull String permission, @Nullable Drawable icon, @Nullable String title, @Nullable String subtitle, @Nullable String description) Constructor to initialize an object of this class.- Parameters:
permission- The permission string.icon- The icon used for this permission.title- The title for this permission.subtitle- The subtitle for this permission.description- The description for this permission.
-
DynamicPermission
Read an object of this class from the parcel.- Parameters:
in- The parcel to read the values.
-
-
Method Details
-
describeContents
public int describeContents()- Specified by:
describeContentsin interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcelin interfaceParcelable
-
getPermission
Get the permission string.- Returns:
- The permission string.
-
setPermission
Sets the permission string.- Parameters:
permission- The permission to be set.
-
getIcon
Get the icon used by this permission.- Returns:
- The icon used by this permission.
-
setIcon
Sets the icon for this permission.- Parameters:
icon- The icon to be set.
-
getTitle
Get the title used by this permission.- Returns:
- The title used by this permission.
-
setTitle
Sets the title for this permission.- Parameters:
title- The title to be set.
-
getSubtitle
Get the subtitle used by this permission.- Returns:
- The subtitle used by this permission.
-
setSubtitle
Sets the subtitle for this permission.- Parameters:
subtitle- The subtitle to be set.
-
getDescription
Get the description used by this permission.- Returns:
- The description used by this permission.
-
setDescription
Sets the description for this permission.- Parameters:
description- The description to be set.
-
isDangerous
public boolean isDangerous()Returns whether this permission is dangerous.- Returns:
trueif the permission is dangerous.
-
setDangerous
public void setDangerous(boolean dangerous) Sets this permission as dangerous or normal.- Parameters:
dangerous-trueif the permission is dangerous.
-
isAllowed
public boolean isAllowed()Returns whether this permission is granted.- Returns:
trueif the permission is granted.
-
setAllowed
public void setAllowed(boolean allowed) Sets this permission as granted or denied.- Parameters:
allowed-trueif the permission is granted.
-
isAskAgain
public boolean isAskAgain()Returns whether to request this permission again.- Returns:
trueif request this permission again.
-
setAskAgain
public void setAskAgain(boolean askAgain) Sets this permission to request again or not.- Parameters:
askAgain-trueif request this permission again.
-
isUnknown
public boolean isUnknown()Returns whether this permission is unknown or not.- Returns:
truethis permission is present in the system.
-
setUnknown
public void setUnknown(boolean unknown) Sets whether this permission is unknown or not.- Parameters:
unknown-trueif this permission is present in the system.
-
isReinstall
public boolean isReinstall()Checks whether this permission must be granted after reinstalling the app.- Returns:
trueif this permission must be granted after reinstalling the app.
-