protected override void OnResume()
        {
            base.OnResume();

            var label     = GetString(Resource.String.appName);
            var colourInt = ContextCompat.GetColor(this, AccentColourMap.GetColourId(_preferences.AccentColour));
            var colour    = new Color(colourInt);

            if (Build.VERSION.SdkInt >= BuildVersionCodes.P)
            {
                SetTaskDescription(new ActivityManager.TaskDescription(label, Resource.Mipmap.ic_launcher, colour));
            }
            else
            {
                var bitmap = BitmapFactory.DecodeResource(Resources, Resource.Mipmap.ic_launcher);
#pragma warning disable 618
                SetTaskDescription(new ActivityManager.TaskDescription(label, bitmap, colour));
#pragma warning restore 618
            }

            if (_updatedThemeOnCreate)
            {
                _updatedThemeOnCreate = false;
                return;
            }

            UpdateTheme();
        }
Beispiel #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            SetStyle(StyleNormal, Resource.Style.BottomSheetStyle);
            var prefs = new PreferenceWrapper(Context);

            Context.Theme.ApplyStyle(AccentColourMap.GetOverlay(prefs.AccentColour), true);
            return(inflater.Inflate(_layout, container, false));
        }
        public override View OnCreateView(LayoutInflater contextInflater, ViewGroup container,
                                          Bundle savedInstanceState)
        {
            var contextThemeWrapper = new ContextThemeWrapper(Activity, Resource.Style.BottomSheetStyle);
            var prefs = new PreferenceWrapper(Context);

            contextThemeWrapper.Theme.ApplyStyle(AccentColourMap.GetOverlayId(prefs.AccentColour), true);
            StyledInflater = contextInflater.CloneInContext(contextThemeWrapper);

            return(StyledInflater.Inflate(_layout, container, false));
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            _preferences = new PreferenceWrapper(this);

            _checkedOnCreate = true;
            UpdateTheme();

            BaseApplication = (BaseApplication)Application;

            if (Build.VERSION.SdkInt < BuildVersionCodes.M)
            {
                Window.SetStatusBarColor(Android.Graphics.Color.Black);
            }

            var overlay = AccentColourMap.GetOverlay(_preferences.AccentColour);

            Theme.ApplyStyle(overlay, true);
            SetContentView(_layout);
        }