Пример #1
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());
        }
Пример #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _icons = new Dictionary <string, UIImage>()
            {
                { "icImage", UIImage.FromBundle("icImage") },
                { "icPanorama", UIImage.FromBundle("icPanorama") },
                { "icVideo", UIImage.FromBundle("icVideo") },
                { "icPhoto", UIImage.FromBundle("icPhoto") },
                { "icTimelapse", UIImage.FromBundle("icTimelapse") },
                { "icMacro", UIImage.FromBundle("icMacro") },
                { "icPortrait", UIImage.FromBundle("icPortrait") },
                { "icSeries", UIImage.FromBundle("icSeries") },
                { "icTimer", UIImage.FromBundle("icTimer") },
                { "icSixteenToNine", UIImage.FromBundle("icSixteenToNine") },
                { "icOneToOne", UIImage.FromBundle("icOneToOne") },
                { "icHDR", UIImage.FromBundle("icHDR") }
            };

            _circleMenu          = new CircleMenu();
            _circleMenu.Clicked += (object sender, int id) =>
            {
                if (id == 100)
                {
                    _navigationBarEnabled = !_navigationBarEnabled;
                    ToggleNavigationBar(_navigationBarEnabled);
                }
                else
                {
                    if (!_submenuIds.Contains(id))
                    {
                        ShowItemController(_icons.ElementAt(id).Key);
                    }
                }
            };

            _circleMenu.CircleMenuItems = CreateSource(9);
            _circleMenu.Attach(this);

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

            _dropDowns = new List <EOSSandboxDropDown>()
            {
                themeDropDown,
                unfocusedButtonColorDropDown,
                unfocusedIconColorDropDown,
                focusedButtonColorDropDown,
                focusedIconColorDropDown,
                itemsCountDropDown
            };

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

            InitThemeDropDown(rect);
            InitItemsCountDropDown(rect);
            InitSources(rect);
            InitResetButton();
        }