Merge pull request #11325 from osmandapp/master

Update test branch
This commit is contained in:
Hardy 2021-04-02 19:25:34 +02:00 committed by GitHub
commit b38506cd98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 19 deletions

View file

@ -284,7 +284,6 @@
<string name="poi_ship_chandler">Ship chandler</string> <string name="poi_ship_chandler">Ship chandler</string>
<string name="poi_sports">Sporting goods</string> <string name="poi_sports">Sporting goods</string>
<string name="poi_stationery">Stationery store</string> <string name="poi_stationery">Stationery store</string>
<string name="poi_tableware">Tableware store</string>
<string name="poi_ticket">Ticket sales</string> <string name="poi_ticket">Ticket sales</string>
<string name="poi_tobacco">Tobacco store</string> <string name="poi_tobacco">Tobacco store</string>
<string name="poi_toys">Toyshop</string> <string name="poi_toys">Toyshop</string>
@ -4379,4 +4378,6 @@
<string name="poi_horseshoes">Horseshoes</string> <string name="poi_horseshoes">Horseshoes</string>
<string name="poi_kickboxing">Kickboxing</string> <string name="poi_kickboxing">Kickboxing</string>
<string name="poi_office_diplomatic">Diplomatic office</string>
</resources> </resources>

View file

@ -92,6 +92,8 @@ public class MapActivityKeyListener implements KeyEvent.Callback {
return true; return true;
} else if (keyCode == KeyEvent.KEYCODE_C) { } else if (keyCode == KeyEvent.KEYCODE_C) {
mapActivity.getMapViewTrackingUtilities().backToLocationImpl(); mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
} else if (keyCode == KeyEvent.KEYCODE_D) {
mapActivity.getMapViewTrackingUtilities().switchRotateMapMode();
} else if (settings.EXTERNAL_INPUT_DEVICE.get() == PARROT_EXTERNAL_DEVICE) { } else if (settings.EXTERNAL_INPUT_DEVICE.get() == PARROT_EXTERNAL_DEVICE) {
// Parrot device has only dpad left and right // Parrot device has only dpad left and right
if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {

View file

@ -39,6 +39,8 @@ import java.util.Map;
public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLocationListener, public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLocationListener,
OsmAndCompassListener, MapMarkerChangedListener { OsmAndCompassListener, MapMarkerChangedListener {
private static final int COMPASS_REQUEST_TIME_INTERVAL_MS = 5000;
private static final int AUTO_FOLLOW_MSG_ID = OsmAndConstants.UI_HANDLER_LOCATION_SERVICE + 4; private static final int AUTO_FOLLOW_MSG_ID = OsmAndConstants.UI_HANDLER_LOCATION_SERVICE + 4;
private long lastTimeAutoZooming = 0; private long lastTimeAutoZooming = 0;
@ -59,6 +61,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
private Float heading; private Float heading;
private boolean drivingRegionUpdated = false; private boolean drivingRegionUpdated = false;
private boolean movingToMyLocation = false; private boolean movingToMyLocation = false;
private long compassRequest;
public MapViewTrackingUtilities(OsmandApplication app){ public MapViewTrackingUtilities(OsmandApplication app){
this.app = app; this.app = app;
@ -424,7 +427,22 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
setMapLinkedToLocation(false); setMapLinkedToLocation(false);
} }
public void switchRotateMapMode(){ public void switchRotateMapMode() {
if (app.getRoutingHelper().isFollowingMode()) {
if (compassRequest + COMPASS_REQUEST_TIME_INTERVAL_MS > System.currentTimeMillis()) {
compassRequest = 0;
switchRotateMapModeImpl();
} else {
compassRequest = System.currentTimeMillis();
app.showShortToastMessage(app.getString(R.string.press_again_to_change_the_map_orientation));
}
} else {
compassRequest = 0;
switchRotateMapModeImpl();
}
}
private void switchRotateMapModeImpl(){
if (mapView != null) { if (mapView != null) {
String rotMode = app.getString(R.string.rotate_map_none_opt); String rotMode = app.getString(R.string.rotate_map_none_opt);
if (settings.ROTATE_MAP.get() == OsmandSettings.ROTATE_MAP_NONE && mapView.getRotate() != 0) { if (settings.ROTATE_MAP.get() == OsmandSettings.ROTATE_MAP_NONE && mapView.getRotate() != 0) {

View file

@ -97,8 +97,6 @@ public class MapControlsLayer extends OsmandMapLayer {
private static final int REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION = 201; private static final int REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION = 201;
private static final int REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION = 202; private static final int REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION = 202;
private static final int COMPASS_PRESSED_TIME_INTERVAL_MS = 5000;
public MapHudButton createHudButton(View iv, int resId, String id) { public MapHudButton createHudButton(View iv, int resId, String id) {
MapHudButton mc = new MapHudButton(); MapHudButton mc = new MapHudButton();
mc.iv = iv; mc.iv = iv;
@ -139,7 +137,6 @@ public class MapControlsLayer extends OsmandMapLayer {
private MapQuickActionLayer mapQuickActionLayer; private MapQuickActionLayer mapQuickActionLayer;
private boolean forceShowCompass; private boolean forceShowCompass;
private LatLon requestedLatLon; private LatLon requestedLatLon;
private long compassPressed;
private Set<String> themeInfoProviderTags = new HashSet<>(); private Set<String> themeInfoProviderTags = new HashSet<>();
public MapControlsLayer(MapActivity activity) { public MapControlsLayer(MapActivity activity) {
@ -292,20 +289,7 @@ public class MapControlsLayer extends OsmandMapLayer {
compass.setOnClickListener(new View.OnClickListener() { compass.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
boolean followingMode = app.getRoutingHelper().isFollowingMode();
if (followingMode) {
if (compassPressed + COMPASS_PRESSED_TIME_INTERVAL_MS > System.currentTimeMillis()) {
compassPressed = 0;
mapActivity.getMapViewTrackingUtilities().switchRotateMapMode(); mapActivity.getMapViewTrackingUtilities().switchRotateMapMode();
} else {
compassPressed = System.currentTimeMillis();
app.showShortToastMessage(app.getString(R.string.press_again_to_change_the_map_orientation));
}
} else {
compassPressed = 0;
mapActivity.getMapViewTrackingUtilities().switchRotateMapMode();
}
} }
}); });