Added setting to set speed limit
This commit is contained in:
parent
fa0a23450b
commit
f6e5f78a23
5 changed files with 37 additions and 5 deletions
|
@ -9,6 +9,8 @@
|
||||||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
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
|
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="speed_limit_exceed">Speed limit exceed value.</string>
|
||||||
|
<string name ="speed_limit_exceed_message">Select speed limit exceed value on which you will get voice announcement.</string>
|
||||||
<string name="fav_point_emoticons_message">We changed your favorite point name to %1$s because it is not possible to save string with emoticons to file.</string>
|
<string name="fav_point_emoticons_message">We changed your favorite point name to %1$s because it is not possible to save string with emoticons to file.</string>
|
||||||
<string name="print_route">Print route</string>
|
<string name="print_route">Print route</string>
|
||||||
<string name="test_native_render">Test native render</string>
|
<string name="test_native_render">Test native render</string>
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
android:key="arrival_distance_factor"
|
android:key="arrival_distance_factor"
|
||||||
android:title="@string/arrival_distance"
|
android:title="@string/arrival_distance"
|
||||||
android:summary="@string/arrival_distance_descr" />
|
android:summary="@string/arrival_distance_descr" />
|
||||||
|
<ListPreference
|
||||||
|
android:key="speed_limit_exceed"
|
||||||
|
android:title="@string/speed_limit_exceed"
|
||||||
|
android:summary="@string/speed_limit_exceed_message"/>
|
||||||
<CheckBoxPreference android:title="@string/show_zoom_buttons_navigation" android:summary="@string/show_zoom_buttons_navigation_descr" android:key="show_zoom_buttons_navigation" />
|
<CheckBoxPreference android:title="@string/show_zoom_buttons_navigation" android:summary="@string/show_zoom_buttons_navigation_descr" android:key="show_zoom_buttons_navigation" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
|
@ -675,6 +675,9 @@ public class OsmandSettings {
|
||||||
public final OsmandPreference<Float> ARRIVAL_DISTANCE_FACTOR =
|
public final OsmandPreference<Float> ARRIVAL_DISTANCE_FACTOR =
|
||||||
new FloatPreference("arrival_distance_factor", 1f).makeProfile();
|
new FloatPreference("arrival_distance_factor", 1f).makeProfile();
|
||||||
|
|
||||||
|
public final OsmandPreference<Float> SPEED_LIMIT_EXCEED =
|
||||||
|
new FloatPreference("speed_limit_exceed", 5000f).makeProfile();
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final OsmandPreference<Boolean> USE_TRACKBALL_FOR_MOVEMENTS =
|
public final OsmandPreference<Boolean> USE_TRACKBALL_FOR_MOVEMENTS =
|
||||||
new BooleanPreference("use_trackball_for_movements", true).makeGlobal();
|
new BooleanPreference("use_trackball_for_movements", true).makeGlobal();
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.AutoZoomMap;
|
import net.osmand.plus.OsmandSettings.AutoZoomMap;
|
||||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -109,7 +110,28 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
||||||
getString(R.string.arrival_distance_factor_at_last)
|
getString(R.string.arrival_distance_factor_at_last)
|
||||||
};
|
};
|
||||||
registerListPreference(settings.ARRIVAL_DISTANCE_FACTOR, screen, arrivalNames, arrivalValues);
|
registerListPreference(settings.ARRIVAL_DISTANCE_FACTOR, screen, arrivalNames, arrivalValues);
|
||||||
|
|
||||||
|
Float[] speedLimits = new Float[] {5f, 7f, 10f, 15f, 20f};
|
||||||
|
if (settings.METRIC_SYSTEM.get() == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS){
|
||||||
|
|
||||||
|
String[] speedNames = new String[] {
|
||||||
|
speedLimits[0] + " " + getString(R.string.km_h),
|
||||||
|
speedLimits[1] + " " + getString(R.string.km_h),
|
||||||
|
speedLimits[2] + " " + getString(R.string.km_h),
|
||||||
|
speedLimits[3] + " " + getString(R.string.km_h),
|
||||||
|
speedLimits[4] + " " + getString(R.string.km_h)};
|
||||||
|
registerListPreference(settings.SPEED_LIMIT_EXCEED, screen, speedNames, speedLimits);
|
||||||
|
} else {
|
||||||
|
String[] speedNames = new String[] {
|
||||||
|
(speedLimits[0] / 1.6) + " " + getString(R.string.mile_per_hour),
|
||||||
|
(speedLimits[1] / 1.6) + " " + getString(R.string.mile_per_hour),
|
||||||
|
(speedLimits[2] / 1.6) + " " + getString(R.string.mile_per_hour),
|
||||||
|
(speedLimits[3] / 1.6) + " " + getString(R.string.mile_per_hour),
|
||||||
|
(speedLimits[4] / 1.6) + " " + getString(R.string.mile_per_hour)};
|
||||||
|
registerListPreference(settings.SPEED_LIMIT_EXCEED, screen, speedNames, speedLimits);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
profileDialog();
|
profileDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,8 @@ public class WaypointHelper {
|
||||||
public AlarmInfo getMostImportantAlarm(MetricsConstants mc, boolean showCameras) {
|
public AlarmInfo getMostImportantAlarm(MetricsConstants mc, boolean showCameras) {
|
||||||
Location lastProjection = app.getRoutingHelper().getLastProjection();
|
Location lastProjection = app.getRoutingHelper().getLastProjection();
|
||||||
float mxspeed = route.getCurrentMaxSpeed();
|
float mxspeed = route.getCurrentMaxSpeed();
|
||||||
AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, lastProjection);
|
float delta = app.getSettings().SPEED_LIMIT_EXCEED.get() / 3.6f;
|
||||||
|
AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, lastProjection, delta);
|
||||||
if (speedAlarm != null) {
|
if (speedAlarm != null) {
|
||||||
getVoiceRouter().announceSpeedAlarm();
|
getVoiceRouter().announceSpeedAlarm();
|
||||||
}
|
}
|
||||||
|
@ -246,7 +247,8 @@ public class WaypointHelper {
|
||||||
public AlarmInfo calculateMostImportantAlarm(RouteDataObject ro, Location loc,
|
public AlarmInfo calculateMostImportantAlarm(RouteDataObject ro, Location loc,
|
||||||
MetricsConstants mc, boolean showCameras) {
|
MetricsConstants mc, boolean showCameras) {
|
||||||
float mxspeed = ro.getMaximumSpeed();
|
float mxspeed = ro.getMaximumSpeed();
|
||||||
AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, loc);
|
float delta = app.getSettings().SPEED_LIMIT_EXCEED.get() / 3.6f;
|
||||||
|
AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, loc, delta);
|
||||||
if (speedAlarm != null) {
|
if (speedAlarm != null) {
|
||||||
getVoiceRouter().announceSpeedAlarm();
|
getVoiceRouter().announceSpeedAlarm();
|
||||||
return speedAlarm;
|
return speedAlarm;
|
||||||
|
@ -275,10 +277,9 @@ public class WaypointHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static AlarmInfo createSpeedAlarm(MetricsConstants mc, float mxspeed, Location loc) {
|
private static AlarmInfo createSpeedAlarm(MetricsConstants mc, float mxspeed, Location loc, float delta) {
|
||||||
AlarmInfo speedAlarm = null;
|
AlarmInfo speedAlarm = null;
|
||||||
if (mxspeed != 0 && loc != null && loc.hasSpeed() && mxspeed != RouteDataObject.NONE_MAX_SPEED) {
|
if (mxspeed != 0 && loc != null && loc.hasSpeed() && mxspeed != RouteDataObject.NONE_MAX_SPEED) {
|
||||||
float delta = 5f / 3.6f;
|
|
||||||
if (loc.getSpeed() > mxspeed + delta) {
|
if (loc.getSpeed() > mxspeed + delta) {
|
||||||
int speed;
|
int speed;
|
||||||
if (mc == MetricsConstants.KILOMETERS_AND_METERS) {
|
if (mc == MetricsConstants.KILOMETERS_AND_METERS) {
|
||||||
|
|
Loading…
Reference in a new issue