diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d1b767bc1..eefaa1ce6 100755
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -23,6 +23,9 @@
+
= Build.VERSION_CODES.M && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q && ContextCompat.checkSelfPermission(requireActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)
+ != PackageManager.PERMISSION_GRANTED) {
+ ActivityCompat.requestPermissions(requireActivity(), new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_WRITE_STORAGE);
+ } else {
+ TorrentListDialogHelper helper = new TorrentListDialogHelper();
+ Dialog dialog = new MaterialAlertDialogBuilder(context)
+ .setTitle(R.string.torrents)
+ .setView(R.layout.dialog_torrent_list)
+ .setOnDismissListener(helper)
+ .show();
+ helper.setDialog(dialog, mGalleryDetail.torrentUrl);
+ }
}
} else if (mArchive == v) {
if (mGalleryDetail == null) {
@@ -1309,6 +1320,20 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
}
}
+ @Override
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ if (requestCode == REQUEST_WRITE_STORAGE && grantResults[0] == PackageManager.PERMISSION_GRANTED && mGalleryDetail != null) {
+ TorrentListDialogHelper helper = new TorrentListDialogHelper();
+ Dialog dialog = new MaterialAlertDialogBuilder(requireActivity())
+ .setTitle(R.string.torrents)
+ .setView(R.layout.dialog_torrent_list)
+ .setOnDismissListener(helper)
+ .show();
+ helper.setDialog(dialog, mGalleryDetail.torrentUrl);
+ }
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ }
+
private void showFilterUploaderDialog() {
Context context = getContext2();
String uploader = getUploader();