Пример #1
0
 private void ThemeItemSelected(int position)
 {
     if (position > 0)
     {
         _workTime.GetThemeProvider().SetCurrentTheme(ThemeTypes.ThemeCollection.ElementAt(position).Value);
         if (_workTime.GetThemeProvider().GetCurrentTheme() is LightEOSTheme)
         {
             _workTime.SetBackgroundColor(Color.White);
         }
         else
         {
             _workTime.SetBackgroundColor(Color.Transparent);
         }
         ResetCustomValues();
         UpdateAppearance();
     }
 }
Пример #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.WorkTimeActivity);

            _workTime                          = FindViewById <WorkTime>(Resource.Id.workTime);
            _themeDropDown                     = FindViewById <EOSSandboxDropDown>(Resource.Id.themeDropDown);
            _titleFontDropDown                 = FindViewById <EOSSandboxDropDown>(Resource.Id.titleFontDropDown);
            _dayTextFontDropDown               = FindViewById <EOSSandboxDropDown>(Resource.Id.dayTextFontDropDown);
            _titleTextSizeDropDown             = FindViewById <EOSSandboxDropDown>(Resource.Id.titleTextSizeDropDown);
            _dayTextSizeDropDown               = FindViewById <EOSSandboxDropDown>(Resource.Id.dayTextSizeDropDown);
            _titleColorDropDown                = FindViewById <EOSSandboxDropDown>(Resource.Id.titleColorDropDown);
            _dayTextColorDropDown              = FindViewById <EOSSandboxDropDown>(Resource.Id.dayTextColorDropDown);
            _currentDayBackgroundColorDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.currentDayBackgroundColorDropDown);
            _currentDayTextColorDropDown       = FindViewById <EOSSandboxDropDown>(Resource.Id.currentDayTextColorDropDown);
            _dayEvenBackgroundColorDropDown    = FindViewById <EOSSandboxDropDown>(Resource.Id.dayEvenBackgroundColorDropDown);
            _dividerColorDropDown              = FindViewById <EOSSandboxDropDown>(Resource.Id.dividerColorDropDown);
            _currentDividerColorDropDown       = FindViewById <EOSSandboxDropDown>(Resource.Id.currentDividerColorDropDown);
            _firstDayOfWeekDropDown            = FindViewById <EOSSandboxDropDown>(Resource.Id.firstDayOfWeek);
            var resetButton = FindViewById <EOSSandboxButton>(Resource.Id.buttonResetCustomization);

            _customFields = new List <EOSSandboxDropDown>
            {
                _titleFontDropDown,
                _dayTextFontDropDown,
                _titleTextSizeDropDown,
                _dayTextSizeDropDown,
                _titleColorDropDown,
                _dayTextColorDropDown,
                _currentDayBackgroundColorDropDown,
                _currentDayTextColorDropDown,
                _dayEvenBackgroundColorDropDown,
                _dividerColorDropDown,
                _currentDividerColorDropDown,
                _firstDayOfWeekDropDown
            };

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

            _titleFontDropDown.Name = Fields.TitleFont;
            _titleFontDropDown.SetupAdapter(WorkTimeConstants.TitleFonts.Select(item => item.Key).ToList());
            _titleFontDropDown.ItemSelected += TitleFontItemSelected;

            _dayTextFontDropDown.Name = Fields.DayTextFont;
            _dayTextFontDropDown.SetupAdapter(WorkTimeConstants.DayFonts.Select(item => item.Key).ToList());
            _dayTextFontDropDown.ItemSelected += DayTextFonItemSelected;

            _titleTextSizeDropDown.Name = Fields.TitleTextSize;
            _titleTextSizeDropDown.SetupAdapter(WorkTimeConstants.TitleTextSizes.Select(item => item.Key).ToList());
            _titleTextSizeDropDown.ItemSelected += TitleTextSizeItemSelected;

            _dayTextSizeDropDown.Name = Fields.DayTextSize;
            _dayTextSizeDropDown.SetupAdapter(WorkTimeConstants.DayTextSizes.Select(item => item.Key).ToList());
            _dayTextSizeDropDown.ItemSelected += DayTextSizeItemSelected;

            _titleColorDropDown.Name = Fields.TitleColor;
            _titleColorDropDown.SetupAdapter(WorkTimeConstants.TitleColors.Select(item => item.Key).ToList());
            _titleColorDropDown.ItemSelected += TitleColorItemSelected;

            _dayTextColorDropDown.Name = Fields.DayTextColor;
            _dayTextColorDropDown.SetupAdapter(WorkTimeConstants.DayColors.Select(item => item.Key).ToList());
            _dayTextColorDropDown.ItemSelected += DayTextColorItemSelected;

            _currentDayBackgroundColorDropDown.Name = Fields.CurrentDayBackgroundColor;
            _currentDayBackgroundColorDropDown.SetupAdapter(WorkTimeConstants.CurrentDayBackgroundColors.Select(item => item.Key).ToList());
            _currentDayBackgroundColorDropDown.ItemSelected += CurrentDayBackgroundColorItemSelected;

            _currentDayTextColorDropDown.Name = Fields.CurrentDayTextColor;
            _currentDayTextColorDropDown.SetupAdapter(WorkTimeConstants.CurrentDayColors.Select(item => item.Key).ToList());
            _currentDayTextColorDropDown.ItemSelected += CurrentDayTextColorItemSelected;

            _dayEvenBackgroundColorDropDown.Name = Fields.DayEvenBackgroundColor;
            _dayEvenBackgroundColorDropDown.SetupAdapter(WorkTimeConstants.DayEvenBackgroundColors.Select(item => item.Key).ToList());
            _dayEvenBackgroundColorDropDown.ItemSelected += DayEvenBackgroundColorItemSelected;

            _dividerColorDropDown.Name = Fields.ColorDividers;
            _dividerColorDropDown.SetupAdapter(WorkTimeConstants.DividersColors.Select(item => item.Key).ToList());
            _dividerColorDropDown.ItemSelected += DividerColorItemSelected;

            _currentDividerColorDropDown.Name = Fields.CurrentColorDividers;
            _currentDividerColorDropDown.SetupAdapter(WorkTimeConstants.CurrentDayDividerColors.Select(item => item.Key).ToList());
            _currentDividerColorDropDown.ItemSelected += CurrentDividerColorItemSelected;

            _firstDayOfWeekDropDown.Name = Fields.WeekStartDay;
            _firstDayOfWeekDropDown.SetupAdapter(Days.DaysCollection.Select(item => item.Key).ToList());
            _firstDayOfWeekDropDown.ItemSelected += FirstDayOfWeekItemSelected;

            _workTime.Items = GenerateDaysOfWeekSource();

            SetCurrenTheme(_workTime.GetThemeProvider().GetCurrentTheme());

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

            ResetViewWhenActivityRecreated(savedInstanceState);
        }