Add voice warnings (preparation)
This commit is contained in:
parent
47d52b7324
commit
d69ec3559f
9 changed files with 47 additions and 6 deletions
|
@ -9,6 +9,11 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="speak_warnings_title">Announce alarms…</string>
|
||||
<string name="speak_warnings_descr">Configure traffic warnings (forced stops, speed bumps), speed camera warnings, speed limits</string>
|
||||
<string name="speak_speed_limit">Announce speed limit</string>
|
||||
<string name="speak_cameras">Announce speed cameras</string>
|
||||
<string name="speak_traffic_warnings">Announce traffic warnings</string>
|
||||
<string name="local_index_gpx_timespan">\nTime span: %1$d:%2$02d:%3$02d</string>
|
||||
<string name="local_index_gpx_timemoving">\nTime moving: %1$d:%2$02d:%3$02d</string>
|
||||
<string name="app_mode_default">Browse map</string>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<CheckBoxPreference android:title="@string/auto_zoom_map" android:summary="@string/auto_zoom_map_descr" android:key="auto_zoom_map"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:title="@string/snap_to_road" android:summary="@string/snap_to_road_descr" android:key="snap_to_road"></CheckBoxPreference>
|
||||
<Preference android:title="@string/show_warnings_title" android:summary="@string/show_warnings_descr" android:key="show_routing_alarms"/>
|
||||
<Preference android:title="@string/speak_warnings_title" android:summary="@string/speak_warnings_descr" android:key="speak_routing_alarms"/>
|
||||
<Preference android:title="@string/avoid_in_routing_title" android:summary="@string/avoid_in_routing_descr" android:key="avoid_in_routing"/>
|
||||
<Preference android:title="@string/prefer_in_routing_title" android:summary="@string/prefer_in_routing_descr" android:key="prefer_in_routing"/>
|
||||
<CheckBoxPreference android:summary="@string/use_compass_navigation_descr" android:title="@string/use_compass_navigation"
|
||||
|
|
|
@ -682,6 +682,10 @@ public class OsmandSettings {
|
|||
public final OsmandPreference<Boolean> SHOW_TRAFFIC_WARNINGS = new BooleanPreference("show_traffic_warnings", true).makeProfile().cache();
|
||||
public final OsmandPreference<Boolean> SHOW_CAMERAS = new BooleanPreference("show_cameras", true).makeProfile().cache();
|
||||
public final OsmandPreference<Boolean> SHOW_LANES = new BooleanPreference("show_lanes", true).makeProfile().cache();
|
||||
|
||||
public final OsmandPreference<Boolean> SPEAK_TRAFFIC_WARNINGS = new BooleanPreference("speak_traffic_warnings", true).makeProfile().cache();
|
||||
public final OsmandPreference<Boolean> SPEAK_SPEAD_CAMERAS = new BooleanPreference("speak_cameras", true).makeProfile().cache();
|
||||
public final OsmandPreference<Boolean> SPEAK_SPEED_LIMIT = new BooleanPreference("speak_speed_limit", true).makeProfile().cache();
|
||||
|
||||
public final OsmandPreference<Boolean> AVOID_TOLL_ROADS = new BooleanPreference("avoid_toll_roads", false).makeProfile().cache();
|
||||
public final OsmandPreference<Boolean> AVOID_MOTORWAY = new BooleanPreference("avoid_motorway", false).makeProfile().cache();
|
||||
|
|
|
@ -25,6 +25,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
private Preference avoidRouting;
|
||||
private Preference preferRouting;
|
||||
private Preference showAlarms;
|
||||
private Preference speakAlarms;
|
||||
private ListPreference routerServicePreference;
|
||||
public static final String MORE_VALUE = "MORE_VALUE";
|
||||
|
||||
|
@ -91,6 +92,9 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
|
||||
showAlarms = (Preference) screen.findPreference("show_routing_alarms");
|
||||
showAlarms.setOnPreferenceClickListener(this);
|
||||
|
||||
speakAlarms = (Preference) screen.findPreference("speak_routing_alarms");
|
||||
speakAlarms.setOnPreferenceClickListener(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,6 +171,11 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
getString(R.string.show_lanes) }, new OsmandPreference[] { settings.SHOW_TRAFFIC_WARNINGS,
|
||||
settings.SHOW_CAMERAS, settings.SHOW_LANES });
|
||||
return true;
|
||||
} else if (preference == speakAlarms) {
|
||||
showBooleanSettings(new String[] { getString(R.string.speak_traffic_warnings), getString(R.string.speak_cameras),
|
||||
getString(R.string.speak_speed_limit) }, new OsmandPreference[] { settings.SPEAK_TRAFFIC_WARNINGS,
|
||||
settings.SPEAK_SPEAD_CAMERAS , settings.SPEAK_SPEED_LIMIT});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public class TestVoiceActivity extends SherlockActivity {
|
|||
addButton(ll, "When possible, make a U-turn", builder(p).makeUTwp());
|
||||
addButton(ll, "Prepare to enter a roundabout after 750m", builder(p).prepareRoundAbout(750));
|
||||
addButton(ll, "After 450m enter the roundabout and take the 1st exit", builder(p).roundAbout(450, 0, 1));
|
||||
addButton(ll, "Roundabout: Take the 3rd exit", builder(p).roundAbout(0, 3));
|
||||
addButton(ll, "Roundabout: Take the 2th exit", builder(p).roundAbout(0, 2));
|
||||
addButton(ll, "GPS signal lost", builder(p).gpsLocationLost());
|
||||
addButton(ll, "Route recalculated (23150m)", builder(p).routeRecalculated(23150));
|
||||
addButton(ll, "Continue straight ahead", builder(p).goAhead());
|
||||
|
@ -106,6 +106,8 @@ public class TestVoiceActivity extends SherlockActivity {
|
|||
addButton(ll, "Arrive at waypoint", builder(p).arrivedAtIntermediatePoint());
|
||||
addButton(ll, "Follow the road for 800m and arrive at destination", builder(p).goAhead(800).andArriveAtDestination());
|
||||
addButton(ll, "Arrive at destination", builder(p).arrivedAtDestination());
|
||||
addButton(ll, "You exceed speed limit", builder(p).speedAlarm());
|
||||
addButton(ll, "Attention (bump, speed camera)", builder(p).attention());
|
||||
ll.forceLayout();
|
||||
}
|
||||
|
||||
|
|
|
@ -538,18 +538,18 @@ public class RoutingHelper {
|
|||
AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, lastProjection);
|
||||
AlarmInfo alarm = route.getMostImportantAlarm(lastProjection, speedAlarm, showCameras);
|
||||
if(alarm != null) {
|
||||
// voiceRouter.announceAlarm(alarm);
|
||||
voiceRouter.announceAlarm(alarm);
|
||||
}
|
||||
return alarm;
|
||||
|
||||
}
|
||||
|
||||
public static AlarmInfo calculateMostImportantAlarm(RouteDataObject ro, Location loc,
|
||||
public AlarmInfo calculateMostImportantAlarm(RouteDataObject ro, Location loc,
|
||||
MetricsConstants mc, boolean showCameras) {
|
||||
float mxspeed = ro.getMaximumSpeed();
|
||||
AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, loc);
|
||||
if (speedAlarm != null) {
|
||||
// voiceRouter.announceAlarm(speedAlarm);
|
||||
voiceRouter.announceAlarm(speedAlarm);
|
||||
return speedAlarm;
|
||||
}
|
||||
for (int i = 0; i < ro.getPointsLength(); i++) {
|
||||
|
@ -561,7 +561,7 @@ public class RoutingHelper {
|
|||
AlarmInfo info = AlarmInfo.createAlarmInfo(typeRule, 0);
|
||||
if (info != null) {
|
||||
if (info.getType() != AlarmInfo.SPEED_CAMERA || showCameras) {
|
||||
// voiceRouter.announceAlarm(info);
|
||||
voiceRouter.announceAlarm(info);
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,6 +178,12 @@ public class VoiceRouter {
|
|||
|
||||
}
|
||||
|
||||
|
||||
public void announceAlarm(AlarmInfo alarm) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates status of voice guidance
|
||||
* @param currentLocation
|
||||
|
@ -522,4 +528,5 @@ public class VoiceRouter {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -638,7 +638,7 @@ public class RouteInfoWidgetsFactory {
|
|||
RouteDataObject ro = locationProvider.getLastKnownRouteSegment();
|
||||
Location loc = locationProvider.getLastKnownLocation();
|
||||
if(ro != null && loc != null) {
|
||||
alarm = RoutingHelper.calculateMostImportantAlarm(ro, loc, settings.METRIC_SYSTEM.get(), cams);
|
||||
alarm = rh.calculateMostImportantAlarm(ro, loc, settings.METRIC_SYSTEM.get(), cams);
|
||||
} else {
|
||||
alarm = null;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,9 @@ public class CommandBuilder {
|
|||
protected static final String C_AND_ARRIVE_INTERMEDIATE = "and_arrive_intermediate"; //$NON-NLS-1$
|
||||
protected static final String C_REACHED_INTERMEDIATE = "reached_intermediate"; //$NON-NLS-1$
|
||||
protected static final String C_THEN = "then"; //$NON-NLS-1$
|
||||
protected static final String C_SPEAD_ALARM = "speed_alarm"; //$NON-NLS-1$
|
||||
protected static final String C_ATTENTION = "attention"; //$NON-NLS-1$
|
||||
|
||||
|
||||
protected static final String C_BEAR_LEFT = "bear_left"; //$NON-NLS-1$
|
||||
protected static final String C_BEAR_RIGHT = "bear_right"; //$NON-NLS-1$
|
||||
|
@ -107,6 +110,16 @@ public class CommandBuilder {
|
|||
return addCommand(C_MAKE_UT);
|
||||
}
|
||||
|
||||
public CommandBuilder speedAlarm(){
|
||||
return addCommand(C_SPEAD_ALARM);
|
||||
}
|
||||
|
||||
public CommandBuilder attention(){
|
||||
return addCommand(C_ATTENTION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public CommandBuilder makeUT(double dist){
|
||||
return addCommand(C_MAKE_UT, dist);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue