Merge pull request #7071 from osmandapp/CompassControlsImprovements
Add ui check for map orientation change in following mode
This commit is contained in:
commit
44c89a1913
2 changed files with 18 additions and 1 deletions
|
@ -11,6 +11,7 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
<string name="press_again_to_change_the_map_orientation">Press again to change the map orientation</string>
|
||||
<string name="process_downloading_service">OsmAnd downloading service</string>
|
||||
<string name="shared_string_color_magenta">Magenta</string>
|
||||
<string name="shared_string_icon">Icon</string>
|
||||
|
|
|
@ -79,6 +79,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
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 COMPASS_PRESSED_TIME_INTERVAL_MS = 5000;
|
||||
|
||||
public MapHudButton createHudButton(View iv, int resId, String id) {
|
||||
MapHudButton mc = new MapHudButton();
|
||||
mc.iv = iv;
|
||||
|
@ -120,6 +122,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
private MapQuickActionLayer mapQuickActionLayer;
|
||||
private boolean forceShowCompass;
|
||||
private LatLon requestedLatLon;
|
||||
private long compassPressed;
|
||||
|
||||
public MapControlsLayer(MapActivity activity) {
|
||||
this.mapActivity = activity;
|
||||
|
@ -271,7 +274,20 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
compass.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mapActivity.getMapViewTrackingUtilities().switchRotateMapMode();
|
||||
boolean followingMode = app.getRoutingHelper().isFollowingMode();
|
||||
|
||||
if (followingMode) {
|
||||
if (compassPressed + COMPASS_PRESSED_TIME_INTERVAL_MS > System.currentTimeMillis()) {
|
||||
compassPressed = 0;
|
||||
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue