Unnecessary fixes

This commit is contained in:
Nazar 2019-10-22 14:41:35 +03:00
parent e336c3b184
commit 78c85efb4e
3 changed files with 24 additions and 25 deletions

View file

@ -14,7 +14,7 @@
<string name="shared_string_memory_used_tb_desc">Used %1$s TB</string> <string name="shared_string_memory_used_tb_desc">Used %1$s TB</string>
<string name="shared_string_memory_used_gb_desc">Used %1$s GB</string> <string name="shared_string_memory_used_gb_desc">Used %1$s GB</string>
<string name="shared_string_memory_used_mb_desc">Used %1$s MB</string> <string name="shared_string_memory_used_mb_desc">Used %1$s MB</string>
<string name="shared_string_memory_used_kb_desc">Used %1$s KB</string> <string name="shared_string_memory_used_kb_desc">Used %1$s kB</string>
<string name="contour_lines_and_hillshade">Contour lines and Hillshade</string> <string name="contour_lines_and_hillshade">Contour lines and Hillshade</string>
<string name="shared_string_calculate">Calculate</string> <string name="shared_string_calculate">Calculate</string>
<string name="shared_string_osmand_usage">OsmAnd Usage</string> <string name="shared_string_osmand_usage">OsmAnd Usage</string>
@ -23,7 +23,7 @@
<string name="shared_string_memory_tb_desc">%1$s TB</string> <string name="shared_string_memory_tb_desc">%1$s TB</string>
<string name="shared_string_memory_gb_desc">%1$s GB</string> <string name="shared_string_memory_gb_desc">%1$s GB</string>
<string name="shared_string_memory_mb_desc">%1$s MB</string> <string name="shared_string_memory_mb_desc">%1$s MB</string>
<string name="shared_string_memory_kb_desc">%1$s KB</string> <string name="shared_string_memory_kb_desc">%1$s kB</string>
<string name="app_mode_utv">Side by Side</string> <string name="app_mode_utv">Side by Side</string>
<string name="rendering_attr_piste_difficulty_aerialway_name">Aerialway</string> <string name="rendering_attr_piste_difficulty_aerialway_name">Aerialway</string>
<string name="rendering_attr_piste_difficulty_connection_name">Connection</string> <string name="rendering_attr_piste_difficulty_connection_name">Connection</string>

View file

@ -162,9 +162,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID; 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, public class MapActivity extends OsmandActionBarActivity implements DownloadEvents,
OnRequestPermissionsResultCallback, IRouteInformationListener, AMapPointUpdateListener, OnRequestPermissionsResultCallback, IRouteInformationListener, AMapPointUpdateListener,
@ -1868,9 +1865,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
OsmandPlugin.onRequestPermissionsResult(requestCode, permissions, grantResults); OsmandPlugin.onRequestPermissionsResult(requestCode, permissions, grantResults);
MapControlsLayer mcl = mapView.getLayerByClass(MapControlsLayer.class); MapControlsLayer mcl = mapView.getLayerByClass(MapControlsLayer.class);
if (mcl != null && (requestCode == REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION if (mcl != null) {
|| requestCode == REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION
|| requestCode == REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION)) {
mcl.onRequestPermissionsResult(requestCode, permissions, grantResults); mcl.onRequestPermissionsResult(requestCode, permissions, grantResults);
} }

View file

@ -75,9 +75,9 @@ import static net.osmand.aidlapi.OsmAndCustomizationConstants.ZOOM_OUT_HUD_ID;
public class MapControlsLayer extends OsmandMapLayer { public class MapControlsLayer extends OsmandMapLayer {
private static final int TIMEOUT_TO_SHOW_BUTTONS = 7000; private static final int TIMEOUT_TO_SHOW_BUTTONS = 7000;
public static final int REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION = 200; private static final int REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION = 200;
public static final int REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION = 201; private 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_ADD_DESTINATION_PERMISSION = 202;
private static final int COMPASS_PRESSED_TIME_INTERVAL_MS = 5000; 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) { public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
if (grantResults.length > 0) { if ((requestCode == REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { || requestCode == REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION
switch (requestCode) { || requestCode == REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION)) {
case REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION: if (grantResults.length > 0) {
onNavigationClick(); if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
break; switch (requestCode) {
case REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION: case REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION:
navigateButton(); onNavigationClick();
break; break;
case REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION: case REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION:
addDestination(requestedLatLon); navigateButton();
break; 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);
} }
} }
} }