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
FieldsModifier 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_VALUEFields 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
ConstructorsConstructorDescriptionDynamicTutorial(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.intintgetColor()Returns the color used by this tutorial.Get the description used by this tutorial.intGet the image resource used by this tutorial.Get the subtitle used by this tutorial.intReturns 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.intReturns the id for this tutorial.booleanReturns whether this tutorial supports the background animation.booleanReturns whether this tutorial supports shared element(s) transition.booleanReturns whether to tint the image according to the tint color.voidonColorChanged(int color, int tintColor) This method will be called when there is a change in the colors of the activity.voidonPageScrolled(int position, float positionOffset, int positionOffsetPixels) voidonPageScrollStateChanged(int state) voidonPageSelected(int position) voidonSetPadding(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.voidsetTutorialFragment(DynamicTutorialFragment fragment) Set the fragment for this tutorial.setTutorialId(int id) Set the id to uniquely identify this tutorial.voidwriteToParcel(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-trueto 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-trueto tint the image according to the tint color.sharedElement-trueto 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-trueto tint the image according to the tint color.backgroundAnimation-trueto enable background animation.sharedElement-trueto 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:
describeContentsin interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcelin interfaceParcelable
-
onPageScrolled
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) - Specified by:
onPageScrolledin interfaceViewPager.OnPageChangeListener
-
onPageSelected
public void onPageSelected(int position) - Specified by:
onPageSelectedin interfaceViewPager.OnPageChangeListener
-
onPageScrollStateChanged
public void onPageScrollStateChanged(int state) - Specified by:
onPageScrollStateChangedin interfaceViewPager.OnPageChangeListener
-
getTutorialId
public int getTutorialId()Description copied from interface:TutorialReturns the id for this tutorial.- Specified by:
getTutorialIdin interfaceTutorial<DynamicTutorial,DynamicTutorialFragment> - Returns:
- The id of this tutorial.
-
getTutorial
Description copied from interface:TutorialReturns the tutorial object.- Specified by:
getTutorialin interfaceTutorial<DynamicTutorial,DynamicTutorialFragment> - Returns:
- The tutorial object.
-
createTutorial
Description copied from interface:TutorialReturns the tutorial view or fragment.- Specified by:
createTutorialin interfaceTutorial<DynamicTutorial,DynamicTutorialFragment> - Returns:
- The tutorial view or fragment.
-
getColor
Description copied from interface:TutorialReturns the color used by this tutorial.- Specified by:
getColorin interfaceTutorial<DynamicTutorial,DynamicTutorialFragment> - Returns:
- The color used by this tutorial.
-
getTintColor
Description copied from interface:TutorialReturns the tint color used by this tutorial.- Specified by:
getTintColorin interfaceTutorial<DynamicTutorial,DynamicTutorialFragment> - Returns:
- The tint color used by this tutorial.
-
onColorChanged
Description copied from interface:TutorialThis 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:
onColorChangedin 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:TutorialThis method will be called on setting the padding of the tutorial.Implement this method to update any views according to the container.
- Specified by:
onSetPaddingin 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.MotionReturns whether this tutorial supports the background animation.- Specified by:
isBackgroundAnimationin interfaceTutorial.Motion<DynamicTutorial,DynamicTutorialFragment> - Returns:
trueif this tutorial supports the background animation.
-
setTutorialId
Set the id to uniquely identify this tutorial.- Parameters:
id- The id to be set.- Returns:
- The
DynamicTutorialobject 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
DynamicTutorialobject 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
DynamicTutorialobject 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
DynamicTutorialobject 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
DynamicTutorialobject 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
DynamicTutorialobject 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
DynamicTutorialobject 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:
trueto tint the image according to the tint color.
-
setTintImage
Set the image to be tinted or not.- Parameters:
tintImage-trueto tint the image.- Returns:
- The
DynamicTutorialobject to allow for chaining of calls to set methods.
-
setBackgroundAnimation
Set whether to animate the background color.- Parameters:
backgroundAnimation-trueto animate the background color.- Returns:
- The
DynamicTutorialobject to allow for chaining of calls to set methods.
-
getTutorialFragment
Returns the fragment associated with this tutorial.- Returns:
- The fragment associated with this tutorial.
-