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

public class DynamicItem extends Object implements Parcelable
A model class to hold the dynamic item information which can be used by the DynamicItemView.
  • Field Details

    • contrast

      protected int contrast
      Minimum contrast value to generate contrast color for the background aware functionality.
    • CREATOR

      public static final Parcelable.Creator<DynamicItem> CREATOR
      Parcelable creator to create from parcel.
  • Constructor Details

    • DynamicItem

      public DynamicItem()
      Constructor to initialize an object of this class.
    • DynamicItem

      public DynamicItem(@Nullable Drawable icon, @Nullable CharSequence title, @Nullable CharSequence subtitle, int color, int colorType, boolean showDivider)
      Constructor to initialize an object of this class.
      Parameters:
      icon - The icon for this item.
      title - The title for this item.
      subtitle - The subtitle for this item.
      color - The icon tint color for this item.
      colorType - The icon tint color type for this item.
      showDivider - true to show horizontal divider.
    • DynamicItem

      public DynamicItem(@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
    • getColorType

      public int getColorType()
      Get the icon tint color type used by this item.
      Returns:
      The icon tint color type used by this item.
      See Also:
    • setColorType

      @NonNull public DynamicItem setColorType(int colorType)
      Set the icon tint color type used by this item.
      Parameters:
      colorType - The icon tint color type to be set.
      Returns:
      The DynamicItem object to allow for chaining of calls to set methods.
      See Also:
    • getContrastWithColorType

      public int getContrastWithColorType()
      Get the contrast with color type used by this item.
      Returns:
      The contrast with color type used by this item.
      See Also:
    • setContrastWithColorType

      @NonNull public DynamicItem setContrastWithColorType(int contrastWithColorType)
      Set the contrast with color type used by this item.
      Parameters:
      contrastWithColorType - The contrast with color type to be set.
      Returns:
      The DynamicItem object to allow for chaining of calls to set methods.
      See Also:
    • getColor

      @ColorInt public int getColor()
      Get the icon tint color used by this item.
      Returns:
      The icon tint color used by this item.
    • setColor

      @NonNull public DynamicItem setColor(@ColorInt int color)
      Set the icon tint color used by this item.
      Parameters:
      color - The icon tint color to be set.
      Returns:
      The DynamicItem object to allow for chaining of calls to set methods.
    • getContrastWithColor

      @ColorInt public int getContrastWithColor()
      Get the contrast with color used by this item.
      Returns:
      The contrast with color used by this item.
    • setContrastWithColor

      @NonNull public DynamicItem setContrastWithColor(@ColorInt int contrastWithColor)
      Set the contrast with color used by this item.
      Parameters:
      contrastWithColor - The contrast with color to be set.
      Returns:
      The DynamicItem object to allow for chaining of calls to set methods.
    • getBackgroundAware

      public int getBackgroundAware()
      Returns the background aware functionality used by this item.
      Returns:
      The background aware functionality used by this item.
    • isBackgroundAware

      public boolean isBackgroundAware()
      Checks whether the background aware functionality is enabled.
      Returns:
      true if this item changes color according to the background.
    • setBackgroundAware

      @NonNull public DynamicItem setBackgroundAware(int backgroundAware)
      Set the value to make this item background aware or not.
      Parameters:
      backgroundAware - The background aware functionality to be set.
      Returns:
      The DynamicItem object to allow for chaining of calls to set methods.
    • getContrast

      public int getContrast(boolean resolve)
      Get the contrast value used by this item.
      Parameters:
      resolve - true to resolve auto contrast.
      Returns:
      The contrast value used by this item.
    • getContrast

      public int getContrast()
      Get the contrast value used by this item.
      Returns:
      The contrast value used by this item.
    • getContrastRatio

      public float getContrastRatio()
      Returns the contrast ratio for by this item.
      Returns:
      The contrast ratio for by this item.
    • setContrast

      @NonNull public DynamicItem setContrast(int contrast)
      Set the contrast value used for this item.
      Parameters:
      contrast - The contrast value to be set.
      Returns:
      The DynamicItem object to allow for chaining of calls to set methods.
    • getIcon

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

      @NonNull public DynamicItem setIcon(@Nullable Drawable icon)
      Set the icon used by this item.
      Parameters:
      icon - The icon to be set.
      Returns:
      The DynamicItem object to allow for chaining of calls to set methods.
    • getTitle

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

      @NonNull public DynamicItem setTitle(@Nullable CharSequence title)
      Set the title used by this item.
      Parameters:
      title - The title to be set.
      Returns:
      The DynamicItem object to allow for chaining of calls to set methods.
    • getSubtitle

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

      @NonNull public DynamicItem setSubtitle(@Nullable CharSequence subtitle)
      Set the subtitle used by this item.
      Parameters:
      subtitle - The subtitle to be set.
      Returns:
      The DynamicItem object to allow for chaining of calls to set methods.
    • isShowDivider

      public boolean isShowDivider()
      Returns whether to show the horizontal divider for this item.
      Returns:
      true to show horizontal divider.

      Useful to display in a list view.

    • setShowDivider

      @NonNull public DynamicItem setShowDivider(boolean showDivider)
      Set the horizontal divider fro this item.

      Useful to display in a list view.

      Parameters:
      showDivider - true to show horizontal divider.
      Returns:
      The DynamicItem object to allow for chaining of calls to set methods.
    • getOnClickListener

      @Nullable public View.OnClickListener getOnClickListener()
      Get the on click listener used by this item.
      Returns:
      The on click listener used by this item.
    • setOnClickListener

      @NonNull public DynamicItem setOnClickListener(@Nullable View.OnClickListener onClickListener)
      Set the on click listener used by this item.
      Parameters:
      onClickListener - The on click listener to be set.
      Returns:
      The DynamicItem object to allow for chaining of calls to set methods.