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
Modifier 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
ConstructorDescriptionDefault 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 TypeMethodDescriptionint
Get 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.boolean
Returns whether this permission is granted.boolean
Returns whether to request this permission again.boolean
Returns whether this permission is dangerous.boolean
Checks whether this permission must be granted after reinstalling the app.boolean
Returns whether this permission is unknown or not.void
setAllowed
(boolean allowed) Sets this permission as granted or denied.void
setAskAgain
(boolean askAgain) Sets this permission to request again or not.void
setDangerous
(boolean dangerous) Sets this permission as dangerous or normal.void
setDescription
(String description) Sets the description for this permission.void
Sets the icon for this permission.void
setPermission
(String permission) Sets the permission string.void
setSubtitle
(String subtitle) Sets the subtitle for this permission.void
Sets the title for this permission.void
setUnknown
(boolean unknown) Sets whether this permission is unknown or not.void
writeToParcel
(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:
describeContents
in interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcel
in 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:
true
if the permission is dangerous.
-
setDangerous
public void setDangerous(boolean dangerous) Sets this permission as dangerous or normal.- Parameters:
dangerous
-true
if the permission is dangerous.
-
isAllowed
public boolean isAllowed()Returns whether this permission is granted.- Returns:
true
if the permission is granted.
-
setAllowed
public void setAllowed(boolean allowed) Sets this permission as granted or denied.- Parameters:
allowed
-true
if the permission is granted.
-
isAskAgain
public boolean isAskAgain()Returns whether to request this permission again.- Returns:
true
if request this permission again.
-
setAskAgain
public void setAskAgain(boolean askAgain) Sets this permission to request again or not.- Parameters:
askAgain
-true
if request this permission again.
-
isUnknown
public boolean isUnknown()Returns whether this permission is unknown or not.- Returns:
true
this permission is present in the system.
-
setUnknown
public void setUnknown(boolean unknown) Sets whether this permission is unknown or not.- Parameters:
unknown
-true
if this permission is present in the system.
-
isReinstall
public boolean isReinstall()Checks whether this permission must be granted after reinstalling the app.- Returns:
true
if this permission must be granted after reinstalling the app.
-