示例#1
0
        public void OnSharedPreferenceChanged(ISharedPreferences sharedPreferences, string key)
        {
            switch (key)
            {
            case ACCENT_COLOR_KEY:
                AccentColor newColor = AccentColors.GetIdFromResource(sharedPreferences.GetString(key, ACCENT_COLOR_DEFAULT));

                if (newColor != currentAccentColor)
                {
                    currentAccentColor = newColor;

                    clickableFrameLayout.SetBackgroundColor(GetColor(currentAccentColor));
                }

                break;
            }
        }
示例#2
0
        public void OnSharedPreferenceChanged(ISharedPreferences sharedPreferences, string key)
        {
            switch (key)
            {
            case ACCENT_COLOR_KEY:
                AccentColor newColor = AccentColors.GetIdFromResource(sharedPreferences.GetString(key, ACCENT_COLOR_DEFAULT));

                if (newColor != currentAccentColor)
                {
                    currentAccentColor = newColor;

                    colorLayout.SetBackgroundColor(GetColor(currentAccentColor));
                    ignoreSelection = true;
                    colorSpinner.SetSelection(AccentColors.GetAccentColors().IndexOf(currentAccentColor));
                }

                break;
            }
        }
示例#3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.activity_main);

            settings = PreferenceManager.GetDefaultSharedPreferences(this);
            editor   = settings.Edit();
            //editor.Clear().Commit();
            prefListener = new PrefListener(this);

            clickableFrameLayout = FindViewById <FrameLayout>(Resource.Id.clickableFrameLayout);

            currentAccentColor = AccentColors.GetIdFromResource(settings.GetString(ACCENT_COLOR_KEY, ACCENT_COLOR_DEFAULT));

            clickableFrameLayout.SetBackgroundColor(GetColor(currentAccentColor));
            clickableFrameLayout.SetOnClickListener(this);

            SetAmbientEnabled();
        }
示例#4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_main);

            settings = PreferenceManager.GetDefaultSharedPreferences(this);
            editor   = settings.Edit();
            //editor.Clear().Commit();
            prefListener = new PrefListener(this);

            colorSpinner = FindViewById <Spinner>(Resource.Id.colorSpinner);
            colorLayout  = FindViewById <FrameLayout>(Resource.Id.colorLayout);

            currentAccentColor = AccentColors.GetIdFromResource(settings.GetString(ACCENT_COLOR_KEY, ACCENT_COLOR_DEFAULT));

            AccentColor[] colors = AccentColors.GetAccentColors().ToArray();
            colorSpinner.Adapter = new ArrayAdapter <AccentColor>(this, Resource.Layout.colorspinner_item, colors);

            colorLayout.SetBackgroundColor(GetColor(currentAccentColor));
            colorSpinner.ItemSelected += ColorSpinner_ItemSelected;
        }