Issue 561:Voice prompt about GPS status in navigation mode (about lost GPS signal) 20 seconds delay. Issue about first voice prompt omitting.
This commit is contained in:
parent
a0b1e87ccf
commit
be0bdc7e9b
5 changed files with 81 additions and 15 deletions
|
@ -9,11 +9,12 @@ public class ToDoConstants {
|
|||
|
||||
|
||||
// == Osmand application (TODO 127) ==
|
||||
// TODO redesign Directions using GPX file! (One menu directions <-> switch 'Route')
|
||||
// TODO test if voice properly inititialized (first command!)
|
||||
// TODO replace icon for default mode (???)
|
||||
// TODO prepare C++ version of routing algorithm
|
||||
// TODO make transport search faster (cancellable.. )
|
||||
|
||||
// TODO Test Voice activity
|
||||
|
||||
// Map Refactoring
|
||||
// Remove notification from OsmAndMapTileView (?)
|
||||
|
||||
|
@ -40,16 +41,7 @@ public class ToDoConstants {
|
|||
|
||||
/////////////////////////// DONE //////////////////////////////
|
||||
// DONE ANDROID :
|
||||
// || 104 || Add activity to show current loaded indexes and information about them (Issue 366) ||
|
||||
// || 112 || Investigate exiting/minimizing app (Issue 214) ||
|
||||
// || 122 || Frozen sqlite db images (bug?). When images are loaded into sqlite the whole map is frozen (issue 413) ||
|
||||
// || 120 || Show icons over poi circle (issue 414) ||
|
||||
// || 119 || Dialog on main screen tips and tricks (Issue 415) ||
|
||||
// || 118 || Config switching between maps on different zoom levels <14 (using raster), > 14 vector (Issue 419) ||
|
||||
// || 124 || Animated transition using only raster images (?) - skip animations (!) - don not render vectoring for animations (Issue 238) ||
|
||||
// || 92 || Support poi index with standard map index and unify POI categories (unify done +, works very slow) (Issue 417) ||
|
||||
// || 97 || For voice navigation consider current speed of vehicle. Especially when speed > 50 pronounce more than 200 m (Issue 420) ||
|
||||
// || 123 || Improve gpx file showing (very slow for big files) (Issue 412) ||
|
||||
|
||||
// DONE SWING
|
||||
|
||||
}
|
||||
|
|
|
@ -88,6 +88,8 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
private static final float ACCURACY_FOR_GPX_AND_ROUTING = 50;
|
||||
|
||||
private static final int AUTO_FOLLOW_MSG_ID = 8;
|
||||
private static final int LOST_LOCATION_MSG_ID = 10;
|
||||
private static final long LOST_LOCATION_CHECK_DELAY = 20000;
|
||||
|
||||
private long lastTimeAutoZooming = 0;
|
||||
|
||||
|
@ -626,9 +628,25 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
if(routingHelper.isFollowingMode()){
|
||||
if(location == null ||
|
||||
!location.hasAccuracy() || location.getAccuracy() < ACCURACY_FOR_GPX_AND_ROUTING) {
|
||||
// Update routing position
|
||||
routingHelper.setCurrentLocation(location);
|
||||
// Check with delay that gps location is not lost
|
||||
if(location != null && routingHelper.getLeftDistance() > 0){
|
||||
Message msg = Message.obtain(uiHandler, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (routingHelper.getLeftDistance() > 0 && settings.MAP_ACTIVITY_ENABLED.get()) {
|
||||
routingHelper.getVoiceRouter().gpsLocationLost();
|
||||
}
|
||||
}
|
||||
});
|
||||
msg.what = LOST_LOCATION_MSG_ID;
|
||||
uiHandler.removeMessages(LOST_LOCATION_MSG_ID);
|
||||
uiHandler.sendMessageDelayed(msg, LOST_LOCATION_CHECK_DELAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (location != null) {
|
||||
if (isMapLinkedToLocation()) {
|
||||
if(settings.AUTO_ZOOM_MAP.get() && location.hasSpeed()){
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.osmand.plus.voice.CommandPlayer;
|
|||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.FloatMath;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -195,6 +196,7 @@ public class RoutingHelper {
|
|||
if(finalLocation == null || currentLocation == null){
|
||||
return;
|
||||
}
|
||||
|
||||
boolean calculateRoute = false;
|
||||
synchronized (this) {
|
||||
if(routeNodes.isEmpty() || routeNodes.size() <= currentRoute){
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.location.Location;
|
|||
|
||||
|
||||
public class VoiceRouter {
|
||||
// 0 - unknown, 1 - notify prepare, 2 - notify to turn after , 3 - notify to turn
|
||||
// 0 - unknown, 1 - notify to prepare, 2 - notify to turn in , 3 - notify to turn
|
||||
private final int STATUS_UNKNOWN = 0;
|
||||
private final int STATUS_3000_PREPARE = 1;
|
||||
private final int STATUS_800_PREPARE = 2;
|
||||
|
@ -38,6 +38,8 @@ public class VoiceRouter {
|
|||
protected int TURN_IN_DISTANCE = 0;
|
||||
protected int TURN_IN_DISTANCE_END = 0;
|
||||
protected int TURN_DISTANCE = 0;
|
||||
|
||||
protected VoiceCommandPending pendingCommand = null;
|
||||
|
||||
|
||||
public VoiceRouter(RoutingHelper router, CommandPlayer player) {
|
||||
|
@ -48,6 +50,13 @@ public class VoiceRouter {
|
|||
|
||||
public void setPlayer(CommandPlayer player) {
|
||||
this.player = player;
|
||||
if(pendingCommand != null && player != null){
|
||||
CommandBuilder newCommand = getNewCommandPlayerToPlay();
|
||||
if (newCommand != null) {
|
||||
pendingCommand.play(newCommand);
|
||||
}
|
||||
pendingCommand = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -318,6 +327,13 @@ public class VoiceRouter {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void gpsLocationLost(){
|
||||
CommandBuilder play = getNewCommandPlayerToPlay();
|
||||
if (play != null) {
|
||||
play.gpsLocationLost().play();
|
||||
}
|
||||
}
|
||||
|
||||
public void newRouteIsCalculated(boolean updateRoute) {
|
||||
CommandBuilder play = getNewCommandPlayerToPlay();
|
||||
|
@ -327,6 +343,9 @@ public class VoiceRouter {
|
|||
} else {
|
||||
play.newRouteCalculated(router.getLeftDistance()).play();
|
||||
}
|
||||
} else if(player == null){
|
||||
pendingCommand = new VoiceCommandPending(updateRoute ?
|
||||
VoiceCommandPending.ROUTE_RECALCULATED : VoiceCommandPending.ROUTE_CALCULATED, this);
|
||||
}
|
||||
currentDirection = router.currentDirectionInfo;
|
||||
currentStatus = 0;
|
||||
|
@ -339,11 +358,40 @@ public class VoiceRouter {
|
|||
}
|
||||
}
|
||||
|
||||
public void onApplicationTerminate(Context ctx)
|
||||
{
|
||||
public void onApplicationTerminate(Context ctx) {
|
||||
if (player != null) {
|
||||
player.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Command to wait until voice player is initialized
|
||||
*/
|
||||
private static class VoiceCommandPending {
|
||||
public static final int ROUTE_CALCULATED = 1;
|
||||
public static final int ROUTE_RECALCULATED = 2;
|
||||
protected final long timestamp;
|
||||
protected final int type;
|
||||
private final VoiceRouter voiceRouter;
|
||||
|
||||
public VoiceCommandPending(int type, VoiceRouter voiceRouter){
|
||||
this.type = type;
|
||||
this.voiceRouter = voiceRouter;
|
||||
timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void play(CommandBuilder newCommand) {
|
||||
int left = voiceRouter.router.getLeftDistance();
|
||||
if (left > 0) {
|
||||
if (type == ROUTE_CALCULATED) {
|
||||
newCommand.newRouteCalculated(left).play();
|
||||
} else if (type == ROUTE_RECALCULATED) {
|
||||
newCommand.routeRecalculated(left).play();
|
||||
}
|
||||
}
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ public class CommandBuilder {
|
|||
protected static final String C_BEAR_RIGHT = "bear_right"; //$NON-NLS-1$
|
||||
protected static final String C_ROUTE_RECALC = "route_recalc"; //$NON-NLS-1$
|
||||
protected static final String C_ROUTE_NEW_CALC = "route_new_calc"; //$NON-NLS-1$
|
||||
protected static final String C_LOCATION_LOST = "location_lost"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -157,6 +158,10 @@ public class CommandBuilder {
|
|||
return addCommand(C_THEN);
|
||||
}
|
||||
|
||||
public CommandBuilder gpsLocationLost() {
|
||||
return addCommand(C_LOCATION_LOST);
|
||||
}
|
||||
|
||||
public CommandBuilder newRouteCalculated(double dist){
|
||||
return addCommand(C_ROUTE_NEW_CALC, dist);
|
||||
}
|
||||
|
@ -175,5 +180,6 @@ public class CommandBuilder {
|
|||
alreadyExecuted = true;
|
||||
return this.commandPlayer.execute(listStruct);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in a new issue