public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            SetBackButton();
            CreateView();

            PushSettings = AppSettings.User.PushSettings;
            _notificationUpvotesSwitch.On         = PushSettings.HasFlag(PushSettings.Upvote);
            _notificationCommentsUpvotesSwitch.On = PushSettings.HasFlag(PushSettings.UpvoteComment);
            _notificationFollowingSwitch.On       = PushSettings.HasFlag(PushSettings.Follow);
            _notificationCommentsSwitch.On        = PushSettings.HasFlag(PushSettings.Comment);
            _notificationPostingSwitch.On         = PushSettings.HasFlag(PushSettings.User);

            _notificationUpvotesSwitch.ValueChanged         += NotificationChange;
            _notificationCommentsUpvotesSwitch.ValueChanged += NotificationChange;
            _notificationFollowingSwitch.ValueChanged       += NotificationChange;
            _notificationCommentsSwitch.ValueChanged        += NotificationChange;
            _notificationPostingSwitch.ValueChanged         += NotificationChange;
        }
        private void _presenter_SubscriptionsUpdated()
        {
            _notificationUpvotesSwitch.Checked         = PushSettings.HasFlag(PushSettings.Upvote);
            _notificationCommentsUpvotesSwitch.Checked = PushSettings.HasFlag(PushSettings.UpvoteComment);
            _notificationFollowingSwitch.Checked       = PushSettings.HasFlag(PushSettings.Follow);
            _notificationCommentsSwitch.Checked        = PushSettings.HasFlag(PushSettings.Comment);
            _notificationPostingSwitch.Checked         = PushSettings.HasFlag(PushSettings.User);
            _notificationTransferSwitch.Checked        = PushSettings.HasFlag(PushSettings.Transfer);

            _notificationUpvotesSwitch.CheckedChange         += NotificationChange;
            _notificationCommentsUpvotesSwitch.CheckedChange += NotificationChange;
            _notificationFollowingSwitch.CheckedChange       += NotificationChange;
            _notificationCommentsSwitch.CheckedChange        += NotificationChange;
            _notificationPostingSwitch.CheckedChange         += NotificationChange;
            _notificationTransferSwitch.CheckedChange        += NotificationChange;

            EnableNotificationSwitch(true);
        }
示例#3
0
#pragma warning restore 0649

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.lyt_settings);
            Cheeseknife.Bind(this);

            var appInfoService = AppSettings.AppInfo;
            var accounts       = AppSettings.User.GetAllAccounts();

            _viewTitle.Text                   = AppSettings.LocalizationManager.GetText(LocalizationKeys.AppSettingsTitle);
            _nsfwSwitchText.Text              = AppSettings.LocalizationManager.GetText(LocalizationKeys.ShowNsfw);
            _lowSwitchText.Text               = AppSettings.LocalizationManager.GetText(LocalizationKeys.ShowLowRated);
            _versionText.Text                 = AppSettings.LocalizationManager.GetText(LocalizationKeys.AppVersion2, appInfoService.GetAppVersion(), appInfoService.GetBuildVersion());
            _addButton.Text                   = AppSettings.LocalizationManager.GetText(LocalizationKeys.AddAccountText);
            _guideButton.Text                 = AppSettings.LocalizationManager.GetText(LocalizationKeys.Guidelines);
            _termsButton.Text                 = AppSettings.LocalizationManager.GetText(LocalizationKeys.ToS);
            _notificationSettings.Text        = AppSettings.LocalizationManager.GetText(LocalizationKeys.NotificationSettings);
            _notificationUpvotes.Text         = AppSettings.LocalizationManager.GetText(LocalizationKeys.NotificationPostUpvotes);
            _notificationCommentsUpvotes.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.NotificationCommentsUpvotes);
            _notificationFollowing.Text       = AppSettings.LocalizationManager.GetText(LocalizationKeys.NotificationFollow);
            _notificationComments.Text        = AppSettings.LocalizationManager.GetText(LocalizationKeys.NotificationComment);
            _notificationPosting.Text         = AppSettings.LocalizationManager.GetText(LocalizationKeys.NotificationPosting);

            SetAddButton(accounts.Count);

            _backButton.Visibility = ViewStates.Visible;
            _backButton.Click     += GoBackClick;
            _switcher.Visibility   = ViewStates.Gone;
            _settings.Visibility   = ViewStates.Gone;

            _viewTitle.Typeface                   = Style.Semibold;
            _addButton.Typeface                   = Style.Semibold;
            _versionText.Typeface                 = Style.Regular;
            _nsfwSwitchText.Typeface              = Style.Semibold;
            _lowSwitchText.Typeface               = Style.Semibold;
            _termsButton.Typeface                 = Style.Semibold;
            _notificationSettings.Typeface        = Style.Semibold;
            _notificationUpvotes.Typeface         = Style.Semibold;
            _notificationCommentsUpvotes.Typeface = Style.Semibold;
            _notificationFollowing.Typeface       = Style.Semibold;
            _notificationComments.Typeface        = Style.Semibold;
            _notificationPosting.Typeface         = Style.Semibold;
            _termsButton.Click   += TermsOfServiceClick;
            _guideButton.Typeface = Style.Semibold;
            _guideButton.Click   += GuideClick;

            _addButton.Click += AddAccountClick;

            _accountsAdapter = new AccountsAdapter();
            _accountsAdapter.AccountsList   = accounts;
            _accountsAdapter.DeleteAccount += OnAdapterDeleteAccount;
            _accountsAdapter.PickAccount   += OnAdapterPickAccount;

            if (Build.VERSION.SdkInt >= Build.VERSION_CODES.Lollipop)
            {
                _accountsList.NestedScrollingEnabled = false;
            }
            _accountsList.SetLayoutManager(new LinearLayoutManager(this));
            _accountsList.SetAdapter(_accountsAdapter);

            _nsfwSwitcher.Checked     = AppSettings.User.IsNsfw;
            _lowRatedSwitcher.Checked = AppSettings.User.IsLowRated;

            PushSettings = AppSettings.User.PushSettings;
            _notificationUpvotesSwitch.Checked         = PushSettings.HasFlag(PushSettings.Upvote);
            _notificationCommentsUpvotesSwitch.Checked = PushSettings.HasFlag(PushSettings.UpvoteComment);
            _notificationFollowingSwitch.Checked       = PushSettings.HasFlag(PushSettings.Follow);
            _notificationCommentsSwitch.Checked        = PushSettings.HasFlag(PushSettings.Comment);
            _notificationPostingSwitch.Checked         = PushSettings.HasFlag(PushSettings.User);

            _nsfwSwitcher.CheckedChange                      += OnNsfwSwitcherOnCheckedChange;
            _lowRatedSwitcher.CheckedChange                  += OnLowRatedSwitcherOnCheckedChange;
            _notificationUpvotesSwitch.CheckedChange         += NotificationChange;
            _notificationCommentsUpvotesSwitch.CheckedChange += NotificationChange;
            _notificationFollowingSwitch.CheckedChange       += NotificationChange;
            _notificationCommentsSwitch.CheckedChange        += NotificationChange;
            _notificationPostingSwitch.CheckedChange         += NotificationChange;

            //for tests
            if (AppSettings.User.IsDev || AppSettings.User.Login.Equals("joseph.kalu"))
            {
                _testsButton.Visibility = ViewStates.Visible;
                _testsButton.Click     += StartTestActivity;
            }
        }