Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            _updatedThemeOnCreate = true;
            UpdateTheme();

            BaseApplication = (BaseApplication)Application;

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

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

            Theme.ApplyStyle(overlay, true);

            SetContentView(_layout);
        }
Пример #2
0
        private void SetRightTheme()
        {
            if (Settings.SelectedTheme == 1)
            {
                switch (AndroidColourThemeHelper.CurrentTheme)
                {
                case AndroidColorThemes.Orange:
                    SetTheme(Resource.Style.Theme_MALClient_Dark_Orange);
                    break;

                case AndroidColorThemes.Purple:
                    SetTheme(Resource.Style.Theme_MALClient_Dark_Purple);
                    break;

                case AndroidColorThemes.Blue:
                    SetTheme(Resource.Style.Theme_MALClient_Dark_Blue);
                    break;

                case AndroidColorThemes.Lime:
                    SetTheme(Resource.Style.Theme_MALClient_Dark_Lime);
                    break;

                case AndroidColorThemes.Pink:
                    SetTheme(Resource.Style.Theme_MALClient_Dark_Pink);
                    break;

                case AndroidColorThemes.Cyan:
                    SetTheme(Resource.Style.Theme_MALClient_Dark_Cyan);
                    break;

                case AndroidColorThemes.SkyBlue:
                    SetTheme(Resource.Style.Theme_MALClient_Dark_SkyBlue);
                    break;

                case AndroidColorThemes.Red:
                    SetTheme(Resource.Style.Theme_MALClient_Dark_Red);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                if (Settings.DarkThemeAmoled)
                {
                    Theme.ApplyStyle(Resource.Style.BlackTheme, true);
                    IsAmoledApplied = true;
                }
                else
                {
                    IsAmoledApplied = false;
                }
            }
            else
            {
                switch (AndroidColourThemeHelper.CurrentTheme)
                {
                case AndroidColorThemes.Orange:
                    SetTheme(Resource.Style.Theme_MALClient_Light_Orange);
                    break;

                case AndroidColorThemes.Purple:
                    SetTheme(Resource.Style.Theme_MALClient_Light_Purple);
                    break;

                case AndroidColorThemes.Blue:
                    SetTheme(Resource.Style.Theme_MALClient_Light_Blue);
                    break;

                case AndroidColorThemes.Lime:
                    SetTheme(Resource.Style.Theme_MALClient_Light_Lime);
                    break;

                case AndroidColorThemes.Pink:
                    SetTheme(Resource.Style.Theme_MALClient_Light_Pink);
                    break;

                case AndroidColorThemes.Cyan:
                    SetTheme(Resource.Style.Theme_MALClient_Light_Cyan);
                    break;

                case AndroidColorThemes.SkyBlue:
                    SetTheme(Resource.Style.Theme_MALClient_Light_SkyBlue);
                    break;

                case AndroidColorThemes.Red:
                    SetTheme(Resource.Style.Theme_MALClient_Light_Red);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
Пример #3
0
        public void SetAppTheme(
            AppThemeType appTheme,
            string appHexAccentColor,
            bool useDarkAmoled,
            bool restartActivity = false)
        {
            appHexAccentColor = appHexAccentColor.ToLower();
            if (appTheme == AppThemeType.DARK)
            {
                switch (appHexAccentColor)
                {
                case AppConstants.AccentColorLightBlue:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_LightBlue);
                    break;

                case AppConstants.AccentColorLimeGreen:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_LimeGreen);
                    break;

                case AppConstants.AccentColorDarkOrange:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_DarkOrange);
                    break;

                case AppConstants.AccentColorVividRed:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_VividRed);
                    break;

                case AppConstants.AccentColorDarkCyan:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_DarkCyan);
                    break;

                case AppConstants.AccentColorDarkGreen:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_DarkGreen);
                    break;

                case AppConstants.AccentColorDarkMagenta:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_DarkMagenta);
                    break;

                case AppConstants.AccentColorMagenta:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_Magenta);
                    break;

                case AppConstants.AccentColorDarkGray:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_DarkGray);
                    break;

                case AppConstants.AccentColorOrange:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_Orange);
                    break;

                case AppConstants.AccentColorYellow:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_Yellow);
                    break;

                case AppConstants.AccentColorDarkBlue:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_DarkBlue);
                    break;

                case AppConstants.AccentColorViolet:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_Violet);
                    break;

                case AppConstants.AccentColorLightGrey:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Dark_LightGrey);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(appHexAccentColor), appHexAccentColor, "Invalid accent theme");
                }
            }
            else
            {
                switch (appHexAccentColor)
                {
                case AppConstants.AccentColorLightBlue:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_LightBlue);
                    break;

                case AppConstants.AccentColorLimeGreen:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_LimeGreen);
                    break;

                case AppConstants.AccentColorDarkOrange:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_DarkOrange);
                    break;

                case AppConstants.AccentColorVividRed:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_VividRed);
                    break;

                case AppConstants.AccentColorDarkCyan:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_DarkCyan);
                    break;

                case AppConstants.AccentColorDarkGreen:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_DarkGreen);
                    break;

                case AppConstants.AccentColorDarkMagenta:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_DarkMagenta);
                    break;

                case AppConstants.AccentColorMagenta:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_Magenta);
                    break;

                case AppConstants.AccentColorDarkGray:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_DarkGray);
                    break;

                case AppConstants.AccentColorOrange:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_Orange);
                    break;

                case AppConstants.AccentColorYellow:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_Yellow);
                    break;

                case AppConstants.AccentColorDarkBlue:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_DarkBlue);
                    break;

                case AppConstants.AccentColorViolet:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_Violet);
                    break;

                case AppConstants.AccentColorLightGrey:
                    SetTheme(Resource.Style.Theme_MiraiNotes_Light_LightGrey);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(appHexAccentColor), appHexAccentColor, "Invalid accent theme");
                }
            }

            if (useDarkAmoled && appTheme == AppThemeType.DARK)
            {
                Theme.ApplyStyle(Resource.Style.BlackTheme, true);
            }

            if (!restartActivity)
            {
                return;
            }

            RestartActivity();
        }