Exemplo n.º 1
0
 public void OnShowcaseViewHide(ShowcaseView showcaseView)
 {
     if (IsHoneycombOrAbove())
     {
         listView.Alpha = 1f;
     }
     buttonBlocked.Enabled = false;
 }
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.menu, menu);

            var target = new ActionViewTarget(this, ActionViewTarget.Type.OVERFLOW);
            sv = ShowcaseView.InsertShowcaseView(target, this, Resource.String.showcase_simple_title, Resource.String.showcase_simple_message, mOptions);
            sv.Activated = true;

            return base.OnCreateOptionsMenu(menu);
        }
Exemplo n.º 3
0
 void ShowNextView(ShowcaseView showcaseView)
 {
     if (views.Count == 0)
     {
         showcaseAcknowledgedListener.OnShowCaseAcknowledged(showcaseView);
     }
     else
     {
         Show();
     }
 }
Exemplo n.º 4
0
        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();
            }
        }
Exemplo n.º 6
0
        public static ShowcaseView InsertShowcaseViewWithType(int type, int itemId, Activity activity, int title, int detailText, ConfigOptions options)
        {
            ShowcaseView sv = new ShowcaseView(activity);

            if (options != null)
            {
                sv.ConfigurationOptions = options;
            }
            if (sv.ConfigurationOptions.Insert == INSERTTODECOR)
            {
                ((ViewGroup)activity.Window.DecorView).AddView(sv);
            }
            else
            {
                ((ViewGroup)activity.FindViewById(Android.Resource.Id.Content)).AddView(sv);
            }
            sv.SetShowcaseItem(type, itemId, activity);
            sv.SetText(title, detailText);
            return(sv);
        }
Exemplo n.º 7
0
        // Internal insert method so all inserts are routed through one method
        static ShowcaseView InsertShowcaseViewInternal(ITarget target, Activity activity, String title, String detail, ConfigOptions options)
        {
            var sv = new ShowcaseView(activity);

            sv.ConfigurationOptions = options;

            if (sv.ConfigurationOptions.Insert == INSERTTODECOR)
            {
                ((ViewGroup)activity.Window.DecorView).AddView(sv);
            }
            else
            {
                ((ViewGroup)activity.FindViewById(Android.Resource.Id.Content)).AddView(sv);
            }

            sv.SetShowcase(target);
            sv.SetText(title, detail);

            return(sv);
        }
Exemplo n.º 8
0
        public static ShowcaseView InsertShowcaseView(View viewToShowcase, Activity activity, String title, String detailText, ConfigOptions options)
        {
            var sv = new ShowcaseView(activity);

            if (options != null)
            {
                sv.ConfigurationOptions = options;
            }

            if (sv.ConfigurationOptions.Insert == INSERTTODECOR)
            {
                ((ViewGroup)activity.Window.DecorView).AddView(sv);
            }
            else
            {
                ((ViewGroup)activity.FindViewById(Android.Resource.Id.Content)).AddView(sv);
            }

            sv.SetShowcaseView(viewToShowcase);
            sv.SetText(title, detailText);
            return(sv);
        }
Exemplo n.º 9
0
        public static ShowcaseView InsertShowcaseView(int x, int y, Activity activity, int title, int detailText, ConfigOptions options)
        {
            var showcaseView = new ShowcaseView(activity);

            if (options != null)
            {
                showcaseView.ConfigurationOptions = options;
            }

            if (showcaseView.ConfigurationOptions.Insert == INSERTTODECOR)
            {
                ((ViewGroup)activity.Window.DecorView).AddView(showcaseView);
            }
            else
            {
                ((ViewGroup)activity.FindViewById(Android.Resource.Id.Content)).AddView(showcaseView);
            }

            showcaseView.SetShowcasePosition(x, y);
            showcaseView.SetText(title, detailText);
            return(showcaseView);
        }
Exemplo n.º 10
0
        public void Show()
        {
            if (views.Count == 0)
            {
                return;
            }

            ShowcaseView view = views[0];

            bool hasShot = activity.GetSharedPreferences(ShowcaseView.PREFSSHOWCASEINTERNAL, FileCreationMode.Private).GetBoolean("hasShot" + view.ConfigurationOptions.ShowcaseId, false);

            if (hasShot && view.ConfigurationOptions.IsOneShot)
            {
                // The showcase has already been shot once, so we don't need to do show it again.
                view.Visibility = ViewStates.Gone;
                views.RemoveAt(0);
                animations.RemoveAt(0);

                view.ConfigurationOptions.FadeOutDuration = 0;
                view.PerformButtonClick();
                return;
            }

            view.Visibility = ViewStates.Invisible;
            ((ViewGroup)activity.Window.DecorView).AddView(view);
            view.Show();

            float[] animation = animations[0];
            if (animation != null)
            {
                view.AnimateGesture(animation[1], animation[2], animation[3], animation[4], animation[0] == ABSOLUTE_COORDINATES);
            }

            views.RemoveAt(0);
            animations.RemoveAt(0);
        }
Exemplo n.º 11
0
 public void OnShowcaseViewDidHide(ShowcaseView showcaseView)
 {
 }
Exemplo n.º 12
0
 public ShowcaseViewBuilder(Activity activity, int showcaseLayoutViewId)
 {
     this.showcaseView = (ShowcaseView) activity.LayoutInflater.Inflate(showcaseLayoutViewId, null);
 }
Exemplo n.º 13
0
 public ShowcaseViewBuilder SetConfigOptions(ShowcaseView.ConfigOptions configOptions)
 {
     showcaseView.ConfigurationOptions = configOptions;
     return this;
 }
Exemplo n.º 14
0
 public void OnShowCaseAcknowledged(ShowcaseView showcaseView)
 {
     //DEFAULT LISTENER - DOESN'T DO ANYTHING!
 }
Exemplo n.º 15
0
 public ShowcaseViewBuilder(ShowcaseView showcaseView)
 {
     this.showcaseView = showcaseView;
 }
Exemplo n.º 16
0
 public ItemViewProperties(int titleResId, int messageResId, ShowcaseView.ConfigOptions configOptions)
     : this((int)ItemViewType.NoShowcase, titleResId, messageResId, ItemViewType.NotInActionbar, DefaultScale, configOptions)
 {
 }
Exemplo n.º 17
0
 public ItemViewProperties(int id, int titleResId, int messageResId, ItemViewType itemType, ShowcaseView.ConfigOptions configOptions)
     : this(id, titleResId, messageResId, itemType, DefaultScale, configOptions)
 {
 }
Exemplo n.º 18
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);

            var adapter = new HardcodedListAdapter(this);

            listView = FindViewById<ListView>(Resource.Id.listView);
            listView.Adapter = adapter;
            listView.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs e)
            {
                switch (e.Position)
                {
                    case 0:
                        StartActivity(typeof(MultipleShowcaseSampleActivity));
                        break;

                    case 1:
                        StartActivity(typeof(ShowcaseFragmentActivity));
                        break;

                    case 2:
                        StartActivity(typeof(AnimationSampleActivity));
                        break;

                // Not currently used
                    case 3:
                        StartActivity(typeof(MemoryManagementTesting));
                        break;
                }
            };

            DimView(listView);

            buttonBlocked = FindViewById<Button>(Resource.Id.buttonBlocked);
            buttonBlocked.Click += delegate
            {
                showcaseView.AnimateGesture(0, 0, 0, 400);
            };

            var co = new ShowcaseView.ConfigOptions();
            co.HideOnClickOutside = true;

            // The following code will reposition the OK button to the left.
            //            var layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            //            layoutParams.AddRule(LayoutRules.AlignParentBottom);
            //            layoutParams.AddRule(LayoutRules.AlignParentLeft);
            //            int margin = (int)Resources.DisplayMetrics.Density * 12;
            //            layoutParams.SetMargins(margin, margin, margin, margin);
            //            co.ButtonLayoutParams = layoutParams;

            var target = new ViewTarget(Resource.Id.buttonBlocked, this);
            showcaseView = ShowcaseView.InsertShowcaseView(target, this, Resource.String.showcase_main_title, Resource.String.showcase_main_message, co);
            showcaseView.SetOnShowcaseEventListener(this);
        }
Exemplo n.º 19
0
 public void OnShowCaseAcknowledged(ShowcaseView showcaseView)
 {
     //DEFAULT LISTENER - DOESN'T DO ANYTHING!
 }
 public ShowcaseViewBuilder(Activity activity, int showcaseLayoutViewId)
 {
     this.showcaseView = (ShowcaseView)activity.LayoutInflater.Inflate(showcaseLayoutViewId, null);
 }
 public ShowcaseViewBuilder(ShowcaseView showcaseView)
 {
     this.showcaseView = showcaseView;
 }
 public ShowcaseViewBuilder(Activity activity)
 {
     this.showcaseView = new ShowcaseView(activity);
 }
