misc changes
* restore permission request popup previously removed in #2486 * use legacy file picker in cases where saf file picker is not available * fix missing file check logic in prepareSelectedDownload method (DownloadDialog.java)
This commit is contained in:
parent
950cf714d9
commit
dee3a18ea8
7 changed files with 88 additions and 30 deletions
|
|
@ -446,6 +446,9 @@ public class NavigationHelper {
|
|||
}
|
||||
|
||||
public static boolean openDownloads(Activity activity) {
|
||||
if (!PermissionHelper.checkStoragePermissions(activity, PermissionHelper.DOWNLOADS_REQUEST_CODE)) {
|
||||
return false;
|
||||
}
|
||||
Intent intent = new Intent(activity, DownloadActivity.class);
|
||||
activity.startActivity(intent);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -18,10 +18,12 @@ import android.widget.Toast;
|
|||
import org.schabi.newpipe.R;
|
||||
|
||||
public class PermissionHelper {
|
||||
public static final int DOWNLOAD_DIALOG_REQUEST_CODE = 778;
|
||||
public static final int DOWNLOADS_REQUEST_CODE = 777;
|
||||
|
||||
public static boolean checkStoragePermissions(Activity activity, int requestCode) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
if(!checkReadStoragePermissions(activity, requestCode)) return false;
|
||||
if (!checkReadStoragePermissions(activity, requestCode)) return false;
|
||||
}
|
||||
return checkWriteStoragePermissions(activity, requestCode);
|
||||
}
|
||||
|
|
@ -89,7 +91,7 @@ public class PermissionHelper {
|
|||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(i);
|
||||
return false;
|
||||
}else return true;
|
||||
} else return true;
|
||||
}
|
||||
|
||||
public static boolean isPopupEnabled(Context context) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue