Add information about turn announcements
This commit is contained in:
parent
cdbd37f1ca
commit
60c521aad5
4 changed files with 58 additions and 2 deletions
|
@ -4010,6 +4010,7 @@
|
|||
<string name="routing_attr_difficulty_preference_description">Prefer routes of this difficulty, although routing over harder or easier pistes is still possible if shorter.</string>
|
||||
<string name="routing_attr_freeride_policy_name">Off-piste</string>
|
||||
<string name="routing_attr_freeride_policy_description">\'Freeride\' and \'Off-piste\' are unofficial routes and passages. Typically ungroomed, unmaintained and not checked in the evening. Enter at your own risk.</string>
|
||||
<string name="voice_prompts_timetable">Voice prompts times</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -91,6 +91,14 @@
|
|||
android:layout="@layout/preference_with_descr"
|
||||
android:title="@string/arrival_distance" />
|
||||
|
||||
|
||||
<Preference
|
||||
android:key="voice_prompts_timetable"
|
||||
android:layout="@layout/preference_with_descr"
|
||||
android:persistent="false"
|
||||
android:selectable="false"
|
||||
android:title="@string/voice_prompts_timetable" />
|
||||
|
||||
<Preference
|
||||
android:layout="@layout/simple_divider_item"
|
||||
android:selectable="false" />
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.routing.data;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.voice.AbstractPrologCommandPlayer;
|
||||
|
@ -20,8 +21,6 @@ public class AnnounceTimeDistances {
|
|||
public final static int STATE_SHORT_PNT_APPROACH = 6;
|
||||
public final static int STATE_LONG_PNT_APPROACH = 7;
|
||||
|
||||
public final static int STATE_ARRIVAL_DISTANCE = 10;
|
||||
public final static int STATE_OFF_ROUTE_DISTANCE = 11;
|
||||
|
||||
// Default speed to have comfortable announcements (Speed in m/s)
|
||||
// initial value is updated from default speed settings anyway
|
||||
|
@ -199,4 +198,36 @@ public class AnnounceTimeDistances {
|
|||
public int calcDistanceWithoutDelay(float speed, int dist) {
|
||||
return (int) (dist - voicePromptDelayTimeSec * speed);
|
||||
}
|
||||
|
||||
public String getTurnsDescription() {
|
||||
StringBuilder turnDescriptions = new StringBuilder();
|
||||
turnDescriptions.append(String.format("Turn (now): %d m, %d seconds\n", TURN_NOW_DISTANCE,
|
||||
(int) (TURN_NOW_DISTANCE / TURN_NOW_SPEED)));
|
||||
turnDescriptions.append(String.format("Turn (approach): %d m, %d seconds\n", TURN_IN_DISTANCE,
|
||||
(int) (TURN_IN_DISTANCE / DEFAULT_SPEED)));
|
||||
if (PREPARE_DISTANCE_END <= PREPARE_DISTANCE) {
|
||||
turnDescriptions.append(String.format("Turn (prepare): %d m, %d seconds\n", PREPARE_DISTANCE,
|
||||
(int) (PREPARE_DISTANCE / DEFAULT_SPEED)));
|
||||
}
|
||||
if (PREPARE_LONG_DISTANCE_END <= PREPARE_LONG_DISTANCE) {
|
||||
turnDescriptions.append(String.format("Turn (early prepare): %d m, %d seconds\n", PREPARE_LONG_DISTANCE,
|
||||
(int) (PREPARE_LONG_DISTANCE / DEFAULT_SPEED)));
|
||||
}
|
||||
turnDescriptions.append(String.format("Finish: %d m, %d seconds\n", (int) getArrivalDistance(),
|
||||
(int) (getArrivalDistance() / DEFAULT_SPEED)));
|
||||
if(getOffRouteDistance() > 0) {
|
||||
turnDescriptions.append(String.format("Off-route (prepare): %d m, %d seconds\n", (int) getOffRouteDistance(),
|
||||
(int) (getOffRouteDistance() / DEFAULT_SPEED)));
|
||||
}
|
||||
turnDescriptions.append(String.format("Alarm (now): %d m, %d seconds\n", SHORT_ALARM_ANNOUNCE_RADIUS,
|
||||
(int) (SHORT_ALARM_ANNOUNCE_RADIUS / DEFAULT_SPEED)));
|
||||
turnDescriptions.append(String.format("Alarm (prepare): %d m, %d seconds\n", LONG_ALARM_ANNOUNCE_RADIUS,
|
||||
(int) (LONG_ALARM_ANNOUNCE_RADIUS / DEFAULT_SPEED)));
|
||||
turnDescriptions.append(String.format("POI/Waypoint (now): %d m, %d seconds\n", SHORT_PNT_ANNOUNCE_RADIUS,
|
||||
(int) (SHORT_PNT_ANNOUNCE_RADIUS / DEFAULT_SPEED)));
|
||||
turnDescriptions.append(String.format("POI/Waypoint (prepare): %d m, %d seconds\n", LONG_PNT_ANNOUNCE_RADIUS,
|
||||
(int) (LONG_PNT_ANNOUNCE_RADIUS / DEFAULT_SPEED)));
|
||||
|
||||
return turnDescriptions.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import androidx.preference.PreferenceViewHolder;
|
|||
import androidx.preference.SwitchPreferenceCompat;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.Version;
|
||||
|
@ -26,6 +27,7 @@ import net.osmand.plus.download.DownloadActivity;
|
|||
import net.osmand.plus.download.DownloadActivityType;
|
||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||
import net.osmand.plus.routing.data.AnnounceTimeDistances;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
||||
|
@ -93,6 +95,7 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
|||
|
||||
setupKeepInformingPref();
|
||||
setupArrivalAnnouncementPref();
|
||||
updateVoicePromptsTimes();
|
||||
setupVoiceProviderPref();
|
||||
|
||||
if (!Version.isBlackberry(app)) {
|
||||
|
@ -104,6 +107,16 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
|||
setupSpeedCamerasAlert();
|
||||
}
|
||||
|
||||
private void updateVoicePromptsTimes() {
|
||||
Preference pref = findPreference("voice_prompts_timetable");
|
||||
if (OsmandPlugin.isDevelopment()) {
|
||||
AnnounceTimeDistances atd = new AnnounceTimeDistances(getSelectedAppMode(), settings);
|
||||
pref.setSummary(atd.getTurnsDescription().trim());
|
||||
} else {
|
||||
pref.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupSpeedLimitExceedPref() {
|
||||
//array size must be equal!
|
||||
Float[] valuesKmh = new Float[] {-10f, -7f, -5f, 0f, 5f, 7f, 10f, 15f, 20f};
|
||||
|
@ -259,6 +272,9 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
|||
settings.SPEAK_SPEED_CAMERA.getId(), false, ApplyQueryType.SNACK_BAR);
|
||||
}
|
||||
}
|
||||
if (prefId.equals(settings.ARRIVAL_DISTANCE_FACTOR.getId())) {
|
||||
updateVoicePromptsTimes();
|
||||
}
|
||||
if (prefId.equals(settings.AUDIO_MANAGER_STREAM.getId())) {
|
||||
return onConfirmPreferenceChange(
|
||||
settings.AUDIO_MANAGER_STREAM.getId(), newValue, ApplyQueryType.SNACK_BAR);
|
||||
|
|
Loading…
Reference in a new issue