Move accessibility prefs to plugin
This commit is contained in:
parent
c52c9d2515
commit
fc2ef118f5
9 changed files with 97 additions and 94 deletions
|
@ -11,6 +11,7 @@
|
||||||
Thx - Hardy
|
Thx - Hardy
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
<string name="osm_authorization_success">Authorization is successful</string>
|
||||||
<string name="file_does_not_contain_routing_rules">\'%1$s\' file doesn\'t contain routing rules, please choose another file.</string>
|
<string name="file_does_not_contain_routing_rules">\'%1$s\' file doesn\'t contain routing rules, please choose another file.</string>
|
||||||
<string name="not_support_file_type_with_ext">Not supported file type. You need to select a file with %1$s extension.</string>
|
<string name="not_support_file_type_with_ext">Not supported file type. You need to select a file with %1$s extension.</string>
|
||||||
<string name="import_from_file">Import from file</string>
|
<string name="import_from_file">Import from file</string>
|
||||||
|
|
|
@ -7,7 +7,10 @@ import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.access.AccessibilityMode;
|
||||||
|
import net.osmand.plus.access.RelativeDirectionStyle;
|
||||||
import net.osmand.plus.settings.BaseSettingsFragment;
|
import net.osmand.plus.settings.BaseSettingsFragment;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -25,8 +28,27 @@ public class AccessibilityPlugin extends OsmandPlugin {
|
||||||
private SoundPool sounds;
|
private SoundPool sounds;
|
||||||
private Map<Integer, Integer> soundIcons = new HashMap<Integer, Integer>();
|
private Map<Integer, Integer> soundIcons = new HashMap<Integer, Integer>();
|
||||||
|
|
||||||
|
public final OsmandSettings.OsmandPreference<AccessibilityMode> ACCESSIBILITY_MODE;
|
||||||
|
public final OsmandSettings.OsmandPreference<Float> SPEECH_RATE;
|
||||||
|
public final OsmandSettings.OsmandPreference<Boolean> ACCESSIBILITY_SMART_AUTOANNOUNCE;
|
||||||
|
public final OsmandSettings.OsmandPreference<Integer> ACCESSIBILITY_AUTOANNOUNCE_PERIOD;
|
||||||
|
public final OsmandSettings.OsmandPreference<Boolean> DISABLE_OFFROUTE_RECALC;
|
||||||
|
public final OsmandSettings.OsmandPreference<Boolean> DISABLE_WRONG_DIRECTION_RECALC;
|
||||||
|
public final OsmandSettings.OsmandPreference<RelativeDirectionStyle> DIRECTION_STYLE;
|
||||||
|
public final OsmandSettings.OsmandPreference<Boolean> DIRECTION_AUDIO_FEEDBACK;
|
||||||
|
public final OsmandSettings.OsmandPreference<Boolean> DIRECTION_HAPTIC_FEEDBACK;
|
||||||
|
|
||||||
public AccessibilityPlugin(OsmandApplication app) {
|
public AccessibilityPlugin(OsmandApplication app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
ACCESSIBILITY_MODE = registerEnumIntPreference(app, "accessibility_mode", AccessibilityMode.DEFAULT, AccessibilityMode.values(), AccessibilityMode.class).makeProfile().cache();
|
||||||
|
SPEECH_RATE = registerFloatPreference(app, "speech_rate", 1f).makeProfile();
|
||||||
|
ACCESSIBILITY_SMART_AUTOANNOUNCE = registerBooleanAccessibilityPreference(app, "accessibility_smart_autoannounce", true).makeProfile();
|
||||||
|
ACCESSIBILITY_AUTOANNOUNCE_PERIOD = registerIntPreference(app, "accessibility_autoannounce_period", 10000).makeProfile().cache();
|
||||||
|
DISABLE_OFFROUTE_RECALC = registerBooleanAccessibilityPreference(app, "disable_offroute_recalc", false).makeProfile();
|
||||||
|
DISABLE_WRONG_DIRECTION_RECALC = registerBooleanAccessibilityPreference(app, "disable_wrong_direction_recalc", false).makeProfile();
|
||||||
|
DIRECTION_STYLE = registerEnumIntPreference(app, "direction_style", RelativeDirectionStyle.SIDEWISE, RelativeDirectionStyle.values(), RelativeDirectionStyle.class).makeProfile().cache();
|
||||||
|
DIRECTION_AUDIO_FEEDBACK = registerBooleanAccessibilityPreference(app, "direction_audio_feedback", false).makeProfile();
|
||||||
|
DIRECTION_HAPTIC_FEEDBACK = registerBooleanAccessibilityPreference(app, "direction_haptic_feedback", false).makeProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -88,6 +110,12 @@ public class AccessibilityPlugin extends OsmandPlugin {
|
||||||
return R.drawable.ic_plugin_accessibility;
|
return R.drawable.ic_plugin_accessibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private OsmandSettings.CommonPreference<Boolean> registerBooleanAccessibilityPreference(OsmandApplication app, String prefId, boolean defValue) {
|
||||||
|
OsmandSettings.CommonPreference<Boolean> preference = app.getSettings().registerBooleanAccessibilityPreference(prefId, defValue);
|
||||||
|
pluginPreferences.add(preference);
|
||||||
|
return preference;
|
||||||
|
}
|
||||||
|
|
||||||
public void playSoundIcon(int iconId) {
|
public void playSoundIcon(int iconId) {
|
||||||
if ((sounds != null) && soundIcons.containsKey(iconId)) {
|
if ((sounds != null) && soundIcons.containsKey(iconId)) {
|
||||||
int sound = soundIcons.get(iconId);
|
int sound = soundIcons.get(iconId);
|
||||||
|
|
|
@ -24,25 +24,29 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
|
||||||
private static final String COPY_PLUGIN_SETTINGS = "copy_plugin_settings";
|
private static final String COPY_PLUGIN_SETTINGS = "copy_plugin_settings";
|
||||||
private static final String RESET_TO_DEFAULT = "reset_to_default";
|
private static final String RESET_TO_DEFAULT = "reset_to_default";
|
||||||
|
|
||||||
|
private AccessibilityPlugin plugin = OsmandPlugin.getPlugin(AccessibilityPlugin.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setupPreferences() {
|
protected void setupPreferences() {
|
||||||
setupAccessibilityModePref();
|
if (plugin != null) {
|
||||||
setupSpeechRatePref();
|
setupAccessibilityModePref();
|
||||||
|
setupSpeechRatePref();
|
||||||
|
|
||||||
setupSmartAutoAnnouncePref();
|
setupSmartAutoAnnouncePref();
|
||||||
setupAutoAnnouncePeriodPref();
|
setupAutoAnnouncePeriodPref();
|
||||||
|
|
||||||
setupDisableOffRouteRecalculationPref();
|
setupDisableOffRouteRecalculationPref();
|
||||||
setupDisableWrongDirectionRecalculationPref();
|
setupDisableWrongDirectionRecalculationPref();
|
||||||
|
|
||||||
setupDirectionStylePref();
|
setupDirectionStylePref();
|
||||||
setupDirectionAudioFeedbackPref();
|
setupDirectionAudioFeedbackPref();
|
||||||
setupDirectionHapticFeedbackPref();
|
setupDirectionHapticFeedbackPref();
|
||||||
|
|
||||||
setupCopyProfileSettingsPref();
|
setupCopyProfileSettingsPref();
|
||||||
setupResetToDefaultPref();
|
setupResetToDefaultPref();
|
||||||
|
|
||||||
updateAccessibilityOptions();
|
updateAccessibilityOptions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupAccessibilityModePref() {
|
private void setupAccessibilityModePref() {
|
||||||
|
@ -55,7 +59,7 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
|
||||||
entryValues[i] = accessibilityModes[i].ordinal();
|
entryValues[i] = accessibilityModes[i].ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
ListPreferenceEx accessibilityMode = (ListPreferenceEx) findPreference(settings.ACCESSIBILITY_MODE.getId());
|
ListPreferenceEx accessibilityMode = (ListPreferenceEx) findPreference(plugin.ACCESSIBILITY_MODE.getId());
|
||||||
accessibilityMode.setEntries(entries);
|
accessibilityMode.setEntries(entries);
|
||||||
accessibilityMode.setEntryValues(entryValues);
|
accessibilityMode.setEntryValues(entryValues);
|
||||||
accessibilityMode.setDescription(R.string.accessibility_mode_descr);
|
accessibilityMode.setDescription(R.string.accessibility_mode_descr);
|
||||||
|
@ -69,7 +73,7 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
|
||||||
entries[i] = (int) (entryValues[i] * 100) + " %";
|
entries[i] = (int) (entryValues[i] * 100) + " %";
|
||||||
}
|
}
|
||||||
|
|
||||||
ListPreferenceEx speechRate = (ListPreferenceEx) findPreference(settings.SPEECH_RATE.getId());
|
ListPreferenceEx speechRate = (ListPreferenceEx) findPreference(plugin.SPEECH_RATE.getId());
|
||||||
speechRate.setEntries(entries);
|
speechRate.setEntries(entries);
|
||||||
speechRate.setEntryValues(entryValues);
|
speechRate.setEntryValues(entryValues);
|
||||||
speechRate.setIcon(getContentIcon(R.drawable.ic_world_globe_dark));
|
speechRate.setIcon(getContentIcon(R.drawable.ic_world_globe_dark));
|
||||||
|
@ -77,7 +81,7 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupSmartAutoAnnouncePref() {
|
private void setupSmartAutoAnnouncePref() {
|
||||||
SwitchPreferenceEx smartAutoAnnounce = (SwitchPreferenceEx) findPreference(settings.ACCESSIBILITY_SMART_AUTOANNOUNCE.getId());
|
SwitchPreferenceEx smartAutoAnnounce = (SwitchPreferenceEx) findPreference(plugin.ACCESSIBILITY_SMART_AUTOANNOUNCE.getId());
|
||||||
smartAutoAnnounce.setDescription(getString(R.string.access_smart_autoannounce_descr));
|
smartAutoAnnounce.setDescription(getString(R.string.access_smart_autoannounce_descr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,19 +103,19 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ListPreferenceEx autoAnnouncePeriod = (ListPreferenceEx) findPreference(settings.ACCESSIBILITY_AUTOANNOUNCE_PERIOD.getId());
|
ListPreferenceEx autoAnnouncePeriod = (ListPreferenceEx) findPreference(plugin.ACCESSIBILITY_AUTOANNOUNCE_PERIOD.getId());
|
||||||
autoAnnouncePeriod.setEntries(entries);
|
autoAnnouncePeriod.setEntries(entries);
|
||||||
autoAnnouncePeriod.setEntryValues(entryValues);
|
autoAnnouncePeriod.setEntryValues(entryValues);
|
||||||
autoAnnouncePeriod.setDescription(R.string.access_autoannounce_period_descr);
|
autoAnnouncePeriod.setDescription(R.string.access_autoannounce_period_descr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDisableOffRouteRecalculationPref() {
|
private void setupDisableOffRouteRecalculationPref() {
|
||||||
SwitchPreferenceEx disableOffRouteRecalculation = (SwitchPreferenceEx) findPreference(settings.DISABLE_OFFROUTE_RECALC.getId());
|
SwitchPreferenceEx disableOffRouteRecalculation = (SwitchPreferenceEx) findPreference(plugin.DISABLE_OFFROUTE_RECALC.getId());
|
||||||
disableOffRouteRecalculation.setDescription(getString(R.string.access_disable_offroute_recalc_descr));
|
disableOffRouteRecalculation.setDescription(getString(R.string.access_disable_offroute_recalc_descr));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDisableWrongDirectionRecalculationPref() {
|
private void setupDisableWrongDirectionRecalculationPref() {
|
||||||
SwitchPreferenceEx disableWrongDirectionRecalculation = (SwitchPreferenceEx) findPreference(settings.DISABLE_WRONG_DIRECTION_RECALC.getId());
|
SwitchPreferenceEx disableWrongDirectionRecalculation = (SwitchPreferenceEx) findPreference(plugin.DISABLE_WRONG_DIRECTION_RECALC.getId());
|
||||||
disableWrongDirectionRecalculation.setDescription(getString(R.string.access_disable_wrong_direction_recalc_descr));
|
disableWrongDirectionRecalculation.setDescription(getString(R.string.access_disable_wrong_direction_recalc_descr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,19 +129,19 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
|
||||||
entryValues[i] = relativeDirectionStyles[i].ordinal();
|
entryValues[i] = relativeDirectionStyles[i].ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
ListPreferenceEx directionStyle = (ListPreferenceEx) findPreference(settings.DIRECTION_STYLE.getId());
|
ListPreferenceEx directionStyle = (ListPreferenceEx) findPreference(plugin.DIRECTION_STYLE.getId());
|
||||||
directionStyle.setEntries(entries);
|
directionStyle.setEntries(entries);
|
||||||
directionStyle.setEntryValues(entryValues);
|
directionStyle.setEntryValues(entryValues);
|
||||||
directionStyle.setDescription(R.string.settings_direction_style_descr);
|
directionStyle.setDescription(R.string.settings_direction_style_descr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDirectionAudioFeedbackPref() {
|
private void setupDirectionAudioFeedbackPref() {
|
||||||
SwitchPreferenceEx directionAudioFeedback = (SwitchPreferenceEx) findPreference(settings.DIRECTION_AUDIO_FEEDBACK.getId());
|
SwitchPreferenceEx directionAudioFeedback = (SwitchPreferenceEx) findPreference(plugin.DIRECTION_AUDIO_FEEDBACK.getId());
|
||||||
directionAudioFeedback.setDescription(getString(R.string.access_direction_audio_feedback_descr));
|
directionAudioFeedback.setDescription(getString(R.string.access_direction_audio_feedback_descr));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDirectionHapticFeedbackPref() {
|
private void setupDirectionHapticFeedbackPref() {
|
||||||
SwitchPreferenceEx directionHapticFeedback = (SwitchPreferenceEx) findPreference(settings.DIRECTION_HAPTIC_FEEDBACK.getId());
|
SwitchPreferenceEx directionHapticFeedback = (SwitchPreferenceEx) findPreference(plugin.DIRECTION_HAPTIC_FEEDBACK.getId());
|
||||||
directionHapticFeedback.setDescription(getString(R.string.access_direction_haptic_feedback_descr));
|
directionHapticFeedback.setDescription(getString(R.string.access_direction_haptic_feedback_descr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +157,7 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreferenceChanged(String prefId) {
|
public void onPreferenceChanged(String prefId) {
|
||||||
if (settings.ACCESSIBILITY_MODE.getId().equals(prefId)) {
|
if (plugin.ACCESSIBILITY_MODE.getId().equals(prefId)) {
|
||||||
updateAccessibilityOptions();
|
updateAccessibilityOptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,7 +202,7 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
|
||||||
for (int i = 0; i < screen.getPreferenceCount(); i++) {
|
for (int i = 0; i < screen.getPreferenceCount(); i++) {
|
||||||
Preference preference = screen.getPreference(i);
|
Preference preference = screen.getPreference(i);
|
||||||
String prefId = preference.getKey();
|
String prefId = preference.getKey();
|
||||||
if (!settings.ACCESSIBILITY_MODE.getId().equals(prefId) && !settings.SPEECH_RATE.getId().equals(prefId))
|
if (!plugin.ACCESSIBILITY_MODE.getId().equals(prefId) && !plugin.SPEECH_RATE.getId().equals(prefId))
|
||||||
preference.setEnabled(accessibilityEnabled);
|
preference.setEnabled(accessibilityEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,20 +46,20 @@ public class NavigationInfo implements OsmAndCompassListener, OsmAndLocationList
|
||||||
private int value;
|
private int value;
|
||||||
|
|
||||||
public RelativeDirection() {
|
public RelativeDirection() {
|
||||||
style = settings.DIRECTION_STYLE.get();
|
style = plugin.DIRECTION_STYLE.get();
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The argument must be not null as well as the currentLocation
|
// The argument must be not null as well as the currentLocation
|
||||||
// and currentLocation must have bearing.
|
// and currentLocation must have bearing.
|
||||||
public RelativeDirection(final Location point) {
|
public RelativeDirection(final Location point) {
|
||||||
style = settings.DIRECTION_STYLE.get();
|
style = plugin.DIRECTION_STYLE.get();
|
||||||
value = directionTo(point, currentLocation.getBearing());
|
value = directionTo(point, currentLocation.getBearing());
|
||||||
}
|
}
|
||||||
|
|
||||||
// The first argument must be not null as well as the currentLocation.
|
// The first argument must be not null as well as the currentLocation.
|
||||||
public RelativeDirection(final Location point, float heading) {
|
public RelativeDirection(final Location point, float heading) {
|
||||||
style = settings.DIRECTION_STYLE.get();
|
style = plugin.DIRECTION_STYLE.get();
|
||||||
value = directionTo(point, heading);
|
value = directionTo(point, heading);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public class NavigationInfo implements OsmAndCompassListener, OsmAndLocationList
|
||||||
// The first argument must be not null as well as the currentLocation.
|
// The first argument must be not null as well as the currentLocation.
|
||||||
public boolean update(final Location point, float heading) {
|
public boolean update(final Location point, float heading) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
final RelativeDirectionStyle newStyle = settings.DIRECTION_STYLE.get();
|
final RelativeDirectionStyle newStyle = plugin.DIRECTION_STYLE.get();
|
||||||
if (style != newStyle) {
|
if (style != newStyle) {
|
||||||
style = newStyle;
|
style = newStyle;
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -151,7 +151,7 @@ public class NavigationInfo implements OsmAndCompassListener, OsmAndLocationList
|
||||||
private final long HAPTIC_INCLINATION_RIGHT[] = { 0, 20, 80, 20 };
|
private final long HAPTIC_INCLINATION_RIGHT[] = { 0, 20, 80, 20 };
|
||||||
|
|
||||||
private final OsmandApplication app;
|
private final OsmandApplication app;
|
||||||
private final OsmandSettings settings;
|
private final AccessibilityPlugin plugin;
|
||||||
private Location currentLocation;
|
private Location currentLocation;
|
||||||
private RelativeDirection lastDirection;
|
private RelativeDirection lastDirection;
|
||||||
private long lastNotificationTime;
|
private long lastNotificationTime;
|
||||||
|
@ -160,7 +160,7 @@ public class NavigationInfo implements OsmAndCompassListener, OsmAndLocationList
|
||||||
|
|
||||||
public NavigationInfo(OsmandApplication app) {
|
public NavigationInfo(OsmandApplication app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
settings = app.getSettings();
|
plugin = OsmandPlugin.getPlugin(AccessibilityPlugin.class);
|
||||||
currentLocation = null;
|
currentLocation = null;
|
||||||
lastDirection = new RelativeDirection();
|
lastDirection = new RelativeDirection();
|
||||||
lastNotificationTime = SystemClock.uptimeMillis();
|
lastNotificationTime = SystemClock.uptimeMillis();
|
||||||
|
@ -253,11 +253,11 @@ public class NavigationInfo implements OsmAndCompassListener, OsmAndLocationList
|
||||||
if (point != null) {
|
if (point != null) {
|
||||||
if ((currentLocation != null) && currentLocation.hasBearing() && !MapViewTrackingUtilities.isSmallSpeedForCompass(currentLocation)) {
|
if ((currentLocation != null) && currentLocation.hasBearing() && !MapViewTrackingUtilities.isSmallSpeedForCompass(currentLocation)) {
|
||||||
final long now = SystemClock.uptimeMillis();
|
final long now = SystemClock.uptimeMillis();
|
||||||
if ((now - lastNotificationTime) >= settings.ACCESSIBILITY_AUTOANNOUNCE_PERIOD.get()) {
|
if ((now - lastNotificationTime) >= plugin.ACCESSIBILITY_AUTOANNOUNCE_PERIOD.get()) {
|
||||||
Location destination = new Location("map"); //$NON-NLS-1$
|
Location destination = new Location("map"); //$NON-NLS-1$
|
||||||
destination.setLatitude(point.getLatitude());
|
destination.setLatitude(point.getLatitude());
|
||||||
destination.setLongitude(point.getLongitude());
|
destination.setLongitude(point.getLongitude());
|
||||||
if (lastDirection.update(destination) || !settings.ACCESSIBILITY_SMART_AUTOANNOUNCE.get()) {
|
if (lastDirection.update(destination) || !plugin.ACCESSIBILITY_SMART_AUTOANNOUNCE.get()) {
|
||||||
final String notification = distanceString(destination) + " " + lastDirection.getString(); //$NON-NLS-1$
|
final String notification = distanceString(destination) + " " + lastDirection.getString(); //$NON-NLS-1$
|
||||||
lastNotificationTime = now;
|
lastNotificationTime = now;
|
||||||
app.runInUIThread(new Runnable() {
|
app.runInUIThread(new Runnable() {
|
||||||
|
@ -281,7 +281,7 @@ public class NavigationInfo implements OsmAndCompassListener, OsmAndLocationList
|
||||||
Integer inclination = direction.getInclination();
|
Integer inclination = direction.getInclination();
|
||||||
if (targetDirectionFlag && ((inclination == null) || (inclination != 0))) {
|
if (targetDirectionFlag && ((inclination == null) || (inclination != 0))) {
|
||||||
targetDirectionFlag = false;
|
targetDirectionFlag = false;
|
||||||
if (settings.DIRECTION_AUDIO_FEEDBACK.get()) {
|
if (plugin.DIRECTION_AUDIO_FEEDBACK.get()) {
|
||||||
AccessibilityPlugin accessibilityPlugin = OsmandPlugin.getEnabledPlugin(AccessibilityPlugin.class);
|
AccessibilityPlugin accessibilityPlugin = OsmandPlugin.getEnabledPlugin(AccessibilityPlugin.class);
|
||||||
if (accessibilityPlugin != null) {
|
if (accessibilityPlugin != null) {
|
||||||
if (inclination == null) {
|
if (inclination == null) {
|
||||||
|
@ -293,7 +293,7 @@ public class NavigationInfo implements OsmAndCompassListener, OsmAndLocationList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (settings.DIRECTION_HAPTIC_FEEDBACK.get()) {
|
if (plugin.DIRECTION_HAPTIC_FEEDBACK.get()) {
|
||||||
Vibrator haptic = (Vibrator)app.getSystemService(Context.VIBRATOR_SERVICE);
|
Vibrator haptic = (Vibrator)app.getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
if ((haptic != null) && haptic.hasVibrator()) {
|
if ((haptic != null) && haptic.hasVibrator()) {
|
||||||
if (inclination == null) {
|
if (inclination == null) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.preference.PreferenceGroup;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.access.AccessibilityMode;
|
import net.osmand.plus.access.AccessibilityMode;
|
||||||
import net.osmand.plus.access.RelativeDirectionStyle;
|
import net.osmand.plus.access.RelativeDirectionStyle;
|
||||||
|
@ -17,6 +18,8 @@ import net.osmand.plus.activities.SettingsBaseActivity;
|
||||||
|
|
||||||
public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
||||||
|
|
||||||
|
private AccessibilityPlugin plugin;
|
||||||
|
|
||||||
private ListPreference accessibilityModePreference;
|
private ListPreference accessibilityModePreference;
|
||||||
private ListPreference directionStylePreference;
|
private ListPreference directionStylePreference;
|
||||||
private ListPreference autoannouncePeriodPreference;
|
private ListPreference autoannouncePeriodPreference;
|
||||||
|
@ -29,11 +32,13 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
||||||
getToolbar().setTitle(R.string.shared_string_accessibility);
|
getToolbar().setTitle(R.string.shared_string_accessibility);
|
||||||
PreferenceScreen grp = getPreferenceScreen();
|
PreferenceScreen grp = getPreferenceScreen();
|
||||||
|
|
||||||
|
plugin = OsmandPlugin.getPlugin(AccessibilityPlugin.class);
|
||||||
|
|
||||||
String[] entries = new String[AccessibilityMode.values().length];
|
String[] entries = new String[AccessibilityMode.values().length];
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
entries[i] = AccessibilityMode.values()[i].toHumanString(getMyApplication());
|
entries[i] = AccessibilityMode.values()[i].toHumanString(getMyApplication());
|
||||||
}
|
}
|
||||||
accessibilityModePreference = createListPreference(settings.ACCESSIBILITY_MODE, entries, AccessibilityMode.values(),
|
accessibilityModePreference = createListPreference(plugin.ACCESSIBILITY_MODE, entries, AccessibilityMode.values(),
|
||||||
R.string.accessibility_mode, R.string.accessibility_mode_descr);
|
R.string.accessibility_mode, R.string.accessibility_mode_descr);
|
||||||
accessibilityModePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
accessibilityModePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
private final OnPreferenceChangeListener committer = accessibilityModePreference.getOnPreferenceChangeListener();
|
private final OnPreferenceChangeListener committer = accessibilityModePreference.getOnPreferenceChangeListener();
|
||||||
|
@ -58,7 +63,7 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
entries[i] = RelativeDirectionStyle.values()[i].toHumanString(getMyApplication());
|
entries[i] = RelativeDirectionStyle.values()[i].toHumanString(getMyApplication());
|
||||||
}
|
}
|
||||||
directionStylePreference = createListPreference(settings.DIRECTION_STYLE, entries, RelativeDirectionStyle.values(),
|
directionStylePreference = createListPreference(plugin.DIRECTION_STYLE, entries, RelativeDirectionStyle.values(),
|
||||||
R.string.settings_direction_style, R.string.settings_direction_style_descr);
|
R.string.settings_direction_style, R.string.settings_direction_style_descr);
|
||||||
directionStylePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
directionStylePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
private final OnPreferenceChangeListener committer = directionStylePreference.getOnPreferenceChangeListener();
|
private final OnPreferenceChangeListener committer = directionStylePreference.getOnPreferenceChangeListener();
|
||||||
|
@ -72,12 +77,12 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
||||||
});
|
});
|
||||||
cat.addPreference(directionStylePreference);
|
cat.addPreference(directionStylePreference);
|
||||||
|
|
||||||
cat.addPreference(createCheckBoxPreference(settings.ACCESSIBILITY_SMART_AUTOANNOUNCE, R.string.access_smart_autoannounce,
|
cat.addPreference(createCheckBoxPreference(plugin.ACCESSIBILITY_SMART_AUTOANNOUNCE, R.string.access_smart_autoannounce,
|
||||||
R.string.access_smart_autoannounce_descr));
|
R.string.access_smart_autoannounce_descr));
|
||||||
|
|
||||||
final int[] seconds = new int[] {5, 10, 15, 20, 30, 45, 60, 90};
|
final int[] seconds = new int[] {5, 10, 15, 20, 30, 45, 60, 90};
|
||||||
final int[] minutes = new int[] {2, 3, 5};
|
final int[] minutes = new int[] {2, 3, 5};
|
||||||
autoannouncePeriodPreference = createTimeListPreference(settings.ACCESSIBILITY_AUTOANNOUNCE_PERIOD, seconds, minutes, 1000,
|
autoannouncePeriodPreference = createTimeListPreference(plugin.ACCESSIBILITY_AUTOANNOUNCE_PERIOD, seconds, minutes, 1000,
|
||||||
R.string.access_autoannounce_period, R.string.access_autoannounce_period_descr);
|
R.string.access_autoannounce_period, R.string.access_autoannounce_period_descr);
|
||||||
autoannouncePeriodPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
autoannouncePeriodPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
private final OnPreferenceChangeListener committer = autoannouncePeriodPreference.getOnPreferenceChangeListener();
|
private final OnPreferenceChangeListener committer = autoannouncePeriodPreference.getOnPreferenceChangeListener();
|
||||||
|
@ -91,14 +96,14 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
||||||
});
|
});
|
||||||
cat.addPreference(autoannouncePeriodPreference);
|
cat.addPreference(autoannouncePeriodPreference);
|
||||||
|
|
||||||
cat.addPreference(createCheckBoxPreference(settings.DISABLE_OFFROUTE_RECALC, R.string.access_disable_offroute_recalc,
|
cat.addPreference(createCheckBoxPreference(plugin.DISABLE_OFFROUTE_RECALC, R.string.access_disable_offroute_recalc,
|
||||||
R.string.access_disable_offroute_recalc_descr));
|
R.string.access_disable_offroute_recalc_descr));
|
||||||
cat.addPreference(createCheckBoxPreference(settings.DISABLE_WRONG_DIRECTION_RECALC, R.string.access_disable_wrong_direction_recalc,
|
cat.addPreference(createCheckBoxPreference(plugin.DISABLE_WRONG_DIRECTION_RECALC, R.string.access_disable_wrong_direction_recalc,
|
||||||
R.string.access_disable_wrong_direction_recalc_descr));
|
R.string.access_disable_wrong_direction_recalc_descr));
|
||||||
|
|
||||||
cat.addPreference(createCheckBoxPreference(settings.DIRECTION_AUDIO_FEEDBACK, R.string.access_direction_audio_feedback,
|
cat.addPreference(createCheckBoxPreference(plugin.DIRECTION_AUDIO_FEEDBACK, R.string.access_direction_audio_feedback,
|
||||||
R.string.access_direction_audio_feedback_descr));
|
R.string.access_direction_audio_feedback_descr));
|
||||||
cat.addPreference(createCheckBoxPreference(settings.DIRECTION_HAPTIC_FEEDBACK, R.string.access_direction_haptic_feedback,
|
cat.addPreference(createCheckBoxPreference(plugin.DIRECTION_HAPTIC_FEEDBACK, R.string.access_direction_haptic_feedback,
|
||||||
R.string.access_direction_haptic_feedback_descr));
|
R.string.access_direction_haptic_feedback_descr));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -110,7 +115,7 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
||||||
for(int i = 0; i < sprNames.length; i++) {
|
for(int i = 0; i < sprNames.length; i++) {
|
||||||
sprNames[i] = (int)(sprValues[i] * 100) + " %";
|
sprNames[i] = (int)(sprValues[i] * 100) + " %";
|
||||||
}
|
}
|
||||||
grp.addPreference(createListPreference(settings.SPEECH_RATE, sprNames, sprValues, R.string.speech_rate, R.string.speech_rate_descr));
|
grp.addPreference(createListPreference(plugin.SPEECH_RATE, sprNames, sprValues, R.string.speech_rate, R.string.speech_rate_descr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,14 +126,13 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
||||||
if (accessibilityOptions != null)
|
if (accessibilityOptions != null)
|
||||||
accessibilityOptions.setEnabled(getMyApplication().accessibilityEnabled());
|
accessibilityOptions.setEnabled(getMyApplication().accessibilityEnabled());
|
||||||
if(accessibilityModePreference != null) {
|
if(accessibilityModePreference != null) {
|
||||||
accessibilityModePreference.setSummary(getString(R.string.accessibility_mode_descr) + " [" + settings.ACCESSIBILITY_MODE.get().toHumanString(getMyApplication()) + "]");
|
accessibilityModePreference.setSummary(getString(R.string.accessibility_mode_descr) + " [" + plugin.ACCESSIBILITY_MODE.get().toHumanString(getMyApplication()) + "]");
|
||||||
}
|
}
|
||||||
if(directionStylePreference != null) {
|
if(directionStylePreference != null) {
|
||||||
directionStylePreference.setSummary(getString(R.string.settings_direction_style_descr) + " [" + settings.DIRECTION_STYLE.get().toHumanString(getMyApplication()) + "]");
|
directionStylePreference.setSummary(getString(R.string.settings_direction_style_descr) + " [" + plugin.DIRECTION_STYLE.get().toHumanString(getMyApplication()) + "]");
|
||||||
}
|
}
|
||||||
if(autoannouncePeriodPreference != null) {
|
if(autoannouncePeriodPreference != null) {
|
||||||
autoannouncePeriodPreference.setSummary(getString(R.string.access_autoannounce_period_descr) + " [" + autoannouncePeriodPreference.getEntry() + "]");
|
autoannouncePeriodPreference.setSummary(getString(R.string.access_autoannounce_period_descr) + " [" + autoannouncePeriodPreference.getEntry() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
|
@ -877,10 +877,11 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accessibilityEnabledForMode(ApplicationMode appMode) {
|
public boolean accessibilityEnabledForMode(ApplicationMode appMode) {
|
||||||
final AccessibilityMode mode = getSettings().ACCESSIBILITY_MODE.getModeValue(appMode);
|
AccessibilityPlugin accessibilityPlugin = OsmandPlugin.getEnabledPlugin(AccessibilityPlugin.class);
|
||||||
if (OsmandPlugin.getEnabledPlugin(AccessibilityPlugin.class) == null) {
|
if (accessibilityPlugin == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
AccessibilityMode mode = accessibilityPlugin.ACCESSIBILITY_MODE.getModeValue(appMode);
|
||||||
if (mode == AccessibilityMode.ON) {
|
if (mode == AccessibilityMode.ON) {
|
||||||
return true;
|
return true;
|
||||||
} else if (mode == AccessibilityMode.OFF) {
|
} else if (mode == AccessibilityMode.OFF) {
|
||||||
|
|
|
@ -30,8 +30,6 @@ import net.osmand.map.ITileSource;
|
||||||
import net.osmand.map.TileSourceManager;
|
import net.osmand.map.TileSourceManager;
|
||||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||||
import net.osmand.osm.io.NetworkUtils;
|
import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.plus.access.AccessibilityMode;
|
|
||||||
import net.osmand.plus.access.RelativeDirectionStyle;
|
|
||||||
import net.osmand.plus.api.SettingsAPI;
|
import net.osmand.plus.api.SettingsAPI;
|
||||||
import net.osmand.plus.api.SettingsAPI.SettingsEditor;
|
import net.osmand.plus.api.SettingsAPI.SettingsEditor;
|
||||||
import net.osmand.plus.api.SettingsAPIImpl;
|
import net.osmand.plus.api.SettingsAPIImpl;
|
||||||
|
@ -1409,21 +1407,6 @@ public class OsmandSettings {
|
||||||
|
|
||||||
}.makeProfile();
|
}.makeProfile();
|
||||||
|
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
|
||||||
// cache of metrics constants as they are used very often
|
|
||||||
public final OsmandPreference<RelativeDirectionStyle> DIRECTION_STYLE = new EnumIntPreference<RelativeDirectionStyle>(
|
|
||||||
"direction_style", RelativeDirectionStyle.SIDEWISE, RelativeDirectionStyle.values()).makeProfile().cache();
|
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
|
||||||
// cache of metrics constants as they are used very often
|
|
||||||
public final OsmandPreference<AccessibilityMode> ACCESSIBILITY_MODE = new EnumIntPreference<AccessibilityMode>(
|
|
||||||
"accessibility_mode", AccessibilityMode.DEFAULT, AccessibilityMode.values()).makeProfile().cache();
|
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
|
||||||
public final OsmandPreference<Float> SPEECH_RATE =
|
|
||||||
new FloatPreference("speech_rate", 1f).makeProfile();
|
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
|
@ -1446,30 +1429,6 @@ public class OsmandSettings {
|
||||||
public final OsmandPreference<Boolean> USE_TRACKBALL_FOR_MOVEMENTS =
|
public final OsmandPreference<Boolean> USE_TRACKBALL_FOR_MOVEMENTS =
|
||||||
new BooleanPreference("use_trackball_for_movements", true).makeProfile();
|
new BooleanPreference("use_trackball_for_movements", true).makeProfile();
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
|
||||||
public final OsmandPreference<Boolean> ACCESSIBILITY_SMART_AUTOANNOUNCE =
|
|
||||||
new BooleanAccessibilityPreference("accessibility_smart_autoannounce", true).makeProfile();
|
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
|
||||||
// cache of metrics constants as they are used very often
|
|
||||||
public final OsmandPreference<Integer> ACCESSIBILITY_AUTOANNOUNCE_PERIOD = new IntPreference("accessibility_autoannounce_period", 10000).makeProfile().cache();
|
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
|
||||||
public final OsmandPreference<Boolean> DISABLE_OFFROUTE_RECALC =
|
|
||||||
new BooleanAccessibilityPreference("disable_offroute_recalc", false).makeProfile();
|
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
|
||||||
public final OsmandPreference<Boolean> DISABLE_WRONG_DIRECTION_RECALC =
|
|
||||||
new BooleanAccessibilityPreference("disable_wrong_direction_recalc", false).makeProfile();
|
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
|
||||||
public final OsmandPreference<Boolean> DIRECTION_AUDIO_FEEDBACK =
|
|
||||||
new BooleanAccessibilityPreference("direction_audio_feedback", false).makeProfile();
|
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
|
||||||
public final OsmandPreference<Boolean> DIRECTION_HAPTIC_FEEDBACK =
|
|
||||||
new BooleanAccessibilityPreference("direction_haptic_feedback", false).makeProfile();
|
|
||||||
|
|
||||||
// magnetic field doesn'torkmost of the time on some phones
|
// magnetic field doesn'torkmost of the time on some phones
|
||||||
public final OsmandPreference<Boolean> USE_MAGNETIC_FIELD_SENSOR_COMPASS = new BooleanPreference("use_magnetic_field_sensor_compass", false).makeProfile().cache();
|
public final OsmandPreference<Boolean> USE_MAGNETIC_FIELD_SENSOR_COMPASS = new BooleanPreference("use_magnetic_field_sensor_compass", false).makeProfile().cache();
|
||||||
public final OsmandPreference<Boolean> USE_KALMAN_FILTER_FOR_COMPASS = new BooleanPreference("use_kalman_filter_compass", true).makeProfile().cache();
|
public final OsmandPreference<Boolean> USE_KALMAN_FILTER_FOR_COMPASS = new BooleanPreference("use_kalman_filter_compass", true).makeProfile().cache();
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package net.osmand.plus.routing;
|
package net.osmand.plus.routing;
|
||||||
|
|
||||||
|
|
||||||
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.ValueHolder;
|
import net.osmand.ValueHolder;
|
||||||
|
import net.osmand.access.AccessibilityPlugin;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
|
||||||
import net.osmand.plus.NavigationService;
|
import net.osmand.plus.NavigationService;
|
||||||
import net.osmand.plus.OsmAndAppCustomization.OsmAndAppCustomizationListener;
|
import net.osmand.plus.OsmAndAppCustomization.OsmAndAppCustomizationListener;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
|
@ -71,6 +72,7 @@ public class RoutingHelper {
|
||||||
|
|
||||||
private ApplicationMode mode;
|
private ApplicationMode mode;
|
||||||
private OsmandSettings settings;
|
private OsmandSettings settings;
|
||||||
|
private AccessibilityPlugin accessibilityPlugin;
|
||||||
|
|
||||||
private RouteProvider provider;
|
private RouteProvider provider;
|
||||||
private VoiceRouter voiceRouter;
|
private VoiceRouter voiceRouter;
|
||||||
|
@ -101,6 +103,7 @@ public class RoutingHelper {
|
||||||
transportRoutingHelper = context.getTransportRoutingHelper();
|
transportRoutingHelper = context.getTransportRoutingHelper();
|
||||||
transportRoutingHelper.setRoutingHelper(this);
|
transportRoutingHelper.setRoutingHelper(this);
|
||||||
setAppMode(settings.APPLICATION_MODE.get());
|
setAppMode(settings.APPLICATION_MODE.get());
|
||||||
|
accessibilityPlugin = OsmandPlugin.getPlugin(AccessibilityPlugin.class);
|
||||||
|
|
||||||
OsmAndAppCustomizationListener customizationListener = new OsmAndAppCustomizationListener() {
|
OsmAndAppCustomizationListener customizationListener = new OsmAndAppCustomizationListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -395,7 +398,7 @@ public class RoutingHelper {
|
||||||
// >100m off current route (sideways)
|
// >100m off current route (sideways)
|
||||||
if (currentRoute > 0) {
|
if (currentRoute > 0) {
|
||||||
distOrth = getOrthogonalDistance(currentLocation, routeNodes.get(currentRoute - 1), routeNodes.get(currentRoute));
|
distOrth = getOrthogonalDistance(currentLocation, routeNodes.get(currentRoute - 1), routeNodes.get(currentRoute));
|
||||||
if ((!settings.DISABLE_OFFROUTE_RECALC.get()) && (distOrth > (1.7 * posTolerance))) {
|
if ((!accessibilityPlugin.DISABLE_OFFROUTE_RECALC.get()) && (distOrth > (1.7 * posTolerance))) {
|
||||||
log.info("Recalculate route, because correlation : " + distOrth); //$NON-NLS-1$
|
log.info("Recalculate route, because correlation : " + distOrth); //$NON-NLS-1$
|
||||||
isDeviatedFromRoute = true;
|
isDeviatedFromRoute = true;
|
||||||
calculateRoute = true;
|
calculateRoute = true;
|
||||||
|
@ -404,7 +407,7 @@ public class RoutingHelper {
|
||||||
// 3. Identify wrong movement direction
|
// 3. Identify wrong movement direction
|
||||||
Location next = route.getNextRouteLocation();
|
Location next = route.getNextRouteLocation();
|
||||||
boolean wrongMovementDirection = checkWrongMovementDirection(currentLocation, next);
|
boolean wrongMovementDirection = checkWrongMovementDirection(currentLocation, next);
|
||||||
if ((!settings.DISABLE_WRONG_DIRECTION_RECALC.get()) && wrongMovementDirection && (currentLocation.distanceTo(routeNodes.get(currentRoute)) > (2 * posTolerance))) {
|
if ((!accessibilityPlugin.DISABLE_WRONG_DIRECTION_RECALC.get()) && wrongMovementDirection && (currentLocation.distanceTo(routeNodes.get(currentRoute)) > (2 * posTolerance))) {
|
||||||
log.info("Recalculate route, because wrong movement direction: " + currentLocation.distanceTo(routeNodes.get(currentRoute))); //$NON-NLS-1$
|
log.info("Recalculate route, because wrong movement direction: " + currentLocation.distanceTo(routeNodes.get(currentRoute))); //$NON-NLS-1$
|
||||||
isDeviatedFromRoute = true;
|
isDeviatedFromRoute = true;
|
||||||
calculateRoute = true;
|
calculateRoute = true;
|
||||||
|
|
|
@ -14,8 +14,10 @@ import android.support.v7.app.AlertDialog;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.access.AccessibilityPlugin;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.SettingsActivity;
|
import net.osmand.plus.activities.SettingsActivity;
|
||||||
import net.osmand.plus.routing.VoiceRouter;
|
import net.osmand.plus.routing.VoiceRouter;
|
||||||
|
@ -83,8 +85,9 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
|
||||||
ctx.getString(R.string.voice_data_corrupted));
|
ctx.getString(R.string.voice_data_corrupted));
|
||||||
}
|
}
|
||||||
OsmandApplication app = (OsmandApplication) ctx.getApplicationContext();
|
OsmandApplication app = (OsmandApplication) ctx.getApplicationContext();
|
||||||
if(app.accessibilityEnabled()) {
|
AccessibilityPlugin accessibilityPlugin = OsmandPlugin.getPlugin(AccessibilityPlugin.class);
|
||||||
cSpeechRate = app.getSettings().SPEECH_RATE.get();
|
if (app.accessibilityEnabled() && accessibilityPlugin != null) {
|
||||||
|
cSpeechRate = accessibilityPlugin.SPEECH_RATE.get();
|
||||||
}
|
}
|
||||||
initializeEngine(app, ctx);
|
initializeEngine(app, ctx);
|
||||||
params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, app.getSettings().AUDIO_STREAM_GUIDANCE
|
params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, app.getSettings().AUDIO_STREAM_GUIDANCE
|
||||||
|
|
Loading…
Reference in a new issue