Handle "+", "-" and "=" keycode for change map zoom, regardless external input device settings

This commit is contained in:
nazar-kutz 2021-04-19 17:46:42 +03:00
parent aa846ab405
commit a2a3087b68

View file

@ -94,6 +94,12 @@ public class MapActivityKeyListener implements KeyEvent.Callback {
mapActivity.getMapViewTrackingUtilities().backToLocationImpl(); mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
} else if (keyCode == KeyEvent.KEYCODE_D) { } else if (keyCode == KeyEvent.KEYCODE_D) {
mapActivity.getMapViewTrackingUtilities().switchRotateMapMode(); 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)) { } else if (mapScrollHelper.isAvailableKeyCode(keyCode)) {
return mapScrollHelper.onKeyUp(keyCode, event); return mapScrollHelper.onKeyUp(keyCode, event);
} else if (settings.EXTERNAL_INPUT_DEVICE.get() == PARROT_EXTERNAL_DEVICE) { } else if (settings.EXTERNAL_INPUT_DEVICE.get() == PARROT_EXTERNAL_DEVICE) {
@ -120,14 +126,6 @@ public class MapActivityKeyListener implements KeyEvent.Callback {
mapActivity.startActivity(intent); mapActivity.startActivity(intent);
return true; 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)) { } else if (OsmandPlugin.onMapActivityKeyUp(mapActivity, keyCode)) {
return true; return true;
} }