From 70441a706e907ec0f1542b052f8674bcb7d1ef13 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 9 Mar 2016 18:36:56 +0300 Subject: [PATCH] Fix permission --- .../osmand/plus/activities/MapActivity.java | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 899fccfb35..015efb3c34 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -1221,19 +1221,25 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents, if (requestCode == DownloadActivity.PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE && grantResults.length > 0 && permissions.length > 0 - && Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permissions[0]) - && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - new Timer().schedule(new TimerTask() { - @Override - public void run() { - restartApp(); - } - }, 1); - } else { - AccessibleToast.makeText(this, - R.string.missing_write_external_storage_permission, - Toast.LENGTH_LONG).show(); - DataStoragePlaceDialogFragment.showInstance(getSupportFragmentManager(), true); + && Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permissions[0])) { + if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { + new Timer().schedule(new TimerTask() { + @Override + public void run() { + restartApp(); + } + }, 1); + } else { + AccessibleToast.makeText(this, + R.string.missing_write_external_storage_permission, + Toast.LENGTH_LONG).show(); + new Timer().schedule(new TimerTask() { + @Override + public void run() { + DataStoragePlaceDialogFragment.showInstance(getSupportFragmentManager(), true); + } + }, 1); + } } super.onRequestPermissionsResult(requestCode, permissions, grantResults);