Exemplo n.º 1
0
 private void ThemeItemSelected(int position)
 {
     if (position > 0)
     {
         _badge.GetThemeProvider().SetCurrentTheme(ThemeTypes.ThemeCollection.ElementAt(position).Value);
         ResetCustomValues();
         UpdateAppearance();
     }
 }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.BadgeLabelLayout);

            _badge = FindViewById <BadgeLabel>(Resource.Id.badgeLabel);

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

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

            _backgroundColorDropDown.Name = Fields.Background;
            _backgroundColorDropDown.SetupAdapter(BadgeLabelConstants.BackgroundColors.Select(item => item.Key).ToList());
            _backgroundColorDropDown.ItemSelected += BackgroundColorItemSelected;

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

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

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

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

            _cornerRadiusDropDown.Name = Fields.ConerRadius;
            _cornerRadiusDropDown.SetupAdapter(BadgeLabelConstants.CornerRadiusCollection.Select(item => item.Key).ToList());
            _cornerRadiusDropDown.ItemSelected += CornerRadiusItemSelected;

            SetCurrenTheme(_badge.GetThemeProvider().GetCurrentTheme());

            resetButton.Click += delegate
            {
                ResetCustomValues();
            };
        }
Exemplo n.º 3
0
 private void InitThemeDropDown(CGRect rect)
 {
     themeDropDown.InitSource(
         ThemeTypes.ThemeCollection,
         (theme) =>
     {
         _label.GetThemeProvider().SetCurrentTheme(theme);
         _label.ResetCustomization();
         _dropDowns.Except(new[] { themeDropDown }).ToList().ForEach(dropDown => dropDown.ResetValue());
         InitSources(rect);
         UpdateAppearance();
     },
         Fields.Theme,
         rect);
 }
Exemplo n.º 4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            UpdateAppearance();

            _label      = new BadgeLabel();
            _label.Text = "Label";
            _dropDowns  = new List <EOSSandboxDropDown>()
            {
                backgroundColorDropDown,
                letterSpaceDropDown,
                themeDropDown,
                fontDropDown,
                textColorDropDown,
                textSizeDropDown,
                cornerRadiusDropDown
            };

            View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                _dropDowns.ForEach(dropDown => dropDown.CloseInputControl());
            }));

            containerView.ConstrainLayout(() => _label.Frame.GetCenterX() == containerView.Frame.GetCenterX() &&
                                          _label.Frame.GetCenterY() == containerView.Frame.GetCenterY(), _label);

            var frame = new CGRect(0, 0, 100, 150);

            InitThemeDropDown(frame);
            themeDropDown.SetTextFieldText(_label.GetThemeProvider().GetCurrentTheme() is LightEOSTheme ? "Light" : "Dark");
            resetButton.TouchUpInside += (sender, e) =>
            {
                _label.ResetCustomization();
                _dropDowns.Except(new[] { themeDropDown }).ToList().ForEach(dropDown => dropDown.ResetValue());
            };
            InitSources(frame);
        }