private void InitThemeDropDown(CGRect rect) { themeDropDown.InitSource( ThemeTypes.ThemeCollection, (theme) => { _simpleButton.GetThemeProvider().SetCurrentTheme(theme); _simpleButton.ResetCustomization(); ResetFields(); UpdateAppearance(); ApplySimpleButtonViewBehavior(); InitSources(rect); }, Fields.Theme, rect); themeDropDown.SetTextFieldText(_simpleButton.GetThemeProvider().GetCurrentTheme() is LightEOSTheme ? "Light" : "Dark"); }
private void ThemeItemSelected(int position) { if (position > 0) { _simpleButton.GetThemeProvider().SetCurrentTheme(ThemeTypes.ThemeCollection.ElementAt(position).Value); ResetCustomValues(); UpdateAppearance(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SimpleButtonLayout); _simpleButton = FindViewById <SimpleButton>(Resource.Id.simpleButton); _themeDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.themeDropDown); _fontDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.fontDropDown); _letterSpacingDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.letterSpacingDropDown); _textSizeDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.textSizeDropDown); _textColorEnabledDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.enabledTextColorDropDown); _textColorDisabledDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.disabledTextColorDropDown); _backgroundColorEnabledDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.enabledBackgroundDropDown); _backgroundColorDisabledDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.disabledBackgroundDropDown); _backgroundColorPressedDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.pressedBackgroundDropDown); _cornerRadiusDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.cornerRadiusDropDown); _rippleColorDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.rippleColorDropDown); var resetButton = FindViewById <Button>(Resource.Id.buttonResetCustomization); var disableSwitch = FindViewById <Switch>(Resource.Id.switchDisabled); _buttonTypeDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.buttonTypeDropDown); _shadowRadiusDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.shadowRadiusDropDown); _shadowRadiusDropDown.Name = Fields.ShadowRadius; _shadowRadiusDropDown.SetupAdapter(SimpleButtonConstants.ShadowRadiusCollection.Select(item => item.Key).ToList()); _shadowRadiusDropDown.ItemSelected += ShadowRadiusItemSelected; _buttonTypeDropDown.Visibility = ViewStates.Visible; _buttonTypeDropDown.Name = Fields.ButtonType; _buttonTypeDropDown.SetupAdapter(Buttons.SimpleButtonTypeCollection.Select(item => item.Key).ToList()); _buttonTypeDropDown.ItemSelected += ButtonTypeItemSelected; _themeDropDown.Name = Fields.Theme; _themeDropDown.SetupAdapter(ThemeTypes.ThemeCollection.Select(item => item.Key).ToList()); _themeDropDown.ItemSelected += ThemeItemSelected; _fontDropDown.Name = Fields.Font; _fontDropDown.SetupAdapter(SimpleButtonConstants.SimpleButtonFonts.Select(item => item.Key).ToList()); _fontDropDown.ItemSelected += FontSpinner_ItemSelected; _letterSpacingDropDown.Name = Fields.LetterSpacing; _letterSpacingDropDown.SetupAdapter(SimpleButtonConstants.LetterSpacings.Select(item => item.Key).ToList()); _letterSpacingDropDown.ItemSelected += LetterSpacingView_ItemSelected; _textSizeDropDown.Name = Fields.TextSize; _textSizeDropDown.SetupAdapter(SimpleButtonConstants.TextSizes.Select(item => item.Key).ToList()); _textSizeDropDown.ItemSelected += TextSizeItemSelected; _textColorEnabledDropDown.Name = Fields.EnabledTextColor; _textColorEnabledDropDown.SetupAdapter(SimpleButtonConstants.FontColors.Select(item => item.Key).ToList()); _textColorEnabledDropDown.ItemSelected += TextColorEnabledItemSelected; _textColorDisabledDropDown.Name = Fields.DisabledTextColor; _textColorDisabledDropDown.SetupAdapter(SimpleButtonConstants.DisabledFontColors.Select(item => item.Key).ToList()); _textColorDisabledDropDown.ItemSelected += TextColorDisabledItemSelected; _backgroundColorEnabledDropDown.Name = Fields.EnabledBackground; _backgroundColorEnabledDropDown.SetupAdapter(SimpleButtonConstants.BackgroundColors.Select(item => item.Key).ToList()); _backgroundColorEnabledDropDown.ItemSelected += BackgroundColorEnabledItemSelected; _backgroundColorDisabledDropDown.Name = Fields.DisabledBackground; _backgroundColorDisabledDropDown.SetupAdapter(SimpleButtonConstants.DisabledBackgroundColors.Select(item => item.Key).ToList()); _backgroundColorDisabledDropDown.ItemSelected += BackgroundColorDisabledItemSelected; _backgroundColorPressedDropDown.Name = Fields.PressedBackground; _backgroundColorPressedDropDown.SetupAdapter(SimpleButtonConstants.PressedBackgroundColors.Select(item => item.Key).ToList()); _backgroundColorPressedDropDown.ItemSelected += BackgroundColorPressedItemSelected; _cornerRadiusDropDown.Name = Fields.ConerRadius; _cornerRadiusDropDown.SetupAdapter(SimpleButtonConstants.CornerRadiusCollection.Select(item => item.Key).ToList()); _cornerRadiusDropDown.ItemSelected += CornerRadiurSpinner_ItemSelected; _rippleColorDropDown.Name = Fields.RippleColor; _rippleColorDropDown.SetupAdapter(SimpleButtonConstants.RippleColors.Select(item => item.Key).ToList()); _rippleColorDropDown.ItemSelected += RippleColorItemSelected; resetButton.Click += delegate { SetupSimpleButtonStyle(); EnableSimpleButtonFields(); _simpleButton.ResetCustomization(); ResetCustomValues(); }; disableSwitch.SetOnCheckedChangeListener(this); SetCurrenTheme(_simpleButton.GetThemeProvider().GetCurrentTheme()); SetupSimpleButtonStyle(); EnableSimpleButtonFields(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SimpleButtonLayout); _CTAButton = FindViewById <SimpleButton>(Resource.Id.simpleButton); _CTAButton.UpdateAppearance(); _CTAButton.Text = "CTA button"; _CTAButton.Click += async(s, e) => { if (_CTAButton.InProgress) { return; } _CTAButton.StartProgressAnimation(); ToggleEnableState(); await Task.Delay(5000); _CTAButton.StopProgressAnimation(); ToggleEnableState(); }; _themeDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.themeDropDown); _cornerRadiusDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.cornerRadiusDropDown); var fontDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.fontDropDown); var letterSpacingDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.letterSpacingDropDown); var textSizeDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.textSizeDropDown); var textColorEnabledDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.enabledTextColorDropDown); var textColorDisabledDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.disabledTextColorDropDown); var backgroundColorEnabledDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.enabledBackgroundDropDown); var backgroundColorDisabledDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.disabledBackgroundDropDown); var backgroundColorPressedDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.pressedBackgroundDropDown); var rippleColorDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.rippleColorDropDown); _resetButton = FindViewById <Button>(Resource.Id.buttonResetCustomization); _disableSwitch = FindViewById <Switch>(Resource.Id.switchDisabled); _buttonTypeDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.buttonTypeDropDown); _shadowRadiusDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.shadowRadiusDropDown); _dropDowns = new List <EOSSandboxDropDown> { _themeDropDown, fontDropDown, letterSpacingDropDown, textSizeDropDown, textColorEnabledDropDown, textColorDisabledDropDown, backgroundColorEnabledDropDown, backgroundColorDisabledDropDown, backgroundColorPressedDropDown, _cornerRadiusDropDown, rippleColorDropDown, _shadowRadiusDropDown, _buttonTypeDropDown }; _shadowRadiusDropDown.Name = Fields.ShadowRadius; _shadowRadiusDropDown.SetupAdapter(SimpleButtonConstants.ShadowRadiusCollection.Select(item => item.Key).ToList()); _shadowRadiusDropDown.ItemSelected += ShadowRadiusItemSelected; _buttonTypeDropDown.Visibility = ViewStates.Visible; _buttonTypeDropDown.Name = Fields.ButtonType; _buttonTypeDropDown.SetupAdapter(Buttons.CTAButtonTypeCollection.Select(item => item.Key).ToList()); _buttonTypeDropDown.ItemSelected += ButtonTypeItemSelected; _themeDropDown.Name = Fields.Theme; _themeDropDown.SetupAdapter(ThemeTypes.ThemeCollection.Select(item => item.Key).ToList()); _themeDropDown.ItemSelected += ThemeItemSelected; fontDropDown.Name = Fields.Font; fontDropDown.SetupAdapter(SimpleButtonConstants.SimpleButtonFonts.Select(item => item.Key).ToList()); fontDropDown.ItemSelected += FontItemSelected; letterSpacingDropDown.Name = Fields.LetterSpacing; letterSpacingDropDown.SetupAdapter(SimpleButtonConstants.LetterSpacings.Select(item => item.Key).ToList()); letterSpacingDropDown.ItemSelected += LetterSpacingItemSelected; textSizeDropDown.Name = Fields.TextSize; textSizeDropDown.SetupAdapter(SimpleButtonConstants.TextSizes.Select(item => item.Key).ToList()); textSizeDropDown.ItemSelected += TextSizeItemSelected; textColorEnabledDropDown.Name = Fields.EnabledTextColor; textColorEnabledDropDown.SetupAdapter(SimpleButtonConstants.FontColors.Select(item => item.Key).ToList()); textColorEnabledDropDown.ItemSelected += TextColorEnabledItemSelected; textColorDisabledDropDown.Name = Fields.DisabledTextColor; textColorDisabledDropDown.SetupAdapter(SimpleButtonConstants.DisabledFontColors.Select(item => item.Key).ToList()); textColorDisabledDropDown.ItemSelected += TextColorDisabledItemSelected; backgroundColorEnabledDropDown.Name = Fields.EnabledBackground; backgroundColorEnabledDropDown.SetupAdapter(SimpleButtonConstants.BackgroundColors.Select(item => item.Key).ToList()); backgroundColorEnabledDropDown.ItemSelected += BackgroundColorEnabledItemSelected; backgroundColorDisabledDropDown.Name = Fields.DisabledBackground; backgroundColorDisabledDropDown.SetupAdapter(SimpleButtonConstants.DisabledBackgroundColors.Select(item => item.Key).ToList()); backgroundColorDisabledDropDown.ItemSelected += BackgroundColorDisabledItemSelected; backgroundColorPressedDropDown.Name = Fields.PressedBackground; backgroundColorPressedDropDown.SetupAdapter(SimpleButtonConstants.PressedBackgroundColors.Select(item => item.Key).ToList()); backgroundColorPressedDropDown.ItemSelected += BackgroundColorPressedItemSelected; _cornerRadiusDropDown.Name = Fields.ConerRadius; _cornerRadiusDropDown.SetupAdapter(SimpleButtonConstants.CornerRadiusCollection.Select(item => item.Key).ToList()); _cornerRadiusDropDown.ItemSelected += CornerRadiusItemSelected; rippleColorDropDown.Name = Fields.RippleColor; rippleColorDropDown.SetupAdapter(SimpleButtonConstants.RippleColors.Select(item => item.Key).ToList()); rippleColorDropDown.ItemSelected += RippleColorItemSelected; _resetButton.Click += delegate { SetupSimpleButtonStyle(); EnableSimpleButtonFields(); _CTAButton.ResetCustomization(); ResetCustomValues(); }; _disableSwitch.SetOnCheckedChangeListener(this); SetCurrenTheme(_CTAButton.GetThemeProvider().GetCurrentTheme()); SetupSimpleButtonStyle(); EnableSimpleButtonFields(); }