Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Utility Class for showcase view.
- */
- public class ShowCaseViewHelper {
- private FragmentActivity context;
- //Constructor
- public ShowCaseViewHelper(FragmentActivity context) {
- this.context = context;
- }
- /**
- * Method to show the showCaseView
- *
- * @param headerText String for header
- * @param subHeaderText String for subHeader
- * @param view View to showcase
- * @param uniqueID String unique ID for auto-management of sharedPreferences
- */
- public void getShowCaseView(String headerText, String subHeaderText, View view, String uniqueID) {
- spotlightViewBuilder(headerText, subHeaderText, view, uniqueID)
- .show();
- }
- /**
- * Method to display cascade showcase views i.e two showcase views one after another
- *
- * @param headerText Header text i.e string
- * @param subHeaderText SubHeader text i.e String
- * @param view View to be showcase i.e View
- * @param uniqueID Unique ID for auto-management of sharedPreferences i.e String
- * @param cascadeHeaderText Cascade header text i.e string
- * @param cascadeSubHeaderText Cascade subHeader text i.e String
- * @param cascadeView Cascade View to be showcase i.e View
- * @param cascadeUniqueID Cascade Unique ID for auto-management of sharedPreferences i.e String
- */
- public void getCascadeShowCaseView(final String headerText, final String subHeaderText, View view,
- String uniqueID, final String cascadeHeaderText,
- final String cascadeSubHeaderText, final View cascadeView,
- final String cascadeUniqueID) {
- spotlightViewBuilder(headerText, subHeaderText, view, uniqueID)
- .setListener(new SpotlightListener() {
- @Override
- public void onUserClicked(String s) {
- getShowCaseView(cascadeHeaderText, cascadeSubHeaderText, cascadeView, cascadeUniqueID);
- }
- }).show();
- }
- private SpotlightView.Builder spotlightViewBuilder(final String headerText, final String subHeaderText, View view,
- String uniqueID) {
- return new SpotlightView.Builder(context)
- .introAnimationDuration(200) //Intro animation duration (For Reveal and Fadein) i.e long
- .enableRevealAnimation(false) //Enable reveal animation (Only for Lollipop and above) i.e boolean
- .performClick(true) //Perform a click on target view i.e boolean
- .fadeinTextDuration(200)//Fade in animation duration for spotlight text (Heading and Sub-heading) i.e long
- .headingTvColor(ContextCompat.getColor(context, R.color.showcaseview_headertext))//Color of heading text i.e int
- .headingTvSize(32)//Size of heading text i.e int
- .headingTvText(headerText) //Text to display in heading i.e CharSequence
- .subHeadingTvColor(ContextCompat.getColor(context, R.color.showcaseview_subheadertext))//Color of sub-heading text i.e int
- .subHeadingTvSize(16)//Size of sub-heading text i.e int
- .subHeadingTvText(subHeaderText)//Text to display in sub-heading i.e CharSequence
- .maskColor(ContextCompat.getColor(context, R.color.showcaseview_maskcolor)) //Overlay Color i.e intl
- .target(view) //View to showcase i.e View
- .lineAnimDuration(200) //Line animation duration i.e long
- .lineAndArcColor(ContextCompat.getColor(context, R.color.showcaseview_linearccolor))//Color of the spotlight line i.e int
- .dismissOnTouch(true)//Dismiss on touch outside i.e boolean
- .dismissOnBackPress(true)//Dismiss on back pressed i.e boolean
- .enableDismissAfterShown(true)//Dismiss on touch outside after spotlight is completely visible i.e boolean
- .usageId(uniqueID); //UNIQUE ID i.e String
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement