Beispiel #1
0
        public void OnGlobalLayout()
        {
            _toolbar.ViewTreeObserver.RemoveOnGlobalLayoutListener(this);

            Display display = WindowManager.DefaultDisplay;
            Rect    bounds  = new Rect(0, 0, display.Width, display.Height / 4);

            TapTargetView.ShowFor(this,
                                  TapTarget.ForToolbarMenuItem(_toolbar, Resource.Id.menu_search, "Title", "Description")
                                  .OuterCircleColor(Resource.Color.blue)      // Specify a color for the outer circle
                                  .OuterCircleAlpha(.94f)
                                  .TargetCircleColor(Resource.Color.inner_blue)
                                  .TitleTextSize(20)                                                         // Specify the size (in sp) of the title text
                                  .DescriptionTextSize(10)                                                   // Specify the size (in sp) of the description text
                                  .TextColor(Resource.Color.white)                                           // Specify a color for both the title and description text
                                  .DrawShadow(true)                                                          // Whether to draw a drop shadow or not
                                  .Icon(ContextCompat.GetDrawable(this, Resource.Drawable.ic_action_search)) // Whether tapping outside the outer circle dismisses the view
                                  .TransparentTarget(false)                                                  // Specify whether the target is transparent (displays the content underneath)
                                  .TargetRadius(60));
        }
Beispiel #2
0
        private void ShowSchedulesFeatureDiscoveryTargetsSequence(Int32 numberOfSchedules)
        {
            FeatureDiscoveryState state = _application.Preferences.FeatureDiscoveryState;

            List <TapTarget> targets = new List <TapTarget>();

            if (!state.HasFlag(FeatureDiscoveryState.SchedulesDownload))
            {
                TapTarget downloadTarget;

                // Если пользователь выбрал для переключения даты в расписании плавающую кнопку, то элемент
                // меню для загрузки расписаний находится на тулбаре, а иначе – скрыт в выпадающем меню.
                if (_application.Preferences.UseFabDateSelector)
                {
                    downloadTarget = TapTarget.ForToolbarMenuItem(
                        _toolbar,
                        Resource.Id.downloadSchedulesMenuItem,
                        Resources.GetString(Resource.String.schedulesDownloadFeatureDiscoveryTitle),
                        Resources.GetString(Resource.String.schedulesDownloadFeatureDiscoveryMessage)
                        );
                }
                else
                {
                    downloadTarget = TapTarget.ForToolbarOverflow(
                        _toolbar,
                        Resources.GetString(Resource.String.schedulesDownloadFeatureDiscoveryTitle),
                        Resources.GetString(Resource.String.schedulesDownloadFeatureDiscoveryMessage)
                        );
                }

                downloadTarget.Stylize().Id((Int32)FeatureDiscoveryState.SchedulesDownload);
                targets.Add(downloadTarget);
            }

            if (numberOfSchedules != 0)
            {
                if (!state.HasFlag(FeatureDiscoveryState.SchedulesManagement))
                {
                    targets.Add(
                        TapTarget.ForView(
                            _toolbarTitle,
                            Resources.GetString(Resource.String.schedulesManagementFeatureDiscoveryTitle),
                            Resources.GetString(Resource.String.schedulesManagementFeatureDiscoveryMessage)
                            )
                        .Stylize()
                        .Id((Int32)FeatureDiscoveryState.SchedulesManagement)
                        );
                }

                if (!state.HasFlag(FeatureDiscoveryState.ScheduleChangeDate))
                {
                    TapTarget dateTarget;
                    if (_application.Preferences.UseFabDateSelector)
                    {
                        dateTarget = TapTarget.ForView(
                            _fab,
                            Resources.GetString(Resource.String.scheduleChangeDateFeatureDiscoveryTitle),
                            Resources.GetString(Resource.String.scheduleChangeDateFeatureDiscoveryMessage)
                            )
                                     .TintTarget(false);
                    }
                    else
                    {
                        dateTarget = TapTarget.ForToolbarMenuItem(
                            _toolbar,
                            Resource.Id.selectViewingDateMenuItem,
                            Resources.GetString(Resource.String.scheduleChangeDateFeatureDiscoveryTitle),
                            Resources.GetString(Resource.String.scheduleChangeDateFeatureDiscoveryMessage)
                            );
                    }

                    dateTarget.Stylize().Id((Int32)FeatureDiscoveryState.ScheduleChangeDate);
                    targets.Add(dateTarget);
                }

                // if (!state.HasFlag(FeatureDiscoveryState.UpdateSchedulesOnStart))
                // {
                //     TapTarget updateTarget = TapTarget.ForToolbarOverflow(
                //         _toolbar,
                //         Resources.GetString(Resource.String.updateSchedulesOnStartFeatureDiscoveryTitle),
                //         Resources.GetString(Resource.String.updateSchedulesOnStartFeatureDiscoveryMessage)
                //     );
                //
                //     updateTarget.Stylize().Id((Int32)FeatureDiscoveryState.UpdateSchedulesOnStart);
                //     targets.Add(updateTarget);
                // }
            }

            if (targets.Count == 0)
            {
                return;
            }

            TapTargetSequenceListener listener = new TapTargetSequenceListener();

            listener.Clicked += (Int32 id) => _application.Preferences.SetFeatureDiscoveryState(
                state        |= (FeatureDiscoveryState)id
                );

            new TapTargetSequence(this).Targets(targets).Listener(listener).ContinueOnCancel(true).Start();
        }