Class DynamicItem
java.lang.Object
com.pranavpandey.android.dynamic.support.model.DynamicItem
- All Implemented Interfaces:
Parcelable
A model class to hold the dynamic item information which can be used by the
DynamicItemView
.-
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 TypeFieldDescriptionprotected int
Minimum contrast value to generate contrast color for the background aware functionality.static final Parcelable.Creator<DynamicItem>
Parcelable creator to create from parcel.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Constructor Summary
ConstructorDescriptionConstructor to initialize an object of this class.DynamicItem
(Drawable icon, CharSequence title, CharSequence subtitle, int color, int colorType, boolean showDivider) Constructor to initialize an object of this class.DynamicItem
(Parcel in) Read an object of this class from the parcel. -
Method Summary
Modifier and TypeMethodDescriptionint
int
Returns the background aware functionality used by this item.int
getColor()
Get the icon tint color used by this item.int
Get the icon tint color type used by this item.int
Get the contrast value used by this item.int
getContrast
(boolean resolve) Get the contrast value used by this item.float
Returns the contrast ratio for by this item.int
Get the contrast with color used by this item.int
Get the contrast with color type used by this item.getIcon()
Get the icon used by this item.Get the on click listener used by this item.Get the subtitle used by this item.getTitle()
Get the title used by this item.boolean
Checks whether the background aware functionality is enabled.boolean
Returns whether to show the horizontal divider for this item.setBackgroundAware
(int backgroundAware) Set the value to make this item background aware or not.setColor
(int color) Set the icon tint color used by this item.setColorType
(int colorType) Set the icon tint color type used by this item.setContrast
(int contrast) Set the contrast value used for this item.setContrastWithColor
(int contrastWithColor) Set the contrast with color used by this item.setContrastWithColorType
(int contrastWithColorType) Set the contrast with color type used by this item.Set the icon used by this item.setOnClickListener
(View.OnClickListener onClickListener) Set the on click listener used by this item.setShowDivider
(boolean showDivider) Set the horizontal divider fro this item.setSubtitle
(CharSequence subtitle) Set the subtitle used by this item.setTitle
(CharSequence title) Set the title used by this item.void
writeToParcel
(Parcel dest, int flags)
-
Field Details
-
contrast
protected int contrastMinimum contrast value to generate contrast color for the background aware functionality. -
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
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
-
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
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
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
Get the icon tint color used by this item.- Returns:
- The icon tint color used by this item.
-
setColor
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
Get the contrast with color used by this item.- Returns:
- The contrast with color used by this item.
-
setContrastWithColor
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
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
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
Get the icon used by this item.- Returns:
- The icon used by this item.
-
setIcon
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
Get the title used by this item.- Returns:
- The title used by this item.
-
setTitle
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
Get the subtitle used by this item.- Returns:
- The subtitle used by this item.
-
setSubtitle
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
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
Get the on click listener used by this item.- Returns:
- The on click listener used by this item.
-
setOnClickListener
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.
-