From 04c5c6072358ccb56249be827fe26eaa062cc15a Mon Sep 17 00:00:00 2001 From: max-klaus Date: Tue, 12 Nov 2019 18:10:55 +0300 Subject: [PATCH] Change theme after pref switch --- .../net/osmand/plus/settings/BaseSettingsFragment.java | 4 ++++ .../plus/settings/GeneralProfileSettingsFragment.java | 9 +++++++++ .../ChangeGeneralProfilesPrefBottomSheet.java | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java index 2fdd8b2c78..8d5b5849b9 100644 --- a/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java @@ -450,6 +450,10 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl } } + public void updateSetting(String prefId) { + updateAllSettings(); + } + public void updateAllSettings() { PreferenceScreen screen = getPreferenceScreen(); if (screen != null) { diff --git a/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java index fdaa8da7eb..90672968aa 100644 --- a/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java @@ -402,4 +402,13 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme } } } + + @Override + public void updateSetting(String prefId) { + if (settings.OSMAND_THEME.getId().equals(prefId)) { + recreate(); + return; + } + super.updateSetting(prefId); + } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/ChangeGeneralProfilesPrefBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/ChangeGeneralProfilesPrefBottomSheet.java index b336b668b4..2c86c1d381 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/ChangeGeneralProfilesPrefBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/ChangeGeneralProfilesPrefBottomSheet.java @@ -107,7 +107,7 @@ public class ChangeGeneralProfilesPrefBottomSheet extends BasePreferenceBottomSh private void updateTargetSettings(boolean discard) { BaseSettingsFragment target = (BaseSettingsFragment) getTargetFragment(); if (target != null) { - target.updateAllSettings(); + target.updateSetting(getPrefId()); if (!discard) { if (target.shouldDismissOnChange()) { target.dismiss();