Ejemplo n.º 1
0
        private void ShowDialogWithSuggestionToConfigureApplication()
        {
            CustomAlertDialog dialog = new CustomAlertDialog(this)
                                       .SetPositiveButton(Resource.String.configureActionTitle, StartPreferencesActivity)
                                       .SetMessage(Resource.String.configureApplicationMessage, false)
                                       .SetCancelable(false);

            dialog.Show();

            FeatureDiscoveryState state = _application.Preferences.FeatureDiscoveryState;

            if (!state.HasFlag(FeatureDiscoveryState.ApplicationSettings))
            {
                TapTargetViewListener listener = new TapTargetViewListener();
                listener.Clicked += () => _application.Preferences.SetFeatureDiscoveryState(
                    state | FeatureDiscoveryState.ApplicationSettings
                    );

                Button    positiveButton = dialog.GetButton(DialogButtonType.Positive);
                TapTarget settingsTarget = TapTarget.ForView(
                    positiveButton,
                    Resources.GetString(Resource.String.applicationSettingsFeatureDiscoveryTitle),
                    Resources.GetString(Resource.String.applicationSettingsFeatureDiscoveryMessage)
                    )
                                           .Stylize();

                TapTargetView.ShowFor(dialog, settingsTarget, listener);
            }
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.MyButton);

            button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };


            var target = TapTarget.ForView(button, "Test", "Description");

            TapTargetView.ShowFor(this, target);
        }
Ejemplo n.º 3
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();
        }