Class DynamicMenu
java.lang.Object
com.pranavpandey.android.dynamic.support.model.DynamicMenu
- All Implemented Interfaces:
Parcelable
A model class to store
Menu
menu information with an icon and a text.-
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<DynamicMenu>
Parcelable creator to create from parcel.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Constructor Summary
ConstructorDescriptionDynamicMenu
(Drawable icon, CharSequence title) Constructor to initialize an object of this class.DynamicMenu
(Drawable icon, CharSequence title, CharSequence subtitle) Constructor to initialize an object of this class.DynamicMenu
(Drawable icon, CharSequence title, CharSequence subtitle, boolean hasSubmenu) Constructor to initialize an object of this class.DynamicMenu
(Parcel in) Read an object of this class from the parcel. -
Method Summary
Modifier and TypeMethodDescriptionint
getIcon()
Get the icon used by this menu.Get the subtitle used by this menu.getTitle()
Get the title used by this menu.boolean
Returns whether this menu has a submenu.setHasSubmenu
(boolean hasSubmenu) Sets if this menu has a submenu.Set the icon used by this menu.setSubtitle
(CharSequence subtitle) Set the subtitle used by this menu.setTitle
(CharSequence title) Set the title used by this menu.void
writeToParcel
(Parcel dest, int flags)
-
Field Details
-
CREATOR
Parcelable creator to create from parcel.
-
-
Constructor Details
-
DynamicMenu
Constructor to initialize an object of this class.- Parameters:
icon
- The icon for this menu.title
- The title for this menu.
-
DynamicMenu
public DynamicMenu(@Nullable Drawable icon, @Nullable CharSequence title, @Nullable CharSequence subtitle) Constructor to initialize an object of this class.- Parameters:
icon
- The icon for this menu.title
- The title for this menu.subtitle
- The subtitle for this menu.
-
DynamicMenu
public DynamicMenu(@Nullable Drawable icon, @Nullable CharSequence title, @Nullable CharSequence subtitle, boolean hasSubmenu) Constructor to initialize an object of this class.- Parameters:
icon
- The icon for this menu.title
- The title for this menu.subtitle
- The subtitle for this menu.hasSubmenu
-true
to enable submenu.
-
DynamicMenu
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
-
getIcon
Get the icon used by this menu.- Returns:
- The icon used by this menu.
-
setIcon
Set the icon used by this menu.- Parameters:
icon
- The icon to be set.- Returns:
- The
DynamicMenu
object to allow for chaining of calls to set methods.
-
getTitle
Get the title used by this menu.- Returns:
- The title used by this menu.
-
setTitle
Set the title used by this menu.- Parameters:
title
- The title to be set.- Returns:
- The
DynamicMenu
object to allow for chaining of calls to set methods.
-
getSubtitle
Get the subtitle used by this menu.- Returns:
- The subtitle used by this menu.
-
setSubtitle
Set the subtitle used by this menu.- Parameters:
subtitle
- The subtitle to be set.- Returns:
- The
DynamicMenu
object to allow for chaining of calls to set methods.
-