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); } }
public Preferences(Context context) { _preferences = PreferenceManager.GetDefaultSharedPreferences(context); _preferences.RegisterOnSharedPreferenceChangeListener(this); ReplayFeatureDiscovery = _preferences.GetBoolean("ReplayFeatureDiscovery", false); if (ReplayFeatureDiscovery) { SetFeatureDiscoveryState(FeatureDiscoveryState.NothingDiscovered); SetReplayFeatureDiscovery(false); } else { Int32 state = _preferences.GetInt("FeatureDiscoveryState", 0); FeatureDiscoveryState = (FeatureDiscoveryState)state; } // Сброс флага UpdateSchedulesOnStart, который более не используется по назначению // и в дальнейшем может быть переиспользован для другого обучающего экрана. if (FeatureDiscoveryState.HasFlag(FeatureDiscoveryState.UpdateSchedulesOnStart)) { FeatureDiscoveryState &= ~FeatureDiscoveryState.UpdateSchedulesOnStart; SetFeatureDiscoveryState(FeatureDiscoveryState); } // Обработка конфигурации предыдущих релизов, где версия представляла собой строку. try { LastSeenUpdateVersion = _preferences.GetLong("LastSeenUpdateVersion", 0); } catch (Java.Lang.ClassCastException) { SetLastSeenUpdateVersion(0); } try { LastMigrationVersion = _preferences.GetLong("LastMigrationVersion", 0); } catch (Java.Lang.ClassCastException) { SetLastMigrationVersion(0); } CurrentScheduleDate = DateTime.Today; CurrentScheduleId = _preferences.GetInt("CurrentScheduleId", 0); UpperWeekDate = new DateTime(_preferences.GetLong("UpperWeekDate", 0)); LessonRemindTimes = ParseLessonRemindTimes(_preferences); UseDarkTheme = _preferences.GetBoolean("UseDarkTheme", false); UseFabDateSelector = _preferences.GetBoolean("UseFabDateSelector", true); // CheckUpdatesOnStart = _preferences.GetBoolean("CheckUpdatesOnStart", true); DisplaySubjectEndTime = _preferences.GetBoolean("DisplaySubjectEndTime", true); UpdateSchedulesOnStart = _preferences.GetBoolean("UpdateSchedulesOnStart", true); }
public void SetFeatureDiscoveryState(FeatureDiscoveryState featureDiscoveryState) { ISharedPreferencesEditor editor = _preferences.Edit(); editor.PutInt("FeatureDiscoveryState", (Int32)featureDiscoveryState); editor.Apply(); FeatureDiscoveryState = featureDiscoveryState; }
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(); }