Reimplement storing backup import/export path

#6319 and #6402 were reverted before adding SAF changes, and have been readded at the end of SAF changes
This commit is contained in:
Stypox 2021-06-06 22:15:32 +02:00
parent 5ffc667bea
commit 2a99e0e435
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
7 changed files with 155 additions and 55 deletions

View file

@ -29,14 +29,13 @@ import com.nononsenseapps.filepicker.Utils;
import org.schabi.newpipe.R;
import org.schabi.newpipe.settings.NewPipeSettings;
import org.schabi.newpipe.streams.io.StoredFileHelper;
import org.schabi.newpipe.util.FilePickerActivityHelper;
import org.schabi.newpipe.util.ThemeHelper;
import java.io.File;
import java.io.IOException;
import us.shandian.giga.get.DownloadMission;
import org.schabi.newpipe.streams.io.StoredFileHelper;
import us.shandian.giga.service.DownloadManager;
import us.shandian.giga.service.DownloadManagerService;
import us.shandian.giga.service.DownloadManagerService.DownloadManagerBinder;
@ -242,9 +241,9 @@ public class MissionsFragment extends Fragment {
private void recoverMission(@NonNull DownloadMission mission) {
unsafeMissionTarget = mission;
final String startPath;
final Uri initialPath;
if (NewPipeSettings.useStorageAccessFramework(mContext)) {
startPath = null;
initialPath = null;
} else {
final File initialSavePath;
if (DownloadManager.TAG_AUDIO.equals(mission.storage.getType())) {
@ -252,11 +251,11 @@ public class MissionsFragment extends Fragment {
} else {
initialSavePath = NewPipeSettings.getDir(Environment.DIRECTORY_MOVIES);
}
startPath = initialSavePath.getAbsolutePath();
initialPath = Uri.parse(initialSavePath.getAbsolutePath());
}
startActivityForResult(StoredFileHelper.getNewPicker(mContext, startPath,
mission.storage.getName(), mission.storage.getType()), REQUEST_DOWNLOAD_SAVE_AS);
startActivityForResult(StoredFileHelper.getNewPicker(mContext, mission.storage.getName(),
mission.storage.getType(), initialPath), REQUEST_DOWNLOAD_SAVE_AS);
}
@Override