If no streets found, select building

This commit is contained in:
vshcherb 2013-08-23 21:41:41 +02:00
parent 0590943dd5
commit c9ec000af7
4 changed files with 16 additions and 9 deletions

View file

@ -44,6 +44,7 @@ public class SearchBuildingByNameActivity extends SearchByNameAbstractActivity<B
if (result == null || result.isEmpty()) { if (result == null || result.isEmpty()) {
Toast.makeText(SearchBuildingByNameActivity.this, Toast.makeText(SearchBuildingByNameActivity.this,
R.string.no_buildings_found, Toast.LENGTH_LONG).show(); R.string.no_buildings_found, Toast.LENGTH_LONG).show();
quitActivity(SearchStreet2ByNameActivity.class);
} }
} }

View file

@ -216,11 +216,11 @@ public class SearchStreetByNameActivity extends SearchByNameAbstractActivity<Str
settings.setLastSearchedCity(obj.getCity().getId(), obj.getCity().getName(), obj.getLocation()); settings.setLastSearchedCity(obj.getCity().getId(), obj.getCity().getName(), obj.getLocation());
} }
settings.setLastSearchedStreet(obj.getName(region.useEnglishNames()), obj.getLocation()); settings.setLastSearchedStreet(obj.getName(region.useEnglishNames()), obj.getLocation());
if(obj.getBuildings().size() == 0){ // if(obj.getBuildings().size() == 0){
quitActivity(null); // quitActivity(null);
} else { // } else {
quitActivity(SearchBuildingByNameActivity.class); quitActivity(SearchBuildingByNameActivity.class);
} // }
} }
} }

View file

@ -632,7 +632,7 @@ public class RoutingHelper {
} else if(name != null && name.length() > 0){ } else if(name != null && name.length() > 0){
if(ref != null && ref.length() > 0) { if(ref != null && ref.length() > 0) {
name = ref + " " + name; name = ref + " " + name;
} } getCurrentSegmentResult
return name; return name;
} else { } else {
if(ref == null) { if(ref == null) {
@ -650,7 +650,7 @@ public class RoutingHelper {
String dn = n.directionInfo.getDestinationName(); String dn = n.directionInfo.getDestinationName();
return formatStreetName(nm, rf, dn); return formatStreetName(nm, rf, dn);
} }
RouteSegmentResult rs = route.getCurrentSegmentResult(); RouteSegmentResult rs = getCurrentSegmentResult();
if(rs != null) { if(rs != null) {
String nm = rs.getObject().getName(); String nm = rs.getObject().getName();
String rf = rs.getObject().getRef(); String rf = rs.getObject().getRef();
@ -660,7 +660,11 @@ public class RoutingHelper {
return null; return null;
} }
public synchronized NextDirectionInfo getNextRouteDirectionInfoAfter(NextDirectionInfo previous, NextDirectionInfo to, boolean toSpeak){ public RouteSegmentResult getCurrentSegmentResult() {
return route.getCurrentSegmentResult();
}
public synchronized NextDirectionInfo getNextRouteDirectionInfoAfter(NextDirectionInfo previous, NextDirectionInfo to, boolean toSpeak){
NextDirectionInfo i = route.getNextRouteDirectionInfoAfter(previous, to, toSpeak); NextDirectionInfo i = route.getNextRouteDirectionInfoAfter(previous, to, toSpeak);
if(i != null) { if(i != null) {
i.imminent = voiceRouter.calculateImminent(i.distanceTo, null); i.imminent = voiceRouter.calculateImminent(i.distanceTo, null);

View file

@ -9,6 +9,7 @@ import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo;
import net.osmand.plus.voice.AbstractPrologCommandPlayer; import net.osmand.plus.voice.AbstractPrologCommandPlayer;
import net.osmand.plus.voice.CommandBuilder; import net.osmand.plus.voice.CommandBuilder;
import net.osmand.plus.voice.CommandPlayer; import net.osmand.plus.voice.CommandPlayer;
import net.osmand.router.RouteSegmentResult;
import net.osmand.router.TurnType; import net.osmand.router.TurnType;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -271,7 +272,8 @@ public class VoiceRouter {
NextDirectionInfo nextInfo = router.getNextRouteDirectionInfo(new NextDirectionInfo(), true); NextDirectionInfo nextInfo = router.getNextRouteDirectionInfo(new NextDirectionInfo(), true);
// after last turn say: RouteSegmentResult currentSegment = router.getCurrentSegmentResult();
// after last turn say:
if (nextInfo == null || nextInfo.directionInfo == null || nextInfo.directionInfo.distance == 0) { if (nextInfo == null || nextInfo.directionInfo == null || nextInfo.directionInfo.distance == 0) {
// if(currentStatus <= STATUS_UNKNOWN && currentDirection > 0){ This caused this prompt to be suppressed when coming back from a // if(currentStatus <= STATUS_UNKNOWN && currentDirection > 0){ This caused this prompt to be suppressed when coming back from a
if (repeat || currentStatus <= STATUS_UNKNOWN) { if (repeat || currentStatus <= STATUS_UNKNOWN) {