Merge branch 'r3.7'
This commit is contained in:
commit
368172f97c
1 changed files with 20 additions and 13 deletions
|
@ -82,21 +82,28 @@ public class TerrainLayer extends MapTileLayer {
|
||||||
File tilesDir = app.getAppPath(IndexConstants.TILES_INDEX_DIR);
|
File tilesDir = app.getAppPath(IndexConstants.TILES_INDEX_DIR);
|
||||||
File cacheDir = app.getCacheDir();
|
File cacheDir = app.getCacheDir();
|
||||||
// fix http://stackoverflow.com/questions/26937152/workaround-for-nexus-9-sqlite-file-write-operations-on-external-dirs
|
// fix http://stackoverflow.com/questions/26937152/workaround-for-nexus-9-sqlite-file-write-operations-on-external-dirs
|
||||||
sqliteDb = SQLiteDatabase.openDatabase(
|
try {
|
||||||
new File(cacheDir, mode == HILLSHADE ? HILLSHADE_CACHE : SLOPE_CACHE).getPath(),
|
sqliteDb = SQLiteDatabase.openDatabase(
|
||||||
null, SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING
|
new File(cacheDir, mode == HILLSHADE ? HILLSHADE_CACHE : SLOPE_CACHE).getPath(),
|
||||||
| SQLiteDatabase.CREATE_IF_NECESSARY );
|
null, SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING
|
||||||
if (sqliteDb.getVersion() == 0) {
|
| SQLiteDatabase.CREATE_IF_NECESSARY);
|
||||||
sqliteDb.setVersion(1);
|
} catch (RuntimeException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
sqliteDb = null;
|
||||||
}
|
}
|
||||||
sqliteDb.execSQL("CREATE TABLE IF NOT EXISTS TILE_SOURCES(filename varchar2(256), date_modified int, left int, right int, top int, bottom int)");
|
if (sqliteDb != null) {
|
||||||
|
if (sqliteDb.getVersion() == 0) {
|
||||||
|
sqliteDb.setVersion(1);
|
||||||
|
}
|
||||||
|
sqliteDb.execSQL("CREATE TABLE IF NOT EXISTS TILE_SOURCES(filename varchar2(256), date_modified int, left int, right int, top int, bottom int)");
|
||||||
|
|
||||||
Map<String, Long> fileModified = new HashMap<String, Long>();
|
Map<String, Long> fileModified = new HashMap<String, Long>();
|
||||||
Map<String, SQLiteTileSource> rs = readFiles(app, tilesDir, fileModified);
|
Map<String, SQLiteTileSource> rs = readFiles(app, tilesDir, fileModified);
|
||||||
indexCachedResources(fileModified, rs);
|
indexCachedResources(fileModified, rs);
|
||||||
indexNonCachedResources(fileModified, rs);
|
indexNonCachedResources(fileModified, rs);
|
||||||
sqliteDb.close();
|
sqliteDb.close();
|
||||||
resources = rs;
|
resources = rs;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue