diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2012-05-30 21:04:07 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2012-05-30 21:04:07 +0200 |
| commit | 7e607f82e2acb252ab84ab2e1b33d4fc6c15132b (patch) | |
| tree | 8aadc223bedcccf9fd1acd5876bd861dbe1710ae /main/src | |
| parent | ea841463e2879c02f38a8426d92b88c4b41aae7b (diff) | |
| parent | a171744ae264fb91b442348235ee6a2474a3f240 (diff) | |
| download | cgeo-7e607f82e2acb252ab84ab2e1b33d4fc6c15132b.zip cgeo-7e607f82e2acb252ab84ab2e1b33d4fc6c15132b.tar.gz cgeo-7e607f82e2acb252ab84ab2e1b33d4fc6c15132b.tar.bz2 | |
Merge branch 'release' into upstream
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/StaticMapsProvider.java | 10 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgData.java | 31 |
2 files changed, 35 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/StaticMapsProvider.java b/main/src/cgeo/geocaching/StaticMapsProvider.java index cd17120..6de1291 100644 --- a/main/src/cgeo/geocaching/StaticMapsProvider.java +++ b/main/src/cgeo/geocaching/StaticMapsProvider.java @@ -41,11 +41,11 @@ public class StaticMapsProvider { } private static void downloadDifferentZooms(final String geocode, String markerUrl, String prefix, String latlonMap, int edge, final Parameters waypoints) { - downloadMap(geocode, 20, SATELLITE, markerUrl, prefix + "_1", "", latlonMap, edge, edge, waypoints); - downloadMap(geocode, 18, SATELLITE, markerUrl, prefix + "_2", "", latlonMap, edge, edge, waypoints); - downloadMap(geocode, 16, ROADMAP, markerUrl, prefix + "_3", "", latlonMap, edge, edge, waypoints); - downloadMap(geocode, 14, ROADMAP, markerUrl, prefix + "_4", "", latlonMap, edge, edge, waypoints); - downloadMap(geocode, 11, ROADMAP, markerUrl, prefix + "_5", "", latlonMap, edge, edge, waypoints); + downloadMap(geocode, 20, SATELLITE, markerUrl, prefix + '1', "", latlonMap, edge, edge, waypoints); + downloadMap(geocode, 18, SATELLITE, markerUrl, prefix + '2', "", latlonMap, edge, edge, waypoints); + downloadMap(geocode, 16, ROADMAP, markerUrl, prefix + '3', "", latlonMap, edge, edge, waypoints); + downloadMap(geocode, 14, ROADMAP, markerUrl, prefix + '4', "", latlonMap, edge, edge, waypoints); + downloadMap(geocode, 11, ROADMAP, markerUrl, prefix + '5', "", latlonMap, edge, edge, waypoints); } private static void downloadMap(String geocode, int zoom, String mapType, String markerUrl, String prefix, String shadow, String latlonMap, int width, int height, final Parameters waypoints) { diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 51b03f3..37f8b7d 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -30,6 +30,7 @@ import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteStatement; import java.io.File; +import java.io.FilenameFilter; import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -72,7 +73,7 @@ public class cgData { private static int[] cacheColumnIndex; private CacheCache cacheCache = new CacheCache(); private SQLiteDatabase database = null; - private static final int dbVersion = 62; + private static final int dbVersion = 63; public static final int customListIdOffset = 10; private static final String dbName = "data"; private static final String dbTableCaches = "cg_caches"; @@ -640,6 +641,14 @@ public class cgData { } } + if (oldVersion < 63) { + try { + removeDoubleUnderscoreMapFiles(); + } catch (Exception e) { + Log.e("Failed to upgrade to ver. 63: " + e.toString()); + + } + } } db.setTransactionSuccessful(); @@ -649,6 +658,26 @@ public class cgData { Log.i("Upgrade database from ver. " + oldVersion + " to ver. " + newVersion + ": completed"); } + + /** + * Method to remove static map files with double underscore due to issue#1670 + * introduced with release on 2012-05-24. + */ + private static void removeDoubleUnderscoreMapFiles() { + File[] geocodeDirs = LocalStorage.getStorage().listFiles(); + final FilenameFilter filter = new FilenameFilter() { + @Override + public boolean accept(File dir, String filename) { + return (filename.startsWith("map_") && filename.contains("__")); + } + }; + for (File dir : geocodeDirs) { + File[] wrongFiles = dir.listFiles(filter); + for (File wrongFile : wrongFiles) { + wrongFile.delete(); + } + } + } } /** |
