public ShowcaseViews AddView(ItemViewProperties properties) { ShowcaseViewBuilder builder = new ShowcaseViewBuilder(activity) .SetText(properties.TitleResId, properties.MessageResId) .SetShowcaseIndicatorScale(properties.Scale) .SetConfigOptions(properties.ConfigurationOptions); if (ShowcaseActionBar(properties)) { builder.SetShowcaseItem((int)properties.ItemType, properties.Id, activity); } else if (properties.Id == (int)ItemViewProperties.ItemViewType.NoShowcase) { builder.SetShowcaseNoView(); } else { builder.SetShowcaseView(activity.FindViewById(properties.Id)); } ShowcaseView showcaseView = builder.Build(); showcaseView.OverrideButtonClick((s, e) => { showcaseView.OnClick(showcaseView); //Needed for TYPE_ONE_SHOT int fadeOutTime = showcaseView.ConfigurationOptions.FadeOutDuration; if (fadeOutTime > 0) { var handler = new Handler(); handler.PostDelayed(() => { ShowNextView(showcaseView); }, fadeOutTime); } else { ShowNextView(showcaseView); } }); views.Add(showcaseView); animations.Add(null); return(this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_animation); counter = 0; var textView1 = FindViewById<TextView>(Resource.Id.animation_textView); var textView2 = FindViewById<TextView>(Resource.Id.animation_textView2); var textView3 = FindViewById<TextView>(Resource.Id.animation_textView3); showcaseView = ShowcaseView.InsertShowcaseView(new ViewTarget(FindViewById(Resource.Id.animation_textView)), this); showcaseView.OverrideButtonClick((s,e) => { switch (counter) { case 0: showcaseView.SetShowcase(new ViewTarget(textView2), true); break; case 1: showcaseView.SetShowcase(new ViewTarget(textView3), true); break; case 2: showcaseView.SetShowcase(null); showcaseView.SetText("Look ma!", "You don't always need a target to showcase"); SetAlpha(0.4f, new View[]{textView1, textView2, textView3}); break; case 3: showcaseView.Hide(); SetAlpha(1.0f, new View[]{textView1, textView2, textView3}); break; } counter++; }); if (Build.VERSION.SdkInt >= BuildVersionCodes.Honeycomb) { enableUp(); } }
public ShowcaseViewBuilder OverrideButtonClick(View.IOnClickListener listener) { showcaseView.OverrideButtonClick(listener); return(this); }