From fcec2c20f3bdbf46b70cb33e496dc08d82bf3901 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 4 Sep 2014 12:37:44 +0300 Subject: [PATCH] FIxed bug with wrong directory for app customization --- .../src/net/osmand/plus/OsmAndAppCustomization.java | 4 ++++ OsmAnd/src/net/osmand/plus/OsmandApplication.java | 3 ++- .../osmand/plus/sherpafy/SherpafyCustomization.java | 11 ++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java index 80415aeee3..620a5fa20f 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java @@ -178,4 +178,8 @@ public class OsmAndAppCustomization { public int getWaypointSearchRadius(int searchDeviationRadius, int type) { return searchDeviationRadius; } + + public File getExternalStorageDir() { + return osmandSettings.getExternalStorageDirectory(); + } } diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 9276049e94..b25fd1ce98 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -750,7 +750,8 @@ public class OsmandApplication extends Application { if(path == null) { path = ""; } - return new File(getSettings().getExternalStorageDirectory(), IndexConstants.APP_DIR + path); + + return new File(getAppCustomization().getExternalStorageDir(), IndexConstants.APP_DIR + path); } public void applyTheme(Context c) { diff --git a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java index 96c0e5bf93..cacb1fa4bf 100644 --- a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java +++ b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Map; import java.util.TreeSet; +import android.os.Environment; import android.widget.Toast; import net.osmand.IProgress; import net.osmand.IndexConstants; @@ -79,7 +80,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization { private CommonPreference saveGPXFolder; public static final String TOUR_SERVER = "download.osmand.net"; private static final String SAVE_GPX_FOLDER = "save_gpx_folder"; - private Object originalGlobal; + private Object originalGlobal; @Override public void setup(OsmandApplication app) { @@ -92,6 +93,14 @@ public class SherpafyCustomization extends OsmAndAppCustomization { } accessCodePref = osmandSettings.registerStringPreference(ACCESS_CODE, "").makeGlobal(); toursFolder = new File(osmandSettings.getExternalStorageDirectory(), "osmand/tours"); + + } + + @Override + public File getExternalStorageDir() { + final String defaultLocation = Environment.getExternalStorageDirectory().getAbsolutePath(); + return new File(originalApi.getString(originalGlobal, OsmandSettings.EXTERNAL_STORAGE_DIR, + defaultLocation)); } public boolean setAccessCode(String acCode) {