From a2a3087b68d452796f5173db33a2fbd2bdc861d0 Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Mon, 19 Apr 2021 17:46:42 +0300 Subject: [PATCH 1/2] Handle "+", "-" and "=" keycode for change map zoom, regardless external input device settings --- .../plus/activities/MapActivityKeyListener.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityKeyListener.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityKeyListener.java index 33ce52296b..846ac975ab 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityKeyListener.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityKeyListener.java @@ -94,6 +94,12 @@ public class MapActivityKeyListener implements KeyEvent.Callback { mapActivity.getMapViewTrackingUtilities().backToLocationImpl(); } else if (keyCode == KeyEvent.KEYCODE_D) { mapActivity.getMapViewTrackingUtilities().switchRotateMapMode(); + } if (keyCode == KeyEvent.KEYCODE_MINUS) { + mapActivity.changeZoom(-1); + return true; + } else if (keyCode == KeyEvent.KEYCODE_PLUS || keyCode == KeyEvent.KEYCODE_EQUALS) { + mapActivity.changeZoom(1); + return true; } else if (mapScrollHelper.isAvailableKeyCode(keyCode)) { return mapScrollHelper.onKeyUp(keyCode, event); } else if (settings.EXTERNAL_INPUT_DEVICE.get() == PARROT_EXTERNAL_DEVICE) { @@ -120,14 +126,6 @@ public class MapActivityKeyListener implements KeyEvent.Callback { mapActivity.startActivity(intent); return true; } - } else if (settings.EXTERNAL_INPUT_DEVICE.get() == GENERIC_EXTERNAL_DEVICE) { - if (keyCode == KeyEvent.KEYCODE_MINUS) { - mapActivity.changeZoom(-1); - return true; - } else if (keyCode == KeyEvent.KEYCODE_PLUS || keyCode == KeyEvent.KEYCODE_EQUALS) { - mapActivity.changeZoom(1); - return true; - } } else if (OsmandPlugin.onMapActivityKeyUp(mapActivity, keyCode)) { return true; } From 116742f3480b33ae8d861380f98b6c6a41508b54 Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Mon, 19 Apr 2021 17:57:09 +0300 Subject: [PATCH 2/2] small fixes --- .../net/osmand/plus/activities/MapActivityKeyListener.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityKeyListener.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityKeyListener.java index 846ac975ab..4b99e84350 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityKeyListener.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityKeyListener.java @@ -94,7 +94,7 @@ public class MapActivityKeyListener implements KeyEvent.Callback { mapActivity.getMapViewTrackingUtilities().backToLocationImpl(); } else if (keyCode == KeyEvent.KEYCODE_D) { mapActivity.getMapViewTrackingUtilities().switchRotateMapMode(); - } if (keyCode == KeyEvent.KEYCODE_MINUS) { + } else if (keyCode == KeyEvent.KEYCODE_MINUS) { mapActivity.changeZoom(-1); return true; } else if (keyCode == KeyEvent.KEYCODE_PLUS || keyCode == KeyEvent.KEYCODE_EQUALS) { @@ -126,6 +126,8 @@ public class MapActivityKeyListener implements KeyEvent.Callback { mapActivity.startActivity(intent); return true; } + } else if (settings.EXTERNAL_INPUT_DEVICE.get() == GENERIC_EXTERNAL_DEVICE) { + // currently doesn't process specific commands } else if (OsmandPlugin.onMapActivityKeyUp(mapActivity, keyCode)) { return true; }