Potential aliviation of "Screen Overlay Detected" warning

This commit is contained in:
mhutti1 2016-11-16 15:01:13 +00:00
parent 07a7122e74
commit aa5d4c82c1
2 changed files with 6 additions and 3 deletions

View File

@ -144,4 +144,5 @@
<string name="path_not_writable">Can not access desired directory, using default. To fix this reselect the desired directory in app settings.</string> <string name="path_not_writable">Can not access desired directory, using default. To fix this reselect the desired directory in app settings.</string>
<string name="pref_full_text_search_title">Fulltext Search</string> <string name="pref_full_text_search_title">Fulltext Search</string>
<string name="pref_full_text_search_summary">Allow app to search the text within articles. Caution this can slow search down considerably.</string> <string name="pref_full_text_search_summary">Allow app to search the text within articles. Caution this can slow search down considerably.</string>
<string name="reboot_message">Due to a bug in android 6.0 we require you to reboot your device to continue without granting us the storage permission. We are sorry for any inconvenience this may cause.</string>
</resources> </resources>

View File

@ -935,9 +935,7 @@ public class KiwixMobileActivity extends AppCompatActivity {
} }
public boolean openZimFile(File file, boolean clearHistory) { public boolean openZimFile(File file, boolean clearHistory) {
if (ContextCompat.checkSelfPermission(this, if (file.canRead() || Build.VERSION.SDK_INT < 19 || (Constants.IS_CUSTOM_APP && Build.VERSION.SDK_INT != 23)) {
Manifest.permission.READ_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED || Build.VERSION.SDK_INT < 19 || (Constants.IS_CUSTOM_APP && Build.VERSION.SDK_INT != 23)) {
if (file.exists()) { if (file.exists()) {
if (ZimContentProvider.setZimFile(file.getAbsolutePath()) != null) { if (ZimContentProvider.setZimFile(file.getAbsolutePath()) != null) {
@ -1003,6 +1001,10 @@ public class KiwixMobileActivity extends AppCompatActivity {
newZimFile.setData(Uri.fromFile(mFile)); newZimFile.setData(Uri.fromFile(mFile));
startActivity(newZimFile); startActivity(newZimFile);
} else { } else {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getResources().getString(R.string.reboot_message));
AlertDialog dialog = builder.create();
dialog.show();
finish(); finish();
} }
return; return;