Exemplo n.º 23
0
 public void OnShowcaseViewShow(ShowcaseView showcaseView)
 {
     DimView(listView);
     buttonBlocked.Enabled = true;
 }
Exemplo n.º 24
0
        public static ShowcaseView InsertShowcaseView(View viewToShowcase, Activity activity, String title, String detailText, ConfigOptions options)
        {
            var sv = new ShowcaseView(activity);
            if (options != null)
            {
                sv.ConfigurationOptions = options;
            }

            if (sv.ConfigurationOptions.Insert == INSERTTODECOR)
            {
                ((ViewGroup)activity.Window.DecorView).AddView(sv);
            }
            else
            {
                ((ViewGroup)activity.FindViewById(Android.Resource.Id.Content)).AddView(sv);
            }

            sv.SetShowcaseView(viewToShowcase);
            sv.SetText(title, detailText);
            return sv;
        }
Exemplo n.º 25
0
 void ShowNextView(ShowcaseView showcaseView)
 {
     if (views.Count == 0)
     {
         showcaseAcknowledgedListener.OnShowCaseAcknowledged(showcaseView);
     }
     else
     {
         Show();
     }
 }
Exemplo n.º 26
0
        public static ShowcaseView InsertShowcaseView(int x, int y, Activity activity, int title, int detailText, ConfigOptions options)
        {
            var showcaseView = new ShowcaseView(activity);

            if (options != null)
            {
                showcaseView.ConfigurationOptions = options;
            }

            if (showcaseView.ConfigurationOptions.Insert == INSERTTODECOR)
            {
                ((ViewGroup)activity.Window.DecorView).AddView(showcaseView);
            }
            else
            {
                ((ViewGroup)activity.FindViewById(Android.Resource.Id.Content)).AddView(showcaseView);
            }

            showcaseView.SetShowcasePosition(x, y);
            showcaseView.SetText(title, detailText);
            return showcaseView;
        }
Exemplo n.º 27
0
 public ItemViewProperties(int id, int titleResId, int messageResId, float scale, ShowcaseView.ConfigOptions configOptions)
     : this(id, titleResId, messageResId, ItemViewType.NotInActionbar, scale, configOptions)
 {
 }
Exemplo n.º 28
0
 public static ShowcaseView InsertShowcaseViewWithType(int type, int itemId, Activity activity, int title, int detailText, ConfigOptions options)
 {
     ShowcaseView sv = new ShowcaseView(activity);
     if (options != null)
     {
         sv.ConfigurationOptions = options;
     }
     if (sv.ConfigurationOptions.Insert == INSERTTODECOR)
     {
         ((ViewGroup)activity.Window.DecorView).AddView(sv);
     }
     else
     {
         ((ViewGroup)activity.FindViewById(Android.Resource.Id.Content)).AddView(sv);
     }
     sv.SetShowcaseItem(type, itemId, activity);
     sv.SetText(title, detailText);
     return sv;
 }
Exemplo n.º 29
0
 public ItemViewProperties(int id, int titleResId, int messageResId, ItemViewType itemType, float scale, ShowcaseView.ConfigOptions configOptions)
 {
     this.Id = id;
     this.TitleResId = titleResId;
     this.MessageResId = messageResId;
     this.ItemType = itemType;
     this.Scale = scale;
     this.ConfigurationOptions = configOptions;
 }
Exemplo n.º 30
0
        // Internal insert method so all inserts are routed through one method
        static ShowcaseView InsertShowcaseViewInternal(ITarget target, Activity activity, String title, String detail, ConfigOptions options)
        {
            var sv = new ShowcaseView(activity);
            sv.ConfigurationOptions = options;

            if (sv.ConfigurationOptions.Insert == INSERTTODECOR)
            {
                ((ViewGroup)activity.Window.DecorView).AddView(sv);
            }
            else
            {
                ((ViewGroup)activity.FindViewById(Android.Resource.Id.Content)).AddView(sv);
            }

            sv.SetShowcase(target);
            sv.SetText(title, detail);

            return sv;
        }
 public void OnShowCaseAcknowledged(ShowcaseView showcaseView)
 {
     Toast.MakeText(parent, Resource.String.dismissed_message, ToastLength.Short).Show();
 }
Exemplo n.º 32
0
 public ShowcaseViewBuilder(Activity activity)
 {
     this.showcaseView = new ShowcaseView(activity);
 }