Implemented autoannounce control options for accessibility mode.
This commit is contained in:
parent
c499d701d5
commit
1111ed1928
5 changed files with 41 additions and 3 deletions
|
@ -2000,4 +2000,8 @@
|
||||||
<string name="access_hint_enter_description">Введите описание</string>
|
<string name="access_hint_enter_description">Введите описание</string>
|
||||||
<string name="access_category_choice">Выберите категорию</string>
|
<string name="access_category_choice">Выберите категорию</string>
|
||||||
<string name="access_default_color">Цвет по умолчанию</string>
|
<string name="access_default_color">Цвет по умолчанию</string>
|
||||||
|
<string name="access_smart_autoannounce">Интеллектуальное автооповещение</string>
|
||||||
|
<string name="access_smart_autoannounce_descr">Говорить только при изменении направления на целевую точку</string>
|
||||||
|
<string name="access_autoannounce_period">Период автооповещений</string>
|
||||||
|
<string name="access_autoannounce_period_descr">Минимальное время между оповещениями</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
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="access_smart_autoannounce">Smart autoannounce</string>
|
||||||
|
<string name="access_smart_autoannounce_descr">Notify only when direction to the target point is changed</string>
|
||||||
|
<string name="access_autoannounce_period">Autoannounce period</string>
|
||||||
|
<string name="access_autoannounce_period_descr">Minimal time interval between announces</string>
|
||||||
<string name="access_default_color">Default color</string>
|
<string name="access_default_color">Default color</string>
|
||||||
<string name="access_category_choice">Choose category</string>
|
<string name="access_category_choice">Choose category</string>
|
||||||
<string name="access_hint_enter_name">Enter name</string>
|
<string name="access_hint_enter_name">Enter name</string>
|
||||||
|
|
|
@ -20,7 +20,6 @@ import java.util.List;
|
||||||
|
|
||||||
public class NavigationInfo {
|
public class NavigationInfo {
|
||||||
|
|
||||||
private static final long MIN_NOTIFICATION_PERIOD = 10000;
|
|
||||||
private static final float FULL_CIRCLE = 360.0f;
|
private static final float FULL_CIRCLE = 360.0f;
|
||||||
|
|
||||||
private class RelativeDirection {
|
private class RelativeDirection {
|
||||||
|
@ -227,11 +226,11 @@ public class NavigationInfo {
|
||||||
if (point != null) {
|
if (point != null) {
|
||||||
if ((currentLocation != null) && currentLocation.hasBearing()) {
|
if ((currentLocation != null) && currentLocation.hasBearing()) {
|
||||||
final long now = SystemClock.uptimeMillis();
|
final long now = SystemClock.uptimeMillis();
|
||||||
if ((now - lastNotificationTime) >= MIN_NOTIFICATION_PERIOD) {
|
if ((now - lastNotificationTime) >= settings.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)) {
|
if (lastDirection.update(destination) || !settings.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() {
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
||||||
|
|
||||||
private ListPreference accessibilityModePreference;
|
private ListPreference accessibilityModePreference;
|
||||||
private ListPreference directionStylePreference;
|
private ListPreference directionStylePreference;
|
||||||
|
private ListPreference autoannouncePeriodPreference;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,6 +72,25 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
||||||
});
|
});
|
||||||
cat.addPreference(directionStylePreference);
|
cat.addPreference(directionStylePreference);
|
||||||
|
|
||||||
|
cat.addPreference(createCheckBoxPreference(settings.ACCESSIBILITY_SMART_AUTOANNOUNCE, R.string.access_smart_autoannounce,
|
||||||
|
R.string.access_smart_autoannounce_descr));
|
||||||
|
|
||||||
|
final int[] seconds = new int[] {5, 10, 15, 20, 30, 45, 60, 90};
|
||||||
|
final int[] minutes = new int[] {2, 3, 5};
|
||||||
|
autoannouncePeriodPreference = createTimeListPreference(settings.ACCESSIBILITY_AUTOANNOUNCE_PERIOD, seconds, minutes, 1000,
|
||||||
|
R.string.access_autoannounce_period, R.string.access_autoannounce_period_descr);
|
||||||
|
autoannouncePeriodPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
|
private final OnPreferenceChangeListener committer = autoannouncePeriodPreference.getOnPreferenceChangeListener();
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
if (committer != null)
|
||||||
|
committer.onPreferenceChange(preference, newValue);
|
||||||
|
updateAllSettings();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cat.addPreference(autoannouncePeriodPreference);
|
||||||
|
|
||||||
cat.addPreference(createCheckBoxPreference(settings.ZOOM_BY_TRACKBALL, R.string.zoom_by_trackball,
|
cat.addPreference(createCheckBoxPreference(settings.ZOOM_BY_TRACKBALL, R.string.zoom_by_trackball,
|
||||||
R.string.zoom_by_trackball_descr));
|
R.string.zoom_by_trackball_descr));
|
||||||
}
|
}
|
||||||
|
@ -98,6 +118,9 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
||||||
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) + " [" + settings.DIRECTION_STYLE.get().toHumanString(getMyApplication()) + "]");
|
||||||
}
|
}
|
||||||
|
if(autoannouncePeriodPreference != null) {
|
||||||
|
autoannouncePeriodPreference.setSummary(getString(R.string.access_autoannounce_period_descr) + " [" + autoannouncePeriodPreference.getEntry() + "]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -779,6 +779,14 @@ 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).makeGlobal();
|
new BooleanPreference("use_trackball_for_movements", true).makeGlobal();
|
||||||
|
|
||||||
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
|
public final OsmandPreference<Boolean> ACCESSIBILITY_SMART_AUTOANNOUNCE =
|
||||||
|
new BooleanAccessibilityPreference("accessibility_smart_autoannounce", true).makeGlobal();
|
||||||
|
|
||||||
|
// 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).makeGlobal().cache();
|
||||||
|
|
||||||
// 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> ZOOM_BY_TRACKBALL =
|
public final OsmandPreference<Boolean> ZOOM_BY_TRACKBALL =
|
||||||
new BooleanAccessibilityPreference("zoom_by_trackball", false).makeGlobal();
|
new BooleanAccessibilityPreference("zoom_by_trackball", false).makeGlobal();
|
||||||
|
|
Loading…
Reference in a new issue