diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index e367c18ed3..afa42491fe 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1920,6 +1920,12 @@ Install version Choose how the app looks. App theme + External input devices + Select a device such as a generic keyboard or WunderLINQ for external controls. + None + Generic Keyboard + WunderLINQ + Parrot Accessibility options Select address Select Favorite @@ -2434,8 +2440,6 @@ I am here Change map zooming by horizontal trackball movement. Use trackball for zoom control - Change map zooming by scrolling the wheel up and down. Escape returns you to the WunderLINQ App. - Use WunderLINQ for control Accessibility related preferences. Early Normal diff --git a/OsmAnd/res/xml/general_settings.xml b/OsmAnd/res/xml/general_settings.xml index 2a617db786..6060bcc19c 100644 --- a/OsmAnd/res/xml/general_settings.xml +++ b/OsmAnd/res/xml/general_settings.xml @@ -15,6 +15,7 @@ + diff --git a/OsmAnd/src/net/osmand/access/SettingsAccessibilityActivity.java b/OsmAnd/src/net/osmand/access/SettingsAccessibilityActivity.java index fef0b41f88..e3ab2b4c0a 100644 --- a/OsmAnd/src/net/osmand/access/SettingsAccessibilityActivity.java +++ b/OsmAnd/src/net/osmand/access/SettingsAccessibilityActivity.java @@ -101,10 +101,6 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity { cat.addPreference(createCheckBoxPreference(settings.DIRECTION_HAPTIC_FEEDBACK, R.string.access_direction_haptic_feedback, R.string.access_direction_haptic_feedback_descr)); - cat.addPreference(createCheckBoxPreference(settings.ZOOM_BY_TRACKBALL, R.string.zoom_by_trackball, - R.string.zoom_by_trackball_descr)); - cat.addPreference(createCheckBoxPreference(settings.ZOOM_BY_WUNDERLINQ, R.string.zoom_by_wunderlinq, - R.string.zoom_by_wunderlinq_descr)); } diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 00ce5d7bbf..9f1b93e696 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1050,15 +1050,6 @@ public class OsmandSettings { // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference DIRECTION_HAPTIC_FEEDBACK = new BooleanAccessibilityPreference("direction_haptic_feedback", false).makeGlobal(); - - // this value string is synchronized with settings_pref.xml preference name - public final OsmandPreference ZOOM_BY_TRACKBALL = - new BooleanAccessibilityPreference("zoom_by_trackball", false).makeGlobal(); - - // this value string is synchronized with settings_pref.xml preference name - public final OsmandPreference ZOOM_BY_WUNDERLINQ = - new BooleanAccessibilityPreference("zoom_by_wunderlinq", false).makeGlobal(); - // magnetic field doesn'torkmost of the time on some phones public final OsmandPreference USE_MAGNETIC_FIELD_SENSOR_COMPASS = new BooleanPreference("use_magnetic_field_sensor_compass", false).makeGlobal().cache(); @@ -1507,6 +1498,9 @@ public class OsmandSettings { public final OsmandPreference ANIMATE_MY_LOCATION = new BooleanPreference("animate_my_location", true).makeGlobal().cache(); + public final OsmandPreference EXTERNAL_INPUT_DEVICE = + new IntPreference("external_input_device", 0).makeGlobal(); + public final OsmandPreference ROUTE_MAP_MARKERS_START_MY_LOC = new BooleanPreference("route_map_markers_start_my_loc", false).makeGlobal().cache(); public final OsmandPreference ROUTE_MAP_MARKERS_ROUND_TRIP = new BooleanPreference("route_map_markers_round_trip", false).makeGlobal().cache(); @@ -2752,6 +2746,10 @@ public class OsmandSettings { public static final int OSMAND_DARK_THEME = 0; public static final int OSMAND_LIGHT_THEME = 1; + public static final int NO_EXTERNAL_DEVICE = 0; + public static final int GENERIC_EXTERNAL_DEVICE = 1; + public static final int WUNDERLINQ_EXTERNAL_DEVICE = 2; + public static final int PARROT_EXTERNAL_DEVICE = 3; public final CommonPreference SEARCH_TAB = new IntPreference("SEARCH_TAB", 0).makeGlobal().cache(); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index ade0e50acd..11fb488f19 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -1486,7 +1486,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven // repeat count 0 doesn't work for samsung, 1 doesn't work for lg toggleDrawer(); return true; - } else if (settings.ZOOM_BY_TRACKBALL.get()) { + } else if (settings.EXTERNAL_INPUT_DEVICE.get() == 3) { // Parrot device has only dpad left and right if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { changeZoom(-1); @@ -1495,7 +1495,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven changeZoom(1); return true; } - } else if (settings.ZOOM_BY_WUNDERLINQ.get()) { + } else if (settings.EXTERNAL_INPUT_DEVICE.get() == 2) { // WunderLINQ device, motorcycle smart phone control if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) { changeZoom(-1); @@ -1510,6 +1510,14 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven startActivity(intent); return true; } + } else if (settings.EXTERNAL_INPUT_DEVICE.get() == 1) { + if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) { + changeZoom(-1); + return true; + } else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { + changeZoom(1); + return true; + } } else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT || keyCode == KeyEvent.KEYCODE_DPAD_DOWN || keyCode == KeyEvent.KEYCODE_DPAD_UP) { int dx = keyCode == KeyEvent.KEYCODE_DPAD_RIGHT ? 15 : (keyCode == KeyEvent.KEYCODE_DPAD_LEFT ? -15 : 0); diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java index 153691f46f..8ad6670e60 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java @@ -498,6 +498,11 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR new String[]{getString(R.string.dark_theme), getString(R.string.light_theme)}, new Integer[]{OsmandSettings.OSMAND_DARK_THEME, OsmandSettings.OSMAND_LIGHT_THEME}); + registerListPreference( + settings.EXTERNAL_INPUT_DEVICE, misc, + new String[]{getString(R.string.sett_no_ext_input), getString(R.string.sett_generic_ext_input), getString(R.string.sett_wunderlinq_ext_input), getString(R.string.sett_parrot_ext_input)}, new Integer[]{OsmandSettings.NO_EXTERNAL_DEVICE, + OsmandSettings.GENERIC_EXTERNAL_DEVICE, OsmandSettings.WUNDERLINQ_EXTERNAL_DEVICE, OsmandSettings.PARROT_EXTERNAL_DEVICE}); + misc.addPreference(createCheckBoxPreference(settings.USE_KALMAN_FILTER_FOR_COMPASS, R.string.use_kalman_filter_compass, R.string.use_kalman_filter_compass_descr)); misc.addPreference(createCheckBoxPreference(settings.USE_MAGNETIC_FIELD_SENSOR_COMPASS, R.string.use_magnetic_sensor, R.string.use_magnetic_sensor_descr)); misc.addPreference(createCheckBoxPreference(settings.DO_NOT_USE_ANIMATIONS, R.string.do_not_use_animations, R.string.do_not_use_animations_descr));