Esempio n. 1
0
 private void InitThemeDropDown(CGRect rect)
 {
     themesDropDown.InitSource(
         ThemeTypes.ThemeCollection,
         (theme) =>
     {
         _simpleLabel.GetThemeProvider().SetCurrentTheme(theme);
         _simpleLabel.ResetCustomization();
         _dropDowns.Except(new[] { themesDropDown }).ToList().ForEach(dropDown => dropDown.ResetValue());
         InitSources(rect);
         UpdateAppearance();
     },
         Fields.Theme,
         rect);
     themesDropDown.SetTextFieldText(_simpleLabel.GetThemeProvider().GetCurrentTheme() is LightEOSTheme ? "Light" : "Dark");
 }
Esempio n. 2
0
 private void ThemeItemSelected(int position)
 {
     if (position > 0)
     {
         _simpleLabel.GetThemeProvider().SetCurrentTheme(ThemeTypes.ThemeCollection.ElementAt(position).Value);
         ResetCustomValues();
         UpdateAppearance();
     }
 }
Esempio n. 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SimpleLabelLayout);

            _simpleLabel = FindViewById <SimpleLabel>(Resource.Id.simpleLabel);

            _themeDropDown         = FindViewById <EOSSandboxDropDown>(Resource.Id.themeDropDown);
            _textColorDropDown     = FindViewById <EOSSandboxDropDown>(Resource.Id.textColorDropDown);
            _fontDropDown          = FindViewById <EOSSandboxDropDown>(Resource.Id.fontDropDown);
            _letterSpacingDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.letterSpacingDropDown);
            _textSizeDropDown      = FindViewById <EOSSandboxDropDown>(Resource.Id.textSizeDropDown);
            var resetButton = FindViewById <Button>(Resource.Id.buttonResetCustomization);

            _themeDropDown.Name = Fields.Theme;
            _themeDropDown.SetupAdapter(ThemeTypes.ThemeCollection.Select(item => item.Key).ToList());
            _themeDropDown.ItemSelected += ThemeItemSelected;

            _textColorDropDown.Name = Fields.TextColor;
            _textColorDropDown.SetupAdapter(SimpleLabelConstants.FontColors.Select(item => item.Key).ToList());
            _textColorDropDown.ItemSelected += TextColorItemSelected;

            _fontDropDown.Name = Fields.Font;
            _fontDropDown.SetupAdapter(SimpleLabelConstants.SimpleLabelFonts.Select(item => item.Key).ToList());
            _fontDropDown.ItemSelected += FontItemSelected;

            _letterSpacingDropDown.Name = Fields.LetterSpacing;
            _letterSpacingDropDown.SetupAdapter(SimpleLabelConstants.LetterSpacings.Select(item => item.Key).ToList());
            _letterSpacingDropDown.ItemSelected += LetterSpacingItemSelected;

            _textSizeDropDown.Name = Fields.TextSize;
            _textSizeDropDown.SetupAdapter(SimpleLabelConstants.TextSizes.Select(item => item.Key).ToList());
            _textSizeDropDown.ItemSelected += TextSizeItemSelected;

            SetCurrenTheme(_simpleLabel.GetThemeProvider().GetCurrentTheme());

            resetButton.Click += delegate
            {
                ResetCustomValues();
            };
        }