private void Update() { if (ThemeManager.instance.theme != initialTheme) { UpdateSprite(); initialTheme = ThemeManager.instance.theme; } }
public void OnThemeChanged(ThemeManager.Themes theme) { //Some attempts to restart activity without loosing Fragments inside it. //currently all options restarts the app from Main DashboardPage. /* * var f = GetVisibleFragment(); * f.Activity.Recreate(); */ /* * Intent intent = new Intent(f.Context, typeof(MainActivity)); * intent.SetFlags(ActivityFlags.ClearTask); * f.Context.StartActivity(intent); */ /* * Android.Support.V4.App.FragmentTransaction ft = MainActivity.Instance.SupportFragmentManager.BeginTransaction(); * ft.Detach(f); * ft.Attach(f); * ft.Commit(); */ MainActivity activity = MainActivity.Instance; var intent = MainActivity.Instance.Intent; activity.Finish(); activity.StartActivity(intent); /*Bundle savedInstanceState = new Bundle(); * ////this is important to save all your open states/fragment states * MainActivity.Instance.OnSaveInstanceState(savedInstanceState); * MainActivity.Instance.Recreate(); * MainActivity.Instance.OnCreate(savedInstanceState, null); */ /*Intent i = MainActivity.Instance.Intent; * MainActivity.Instance.OverridePendingTransition(0, 0); * i.AddFlags(ActivityFlags.NoAnimation); * MainActivity.Instance.Finish(); * //restart the activity without animation * MainActivity.Instance.OverridePendingTransition(0, 0); * MainActivity.Instance.StartActivity(i);*/ }
public void OnThemeChanged(ThemeManager.Themes theme) { App.ApplyThemedColors(); }
private void Start() { UpdateSprite(); initialTheme = ThemeManager.instance.theme; }