Show an alert/dialog when no appropriate file-manager was found
This commit is contained in:
parent
aec26e951a
commit
9285958b4f
8 changed files with 114 additions and 20 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package org.schabi.newpipe.download;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
|
|
@ -53,6 +54,7 @@ import org.schabi.newpipe.extractor.stream.StreamInfo;
|
|||
import org.schabi.newpipe.extractor.stream.SubtitlesStream;
|
||||
import org.schabi.newpipe.extractor.stream.VideoStream;
|
||||
import org.schabi.newpipe.settings.NewPipeSettings;
|
||||
import org.schabi.newpipe.streams.io.NoFileManagerHelper;
|
||||
import org.schabi.newpipe.streams.io.StoredDirectoryHelper;
|
||||
import org.schabi.newpipe.streams.io.StoredFileHelper;
|
||||
import org.schabi.newpipe.util.FilePickerActivityHelper;
|
||||
|
|
@ -687,7 +689,12 @@ public class DownloadDialog extends DialogFragment
|
|||
}
|
||||
|
||||
private void launchDirectoryPicker(final ActivityResultLauncher<Intent> launcher) {
|
||||
launcher.launch(StoredDirectoryHelper.getPicker(context));
|
||||
try {
|
||||
launcher.launch(StoredDirectoryHelper.getPicker(context));
|
||||
} catch (final ActivityNotFoundException aex) {
|
||||
Log.w(TAG, "Unable to launch directory-picker", aex);
|
||||
NoFileManagerHelper.showActivityNotFoundAlert(getContext());
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareSelectedDownload() {
|
||||
|
|
@ -766,8 +773,13 @@ public class DownloadDialog extends DialogFragment
|
|||
initialPath = Uri.parse(initialSavePath.getAbsolutePath());
|
||||
}
|
||||
|
||||
requestDownloadSaveAsLauncher.launch(StoredFileHelper.getNewPicker(context,
|
||||
filenameTmp, mimeTmp, initialPath));
|
||||
try {
|
||||
requestDownloadSaveAsLauncher.launch(StoredFileHelper.getNewPicker(context,
|
||||
filenameTmp, mimeTmp, initialPath));
|
||||
} catch (final ActivityNotFoundException aex) {
|
||||
Log.w(TAG, "Unable to launch file-picker", aex);
|
||||
NoFileManagerHelper.showActivityNotFoundAlert(getContext());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue