コード例 #1
0
        public void GetStoredCheckedState_Default_IsTrue()
        {
            SettingsGeneralViewModel vm = new SettingsGeneralViewModel();
            bool storedCheckedState     = vm.GetStoredCheckedState();

            Assert.True(storedCheckedState);
        }
コード例 #2
0
        public void OnCheckedChange_SetsValue_False()
        {
            SettingsGeneralViewModel vm = new SettingsGeneralViewModel();

            vm.OnCheckedChange(false);
            bool storedCheckedState = vm.GetStoredCheckedState();

            Assert.False(storedCheckedState);
        }
コード例 #3
0
        private void Init()
        {
            Button backButton = FindViewById <Button>(Resource.Id.arrow_back_general);

            backButton.ContentDescription = SETTINGS_CHILD_PAGE_ACCESSIBILITY_BACK_BUTTON;

            TextView titleField       = FindViewById <TextView>(Resource.Id.settings_general_title);
            TextView explanationOne   = FindViewById <TextView>(Resource.Id.settings_general_explanation);
            TextView explanationTwo   = FindViewById <TextView>(Resource.Id.settings_general_explanation_two);
            TextView mobileDataHeader = FindViewById <TextView>(Resource.Id.settings_general_mobile_data_header);
            TextView mobileDataDesc   = FindViewById <TextView>(Resource.Id.settings_general_mobile_data_desc);
            TextView languageHeader   = FindViewById <TextView>(Resource.Id.settings_general_select_lang_header);
            TextView languageDesc     = FindViewById <TextView>(Resource.Id.settings_general_select_lang_desc_one);
            TextView languageLink     = FindViewById <TextView>(Resource.Id.settings_general_link);

            TextView linkLayout = FindViewById <TextView>(Resource.Id.settings_general_link);

            titleField.Text                 = SETTINGS_GENERAL_TITLE;
            explanationOne.Text             = SETTINGS_GENERAL_EXPLANATION_ONE;
            explanationTwo.Text             = SETTINGS_GENERAL_EXPLANATION_TWO;
            mobileDataHeader.Text           = SETTINGS_GENERAL_MOBILE_DATA_HEADER;
            mobileDataDesc.Text             = SETTINGS_GENERAL_MOBILE_DATA_DESC;
            languageHeader.Text             = SETTINGS_GENERAL_CHOOSE_LANGUAGE_HEADER;
            languageDesc.Text               = SETTINGS_GENERAL_RESTART_REQUIRED_TEXT;
            languageLink.Text               = SETTINGS_GENERAL_MORE_INFO_BUTTON_TEXT;
            languageLink.ContentDescription = SETTINGS_GENERAL_ACCESSIBILITY_MORE_INFO_BUTTON_TEXT;

            linkLayout.Click +=
                new StressUtils.SingleClick(
                    (o, args) => OpenSmitteStopLink()).Run;

            RadioGroup  radioGroup         = FindViewById <RadioGroup>(Resource.Id.settings_general_select_lang_radio_group);
            RadioButton englishRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_english);
            RadioButton bokmalRadioButton  = FindViewById <RadioButton>(Resource.Id.settings_general_bokmal);
            RadioButton nynorskRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_nynorsk);


            englishRadioButton.Text = SETTINGS_GENERAL_EN;
            bokmalRadioButton.Text  = SETTINGS_GENERAL_NB;
            nynorskRadioButton.Text = SETTINGS_GENERAL_NN;

            string appLanguage = LocalesService.GetLanguage();

            if (appLanguage == "en")
            {
                englishRadioButton.Checked = true;
            }
            else if (appLanguage == "nn")
            {
                nynorskRadioButton.Checked = true;
            }
            else
            {
                bokmalRadioButton.Checked = true;
            }

            radioGroup.SetOnCheckedChangeListener(new OnCheckedChangeListener(this));

            SwitchCompat switchButton = FindViewById <SwitchCompat>(Resource.Id.settings_general_switch);

            switchButton.Checked        = _viewModel.GetStoredCheckedState();
            switchButton.CheckedChange += OnCheckedChange;

            backButton.Click += new StressUtils.SingleClick((sender, args) => Finish()).Run;
        }
コード例 #4
0
        private void Init()
        {
            ImageButton backButton = FindViewById <ImageButton>(Resource.Id.arrow_back_general);

            backButton.ContentDescription = BACK_BUTTON_ACCESSIBILITY_TEXT;

            TextView titleField       = FindViewById <TextView>(Resource.Id.settings_general_title);
            TextView explanationOne   = FindViewById <TextView>(Resource.Id.settings_general_explanation);
            TextView explanationTwo   = FindViewById <TextView>(Resource.Id.settings_general_explanation_two);
            TextView mobileDataHeader = FindViewById <TextView>(Resource.Id.settings_general_mobile_data_header);
            TextView mobileDataDesc   = FindViewById <TextView>(Resource.Id.settings_general_mobile_data_desc);
            TextView languageHeader   = FindViewById <TextView>(Resource.Id.settings_general_select_lang_header);
            TextView languageDesc     = FindViewById <TextView>(Resource.Id.settings_general_select_lang_desc_one);
            TextView languageLink     = FindViewById <TextView>(Resource.Id.settings_general_link);
            TextView linkLayout       = FindViewById <TextView>(Resource.Id.settings_general_link);

            titleField.Text                 = SETTINGS_GENERAL_TITLE;
            explanationOne.Text             = SETTINGS_GENERAL_EXPLANATION_ONE;
            explanationTwo.Text             = SETTINGS_GENERAL_EXPLANATION_TWO;
            mobileDataHeader.Text           = SETTINGS_GENERAL_MOBILE_DATA_HEADER;
            mobileDataDesc.Text             = SETTINGS_GENERAL_MOBILE_DATA_DESC;
            languageHeader.Text             = SETTINGS_GENERAL_CHOOSE_LANGUAGE_HEADER;
            languageDesc.Text               = SETTINGS_GENERAL_RESTART_REQUIRED_TEXT;
            languageLink.TextAlignment      = TextAlignment.ViewStart;
            languageLink.ContentDescription = SETTINGS_GENERAL_ACCESSIBILITY_MORE_INFO_BUTTON_TEXT;

            titleField.SetAccessibilityDelegate(AccessibilityUtils.GetHeadingAccessibilityDelegate());
            mobileDataHeader.SetAccessibilityDelegate(AccessibilityUtils.GetHeadingAccessibilityDelegate());
            languageHeader.SetAccessibilityDelegate(AccessibilityUtils.GetHeadingAccessibilityDelegate());

            languageLink.TextFormatted  = HtmlCompat.FromHtml($"<a href=\"{SETTINGS_GENERAL_MORE_INFO_LINK}\">{SETTINGS_GENERAL_MORE_INFO_BUTTON_TEXT}</a>", HtmlCompat.FromHtmlModeLegacy);
            languageLink.MovementMethod = new Android.Text.Method.LinkMovementMethod();

            RadioGroup  radioGroup            = FindViewById <RadioGroup>(Resource.Id.settings_general_select_lang_radio_group);
            RadioButton englishRadioButton    = FindViewById <RadioButton>(Resource.Id.settings_general_english);
            RadioButton bokmalRadioButton     = FindViewById <RadioButton>(Resource.Id.settings_general_bokmal);
            RadioButton nynorskRadioButton    = FindViewById <RadioButton>(Resource.Id.settings_general_nynorsk);
            RadioButton polishRadioButton     = FindViewById <RadioButton>(Resource.Id.settings_general_polish);
            RadioButton somaliRadioButton     = FindViewById <RadioButton>(Resource.Id.settings_general_somali);
            RadioButton tigrinyaRadioButton   = FindViewById <RadioButton>(Resource.Id.settings_general_tigrinya);
            RadioButton arabicRadioButton     = FindViewById <RadioButton>(Resource.Id.settings_general_arabic);
            RadioButton urduRadioButton       = FindViewById <RadioButton>(Resource.Id.settings_general_urdu);
            RadioButton lithuanianRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_lithuanian);



            englishRadioButton.Text    = SETTINGS_GENERAL_EN;
            bokmalRadioButton.Text     = SETTINGS_GENERAL_NB;
            nynorskRadioButton.Text    = SETTINGS_GENERAL_NN;
            polishRadioButton.Text     = SETTINGS_GENERAL_PL;
            somaliRadioButton.Text     = SETTINGS_GENERAL_SO;
            tigrinyaRadioButton.Text   = SETTINGS_GENERAL_TI;
            arabicRadioButton.Text     = SETTINGS_GENERAL_AR;
            urduRadioButton.Text       = SETTINGS_GENERAL_UR;
            lithuanianRadioButton.Text = SETTINGS_GENERAL_LT;

            string appLanguage = LocalesService.GetLanguage();

            switch (appLanguage)
            {
            case "en":
                englishRadioButton.Checked = true;
                break;

            case "nn":
                nynorskRadioButton.Checked = true;
                break;

            case "pl":
                polishRadioButton.Checked = true;
                break;

            case "so":
                somaliRadioButton.Checked = true;
                break;

            case "ti":
                tigrinyaRadioButton.Checked = true;
                break;

            case "ar":
                arabicRadioButton.Checked = true;
                break;

            case "ur":
                urduRadioButton.Checked = true;
                break;

            case "lt":
                lithuanianRadioButton.Checked = true;
                break;

            default:
                bokmalRadioButton.Checked = true;
                break;
            }

            radioGroup.SetOnCheckedChangeListener(new OnCheckedChangeListener(this));

            SwitchCompat switchButton = FindViewById <SwitchCompat>(Resource.Id.settings_general_switch);

            switchButton.Checked        = _viewModel.GetStoredCheckedState();
            switchButton.CheckedChange += OnCheckedChange;

            backButton.Click += new StressUtils.SingleClick((sender, args) => Finish()).Run;

            // Layout direction logic
            View rootView = Window.DecorView.RootView;

            rootView.LayoutDirection = LayoutUtils.GetLayoutDirection();
            backButton.SetBackgroundResource(LayoutUtils.GetBackArrow());
            languageLink.SetCompoundDrawablesRelativeWithIntrinsicBounds(null, null, ContextCompat.GetDrawable(this, LayoutUtils.GetForwardArrow()), null);
        }