diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index a95c3d5baa..6e650fa149 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -14,7 +14,7 @@ Used %1$s TB Used %1$s GB Used %1$s MB - Used %1$s KB + Used %1$s kB Contour lines and Hillshade Calculate OsmAnd Usage @@ -23,7 +23,7 @@ %1$s TB %1$s GB %1$s MB - %1$s KB + %1$s kB Side by Side Aerialway Connection diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index d460488e8a..73d9037086 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -162,9 +162,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID; -import static net.osmand.plus.views.MapControlsLayer.REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION; -import static net.osmand.plus.views.MapControlsLayer.REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION; -import static net.osmand.plus.views.MapControlsLayer.REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION; public class MapActivity extends OsmandActionBarActivity implements DownloadEvents, OnRequestPermissionsResultCallback, IRouteInformationListener, AMapPointUpdateListener, @@ -1868,9 +1865,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven OsmandPlugin.onRequestPermissionsResult(requestCode, permissions, grantResults); MapControlsLayer mcl = mapView.getLayerByClass(MapControlsLayer.class); - if (mcl != null && (requestCode == REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION - || requestCode == REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION - || requestCode == REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION)) { + if (mcl != null) { mcl.onRequestPermissionsResult(requestCode, permissions, grantResults); } diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index 2380f28411..5fc9863137 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -75,9 +75,9 @@ import static net.osmand.aidlapi.OsmAndCustomizationConstants.ZOOM_OUT_HUD_ID; public class MapControlsLayer extends OsmandMapLayer { private static final int TIMEOUT_TO_SHOW_BUTTONS = 7000; - public static final int REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION = 200; - public static final int REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION = 201; - public static final int REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION = 202; + private static final int REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION = 200; + 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; @@ -1278,21 +1278,25 @@ public class MapControlsLayer extends OsmandMapLayer { } public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { - if (grantResults.length > 0) { - if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { - switch (requestCode) { - case REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION: - onNavigationClick(); - break; - case REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION: - navigateButton(); - break; - case REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION: - addDestination(requestedLatLon); - break; + if ((requestCode == REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION + || requestCode == REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION + || requestCode == REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION)) { + if (grantResults.length > 0) { + if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { + switch (requestCode) { + case REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION: + onNavigationClick(); + break; + case REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION: + navigateButton(); + break; + case REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION: + addDestination(requestedLatLon); + break; + } + } else if (grantResults[0] == PackageManager.PERMISSION_DENIED) { + app.showToastMessage(R.string.ask_for_location_permission); } - } else if (grantResults[0] == PackageManager.PERMISSION_DENIED) { - app.showToastMessage(R.string.ask_for_location_permission); } } }