From a570bedeb83e828f006ca723b421ebe6a90c0e2b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 22 May 2014 10:55:38 +0300 Subject: [PATCH 1/3] Fixed usages of SettingsAPI in OsmandSettings --- OsmAnd/src/net/osmand/plus/OsmandSettings.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 1d165b248f..3766b5154a 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -110,14 +110,13 @@ public class OsmandSettings { protected OsmandSettings(OsmandApplication clientContext, SettingsAPI settinsAPI) { ctx = clientContext; this.settingsAPI = settinsAPI; - - globalPreferences = settingsAPI.getPreferenceObject(SHARED_PREFERENCES_NAME); - // start from default settings - currentMode = ApplicationMode.DEFAULT; - - defaultProfilePreferences = getProfilePreferences(ApplicationMode.DEFAULT); - profilePreferences = defaultProfilePreferences; currentMode = readApplicationMode(); + initPrefs(); + } + + private void initPrefs() { + globalPreferences = settingsAPI.getPreferenceObject(SHARED_PREFERENCES_NAME); + defaultProfilePreferences = getProfilePreferences(ApplicationMode.DEFAULT); profilePreferences = getProfilePreferences(currentMode); } @@ -127,6 +126,7 @@ public class OsmandSettings { public void setSettingsAPI(SettingsAPI settingsAPI) { this.settingsAPI = settingsAPI; + initPrefs(); } public SettingsAPI getSettingsAPI() { From 9cbd583ff0e1a7236031997ed956eda7eb56dc31 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 May 2014 23:34:55 +0300 Subject: [PATCH 2/3] Application mode should be updated on SettingsAPI change --- OsmAnd/src/net/osmand/plus/OsmandSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 84cc9deeca..dfdf86297c 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -110,13 +110,13 @@ public class OsmandSettings { protected OsmandSettings(OsmandApplication clientContext, SettingsAPI settinsAPI) { ctx = clientContext; this.settingsAPI = settinsAPI; - currentMode = readApplicationMode(); initPrefs(); } private void initPrefs() { globalPreferences = settingsAPI.getPreferenceObject(SHARED_PREFERENCES_NAME); defaultProfilePreferences = getProfilePreferences(ApplicationMode.DEFAULT); + currentMode = readApplicationMode(); profilePreferences = getProfilePreferences(currentMode); } From c1a97a8517338a2c17260e17c80a214ea3ecb3ee Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 May 2014 23:36:09 +0300 Subject: [PATCH 3/3] Loading application settings on tour deselect --- OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java index 35ef935ed6..3c467133bf 100644 --- a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java +++ b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java @@ -113,6 +113,9 @@ public class SherpafyCustomization extends OsmAndAppCustomization { } } } + if (selectedName == null) { + app.getSettings().setSettingsAPI(originalSettings.getSettingsAPI()); + } } } this.tourPresent = tourPresent;