コード例 #1
0
 private void InitThemeDropDown(CGRect rect)
 {
     themeDropDown.InitSource(
         ThemeTypes.ThemeCollection,
         (theme) =>
     {
         _circleMenu.GetThemeProvider().SetCurrentTheme(theme);
         _circleMenu.ResetCustomization();
         ResetFields();
         InitSources(rect);
         UpdateAppearance();
     },
         Fields.Theme,
         rect);
     themeDropDown.SetTextFieldText(_circleMenu.GetThemeProvider().GetCurrentTheme() is LightEOSTheme ? "Light" : "Dark");
 }
コード例 #2
0
 private void ThemeItemSelected(int position)
 {
     if (position > 0)
     {
         _circleMenu.GetThemeProvider().SetCurrentTheme(ThemeTypes.ThemeCollection.ElementAt(position).Value);
         ResetCustomValues();
         UpdateAppearance();
     }
 }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.CircleMenuLayout);

            _circleMenu = new CircleMenu(BaseContext);
            _circleMenu.Attach(Window.DecorView.FindViewById(Android.Resource.Id.Content) as ViewGroup);

            _iconsDictionary = new Dictionary <int, int>()
            {
                { 1, Resource.Drawable.SwitchIcon },
                { 2, Resource.Drawable.CameraIcon },
                { 3, Resource.Drawable.ShutterIcon },
                { 4, Resource.Drawable.TimerIcon },
                { 5, Resource.Drawable.BushIcon },
                { 6, Resource.Drawable.DurationIcon },
                { 7, Resource.Drawable.EffectsIcon },
                { 8, Resource.Drawable.HealIcon },
                { 9, Resource.Drawable.MasksIcon },
                { 101, Resource.Drawable.WidescreenIcon },
                { 102, Resource.Drawable.OneToOneIcon },
                { 103, Resource.Drawable.HDRIcon },
            };

            _circleMenu.CircleMenuItems = GenerateSource(9);

            _circleMenu.Clicked += (s, index) =>
            {
                var intent = new Intent(this, typeof(CircleMenuItemActivity));
                intent.PutExtra("logoId", _iconsDictionary.GetValueOrDefault(index));
                StartActivity(intent);
            };

            _themeDropDown                = FindViewById <EOSSandboxDropDown>(Resource.Id.themeDropDown);
            _mainColorDropDown            = FindViewById <EOSSandboxDropDown>(Resource.Id.mainColor);
            _focusedMainColorDropDown     = FindViewById <EOSSandboxDropDown>(Resource.Id.focusedMainColor);
            _focusedButtonColorDropDown   = FindViewById <EOSSandboxDropDown>(Resource.Id.focusedButtonColor);
            _unfocusedButtonColorDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.unfocusedButtonColor);
            _circleMenuItemsDropDown      = FindViewById <EOSSandboxDropDown>(Resource.Id.circleMenuItems);
            var resetButton = FindViewById <Button>(Resource.Id.buttonResetCustomization);

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

            _mainColorDropDown.Name = Fields.UnfocusedBackgroundColor;
            _mainColorDropDown.SetupAdapter(CircleMenuConstants.UnfocusedBackgroundColors.Select(item => item.Key).ToList());
            _mainColorDropDown.ItemSelected += MainColorItemSelected;

            _focusedMainColorDropDown.Name = Fields.FocusedBackgroundColor;
            _focusedMainColorDropDown.SetupAdapter(CircleMenuConstants.FocusedBackgroundColors.Select(item => item.Key).ToList());
            _focusedMainColorDropDown.ItemSelected += FocusedMainColorItemSelected;

            _focusedButtonColorDropDown.Name = Fields.FocusedIconColor;
            _focusedButtonColorDropDown.SetupAdapter(CircleMenuConstants.FocusedIconColors.Select(item => item.Key).ToList());
            _focusedButtonColorDropDown.ItemSelected += FocusedButtonColorItemSelected;

            _unfocusedButtonColorDropDown.Name = Fields.UnfocusedIconColor;
            _unfocusedButtonColorDropDown.SetupAdapter(CircleMenuConstants.UnfocusedIconColors.Select(item => item.Key).ToList());
            _unfocusedButtonColorDropDown.ItemSelected += UnfocusedButtonColorItemSelected;

            _circleMenuItemsDropDown.Name = Fields.CircleMenuItems;
            _circleMenuItemsDropDown.SetupAdapter(CircleMenuSource.SourceCollection.Select(item => item.Key).ToList());
            _circleMenuItemsDropDown.ItemSelected += CircleMenuItemsItemSelected;

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

            SetCurrenTheme(_circleMenu.GetThemeProvider().GetCurrentTheme());
        }