Class DynamicTutorial
java.lang.Object
com.pranavpandey.android.dynamic.support.tutorial.DynamicTutorial
- All Implemented Interfaces:
Parcelable
,ViewPager.OnPageChangeListener
,Tutorial<DynamicTutorial,
,DynamicTutorialFragment> Tutorial.Motion<DynamicTutorial,
DynamicTutorialFragment>
public class DynamicTutorial
extends Object
implements Parcelable, Tutorial.Motion<DynamicTutorial,DynamicTutorialFragment>
A
Tutorial
item to display a title, subtitle and description along with an image
which can be tinted according to the tutorial colors.-
Nested Class Summary
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
Nested classes/interfaces inherited from interface com.pranavpandey.android.dynamic.support.tutorial.Tutorial
Tutorial.Motion<T,
V> -
Field Summary
Modifier and TypeFieldDescriptionstatic final Parcelable.Creator<DynamicTutorial>
Parcelable creator to create from parcel.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Fields inherited from interface com.pranavpandey.android.dynamic.support.tutorial.Tutorial
ADS_NAME_TUTORIAL, ADS_NAME_TUTORIAL_IMAGE, ADS_NAME_TUTORIAL_SUBTITLE, ADS_NAME_TUTORIAL_TITLE, ADS_TUTORIAL_WELCOME
-
Constructor Summary
ConstructorDescriptionDynamicTutorial
(int id, int color, int tintColor, String title, String description, int imageRes) Constructor to initialize an object of this class.DynamicTutorial
(int id, int color, int tintColor, String title, String subtitle, String description, int imageRes) Constructor to initialize an object of this class.DynamicTutorial
(int id, int color, int tintColor, String title, String subtitle, String description, int imageRes, boolean tintImage) Constructor to initialize an object of this class.DynamicTutorial
(int id, int color, int tintColor, String title, String subtitle, String description, int imageRes, boolean tintImage, boolean sharedElement) Constructor to initialize an object of this class.DynamicTutorial
(int id, int color, int tintColor, String title, String subtitle, String description, int imageRes, boolean tintImage, boolean backgroundAnimation, boolean sharedElement) Constructor to initialize an object of this class.Read an object of this class from the parcel. -
Method Summary
Modifier and TypeMethodDescriptionReturns the tutorial view or fragment.int
int
getColor()
Returns the color used by this tutorial.Get the description used by this tutorial.int
Get the image resource used by this tutorial.Get the subtitle used by this tutorial.int
Returns the tint color used by this tutorial.getTitle()
Get the title used by this tutorial.Returns the tutorial object.Returns the fragment associated with this tutorial.int
Returns the id for this tutorial.boolean
Returns whether this tutorial supports the background animation.boolean
Returns whether this tutorial supports shared element(s) transition.boolean
Returns whether to tint the image according to the tint color.void
onColorChanged
(int color, int tintColor) This method will be called when there is a change in the colors of the activity.void
onPageScrolled
(int position, float positionOffset, int positionOffsetPixels) void
onPageScrollStateChanged
(int state) void
onPageSelected
(int position) void
onSetPadding
(int left, int top, int right, int bottom) This method will be called on setting the padding of the tutorial.setBackgroundAnimation
(boolean backgroundAnimation) Set whether to animate the background color.setColor
(int color) Set the color used by this tutorial.setColor
(int color, int tintColor) Set the colors used by this tutorial.setDescription
(String description) Set the description used by this tutorial.setImageRes
(int imageRes) Set the image resource used by this tutorial.setSharedElement
(boolean sharedElement) Set whether to set the shared element.setSubtitle
(String subtitle) Set the subtitle used by this tutorial.setTintImage
(boolean tintImage) Set the image to be tinted or not.Set the title used by this tutorial.void
setTutorialFragment
(DynamicTutorialFragment fragment) Set the fragment for this tutorial.setTutorialId
(int id) Set the id to uniquely identify this tutorial.void
writeToParcel
(Parcel dest, int flags)
-
Field Details
-
CREATOR
Parcelable creator to create from parcel.
-
-
Constructor Details
-
DynamicTutorial
public DynamicTutorial(int id, @ColorInt int color, @ColorInt int tintColor, @Nullable String title, @Nullable String description, @DrawableRes int imageRes) Constructor to initialize an object of this class.- Parameters:
id
- The id to uniquely identify this tutorial.color
- The color for this tutorial.tintColor
- The tint color for this tutorial.title
- The title for this tutorial.description
- The description for this tutorial.imageRes
- The image resource for this tutorial.
-
DynamicTutorial
public DynamicTutorial(int id, @ColorInt int color, @ColorInt int tintColor, @Nullable String title, @Nullable String subtitle, @Nullable String description, @DrawableRes int imageRes) Constructor to initialize an object of this class.- Parameters:
id
- The id to uniquely identify this tutorial.color
- The color for this tutorial.tintColor
- The tint color for this tutorial.title
- The title for this tutorial.subtitle
- The subtitle for this tutorial.description
- The description for this tutorial.imageRes
- The image resource for this tutorial.
-
DynamicTutorial
public DynamicTutorial(int id, @ColorInt int color, @ColorInt int tintColor, @Nullable String title, @Nullable String subtitle, @Nullable String description, @DrawableRes int imageRes, boolean tintImage) Constructor to initialize an object of this class.- Parameters:
id
- The id to uniquely identify this tutorial.color
- The color for this tutorial.tintColor
- The tint color for this tutorial.title
- The title for this tutorial.subtitle
- The subtitle for this tutorial.description
- The description for this tutorial.imageRes
- The image resource for this tutorial.tintImage
-true
to tint the image according to the tint color.
-
DynamicTutorial
public DynamicTutorial(int id, @ColorInt int color, @ColorInt int tintColor, @Nullable String title, @Nullable String subtitle, @Nullable String description, @DrawableRes int imageRes, boolean tintImage, boolean sharedElement) Constructor to initialize an object of this class.- Parameters:
id
- The id to uniquely identify this tutorial.color
- The color for this tutorial.tintColor
- The tint color for this tutorial.title
- The title for this tutorial.subtitle
- The subtitle for this tutorial.description
- The description for this tutorial.imageRes
- The image resource for this tutorial.tintImage
-true
to tint the image according to the tint color.sharedElement
-true
to set the shared element.
-
DynamicTutorial
public DynamicTutorial(int id, @ColorInt int color, @ColorInt int tintColor, @Nullable String title, @Nullable String subtitle, @Nullable String description, @DrawableRes int imageRes, boolean tintImage, boolean backgroundAnimation, boolean sharedElement) Constructor to initialize an object of this class.- Parameters:
id
- The id to uniquely identify this tutorial.color
- The color for this tutorial.tintColor
- The tint color for this tutorial.title
- The title for this tutorial.subtitle
- The subtitle for this tutorial.description
- The description for this tutorial.imageRes
- The image resource for this tutorial.tintImage
-true
to tint the image according to the tint color.backgroundAnimation
-true
to enable background animation.sharedElement
-true
to set the shared element.
-
DynamicTutorial
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
-
onPageScrolled
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) - Specified by:
onPageScrolled
in interfaceViewPager.OnPageChangeListener
-
onPageSelected
public void onPageSelected(int position) - Specified by:
onPageSelected
in interfaceViewPager.OnPageChangeListener
-
onPageScrollStateChanged
public void onPageScrollStateChanged(int state) - Specified by:
onPageScrollStateChanged
in interfaceViewPager.OnPageChangeListener
-
getTutorialId
public int getTutorialId()Description copied from interface:Tutorial
Returns the id for this tutorial.- Specified by:
getTutorialId
in interfaceTutorial<DynamicTutorial,
DynamicTutorialFragment> - Returns:
- The id of this tutorial.
-
getTutorial
Description copied from interface:Tutorial
Returns the tutorial object.- Specified by:
getTutorial
in interfaceTutorial<DynamicTutorial,
DynamicTutorialFragment> - Returns:
- The tutorial object.
-
createTutorial
Description copied from interface:Tutorial
Returns the tutorial view or fragment.- Specified by:
createTutorial
in interfaceTutorial<DynamicTutorial,
DynamicTutorialFragment> - Returns:
- The tutorial view or fragment.
-
getColor
Description copied from interface:Tutorial
Returns the color used by this tutorial.- Specified by:
getColor
in interfaceTutorial<DynamicTutorial,
DynamicTutorialFragment> - Returns:
- The color used by this tutorial.
-
getTintColor
Description copied from interface:Tutorial
Returns the tint color used by this tutorial.- Specified by:
getTintColor
in interfaceTutorial<DynamicTutorial,
DynamicTutorialFragment> - Returns:
- The tint color used by this tutorial.
-
onColorChanged
Description copied from interface:Tutorial
This method will be called when there is a change in the colors of the activity.Implement this method to update any views during the transition.
- Specified by:
onColorChanged
in interfaceTutorial<DynamicTutorial,
DynamicTutorialFragment> - Parameters:
color
- The color used by the tutorial.tintColor
- The tint color used by this tutorial.
-
onSetPadding
public void onSetPadding(int left, int top, int right, int bottom) Description copied from interface:Tutorial
This method will be called on setting the padding of the tutorial.Implement this method to update any views according to the container.
- Specified by:
onSetPadding
in interfaceTutorial<DynamicTutorial,
DynamicTutorialFragment> - Parameters:
left
- The left padding supplied by the container.top
- The top padding supplied by the container.right
- The right padding supplied by the container.bottom
- The bottom padding supplied by the container.
-
isBackgroundAnimation
public boolean isBackgroundAnimation()Description copied from interface:Tutorial.Motion
Returns whether this tutorial supports the background animation.- Specified by:
isBackgroundAnimation
in interfaceTutorial.Motion<DynamicTutorial,
DynamicTutorialFragment> - Returns:
true
if this tutorial supports the background animation.
-
setTutorialId
Set the id to uniquely identify this tutorial.- Parameters:
id
- The id to be set.- Returns:
- The
DynamicTutorial
object to allow for chaining of calls to set methods.
-
setColor
Set the colors used by this tutorial.- Parameters:
color
- The tutorial color to be set.tintColor
- The tint color to be set.- Returns:
- The
DynamicTutorial
object to allow for chaining of calls to set methods.
-
setColor
Set the color used by this tutorial.- Parameters:
color
- The color to be set.- Returns:
- The
DynamicTutorial
object to allow for chaining of calls to set methods.
-
getTitle
Get the title used by this tutorial.- Returns:
- The title used by this tutorial.
-
setTitle
Set the title used by this tutorial.- Parameters:
title
- The subtitle to be set.- Returns:
- The
DynamicTutorial
object to allow for chaining of calls to set methods.
-
getSubtitle
Get the subtitle used by this tutorial.- Returns:
- The subtitle used by this tutorial.
-
setSubtitle
Set the subtitle used by this tutorial.- Parameters:
subtitle
- The subtitle to be set.- Returns:
- The
DynamicTutorial
object to allow for chaining of calls to set methods.
-
getDescription
Get the description used by this tutorial.- Returns:
- The description used by this tutorial.
-
setDescription
Set the description used by this tutorial.- Parameters:
description
- The description to be set.- Returns:
- The
DynamicTutorial
object to allow for chaining of calls to set methods.
-
getImageRes
Get the image resource used by this tutorial.- Returns:
- The image resource used by this tutorial.
-
setImageRes
Set the image resource used by this tutorial.- Parameters:
imageRes
- The image resource to be set.- Returns:
- The
DynamicTutorial
object to allow for chaining of calls to set methods.
-
isTintImage
public boolean isTintImage()Returns whether to tint the image according to the tint color.- Returns:
true
to tint the image according to the tint color.
-
setTintImage
Set the image to be tinted or not.- Parameters:
tintImage
-true
to tint the image.- Returns:
- The
DynamicTutorial
object to allow for chaining of calls to set methods.
-
setBackgroundAnimation
Set whether to animate the background color.- Parameters:
backgroundAnimation
-true
to animate the background color.- Returns:
- The
DynamicTutorial
object to allow for chaining of calls to set methods.
-
getTutorialFragment
Returns the fragment associated with this tutorial.- Returns:
- The fragment associated with this tutorial.
-