Class DynamicPermission

java.lang.Object
com.pranavpandey.android.dynamic.support.model.DynamicPermission
All Implemented Interfaces:
Parcelable

public class DynamicPermission extends Object implements Parcelable
A model class to hold the permission details that will be used by the app.

It will be used internally by the DynamicPermissions.

  • Field Details

  • Constructor Details

    • DynamicPermission

      public DynamicPermission()
      Default constructor to initialize the dynamic permission.
    • DynamicPermission

      public DynamicPermission(@NonNull String permission)
      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

      public DynamicPermission(@NonNull Parcel in)
      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 interface Parcelable
    • writeToParcel

      public void writeToParcel(Parcel dest, int flags)
      Specified by:
      writeToParcel in interface Parcelable
    • getPermission

      @NonNull public String getPermission()
      Get the permission string.
      Returns:
      The permission string.
    • setPermission

      public void setPermission(@NonNull String permission)
      Sets the permission string.
      Parameters:
      permission - The permission to be set.
    • getIcon

      @Nullable public Drawable getIcon()
      Get the icon used by this permission.
      Returns:
      The icon used by this permission.
    • setIcon

      public void setIcon(@Nullable Drawable icon)
      Sets the icon for this permission.
      Parameters:
      icon - The icon to be set.
    • getTitle

      @Nullable public String getTitle()
      Get the title used by this permission.
      Returns:
      The title used by this permission.
    • setTitle

      public void setTitle(@Nullable String title)
      Sets the title for this permission.
      Parameters:
      title - The title to be set.
    • getSubtitle

      @Nullable public String getSubtitle()
      Get the subtitle used by this permission.
      Returns:
      The subtitle used by this permission.
    • setSubtitle

      public void setSubtitle(@Nullable String subtitle)
      Sets the subtitle for this permission.
      Parameters:
      subtitle - The subtitle to be set.
    • getDescription

      @Nullable public String getDescription()
      Get the description used by this permission.
      Returns:
      The description used by this permission.
    • setDescription

      public void setDescription(@NonNull String description)
      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.