Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-01-18 20:12:27 +01:00
commit b5431e7bc9
4 changed files with 19 additions and 3 deletions

View file

@ -185,8 +185,9 @@ public class SQLiteAPIImpl implements SQLiteAPI {
@Override @Override
public SQLiteConnection openByAbsolutePath(String path, boolean readOnly) { public SQLiteConnection openByAbsolutePath(String path, boolean readOnly) {
// fix http://stackoverflow.com/questions/26937152/workaround-for-nexus-9-sqlite-file-write-operations-on-external-dirs
android.database.sqlite.SQLiteDatabase db = SQLiteDatabase.openDatabase(path, null, android.database.sqlite.SQLiteDatabase db = SQLiteDatabase.openDatabase(path, null,
readOnly? SQLiteDatabase.OPEN_READONLY : SQLiteDatabase.OPEN_READWRITE); readOnly? SQLiteDatabase.OPEN_READONLY : (SQLiteDatabase.OPEN_READWRITE | SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING));
if(db == null) { if(db == null) {
return null; return null;
} }

View file

@ -48,6 +48,10 @@ public class WaypointHelper {
private static final int LONG_ANNOUNCE_RADIUS = 700; private static final int LONG_ANNOUNCE_RADIUS = 700;
private static final int SHORT_ANNOUNCE_RADIUS = 150; private static final int SHORT_ANNOUNCE_RADIUS = 150;
private static final int ALARMS_ANNOUNCE_RADIUS = 150; private static final int ALARMS_ANNOUNCE_RADIUS = 150;
// don't annoy users by lots of announcements
private static final int APPROACH_POI_LIMIT = 3;
private static final int ANNOUNCE_POI_LIMIT = 3;
OsmandApplication app; OsmandApplication app;
// every time we modify this collection, we change the reference (copy on write list) // every time we modify this collection, we change the reference (copy on write list)
@ -342,6 +346,9 @@ public class WaypointHelper {
kIterator++; kIterator++;
} }
if (!announcePoints.isEmpty()) { if (!announcePoints.isEmpty()) {
if(announcePoints.size() > ANNOUNCE_POI_LIMIT) {
announcePoints = announcePoints.subList(0, ANNOUNCE_POI_LIMIT);
}
if (type == WAYPOINTS) { if (type == WAYPOINTS) {
getVoiceRouter().announceWaypoint(announcePoints); getVoiceRouter().announceWaypoint(announcePoints);
} else if (type == POI) { } else if (type == POI) {
@ -353,6 +360,9 @@ public class WaypointHelper {
} }
} }
if (!approachPoints.isEmpty()) { if (!approachPoints.isEmpty()) {
if(approachPoints.size() > APPROACH_POI_LIMIT) {
approachPoints = approachPoints.subList(0, APPROACH_POI_LIMIT);
}
if (type == WAYPOINTS) { if (type == WAYPOINTS) {
getVoiceRouter().approachWaypoint(lastKnownLocation, approachPoints); getVoiceRouter().approachWaypoint(lastKnownLocation, approachPoints);
} else if (type == POI) { } else if (type == POI) {

View file

@ -54,7 +54,9 @@ public class BaseLocationIndexRepository<T extends MapObject> {
// close previous db // close previous db
db.close(); db.close();
} }
db = SQLiteDatabase.openOrCreateDatabase(file, null); // fix http://stackoverflow.com/questions/26937152/workaround-for-nexus-9-sqlite-file-write-operations-on-external-dirs
db = SQLiteDatabase.openDatabase(file.getPath(), null,
SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING| SQLiteDatabase.CREATE_IF_NECESSARY);
name = file.getName().substring(0, file.getName().indexOf('.')); name = file.getName().substring(0, file.getName().indexOf('.'));
if(db.getVersion() != version){ if(db.getVersion() != version){
db.close(); db.close();

View file

@ -49,7 +49,10 @@ public class HillshadeLayer extends MapTileLayer {
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
File tilesDir = app.getAppPath(IndexConstants.TILES_INDEX_DIR); File tilesDir = app.getAppPath(IndexConstants.TILES_INDEX_DIR);
sqliteDb = SQLiteDatabase.openOrCreateDatabase(new File(tilesDir, HILLSHADE_CACHE) , null); // fix http://stackoverflow.com/questions/26937152/workaround-for-nexus-9-sqlite-file-write-operations-on-external-dirs
sqliteDb = SQLiteDatabase.openDatabase(new File(tilesDir, HILLSHADE_CACHE).getPath() ,
null, SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING
| SQLiteDatabase.CREATE_IF_NECESSARY );
if(sqliteDb.getVersion() == 0) { if(sqliteDb.getVersion() == 0) {
sqliteDb.setVersion(1); sqliteDb.setVersion(1);
sqliteDb.execSQL("CREATE TABLE TILE_SOURCES(filename varchar2(256), date_modified int, left int, right int, top int, bottom int)"); sqliteDb.execSQL("CREATE TABLE TILE_SOURCES(filename varchar2(256), date_modified int, left int, right int, top int, bottom int)");