kopia lustrzana https://github.com/TeamNewPipe/NewPipe
Pass mime type so that SAF treats file extension correctly
rodzic
eea43d5a73
commit
114dc8ffa0
|
@ -717,7 +717,7 @@ public class DownloadDialog extends DialogFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
startActivityForResult(StoredFileHelper.getNewPicker(context, startPath,
|
startActivityForResult(StoredFileHelper.getNewPicker(context, startPath,
|
||||||
filenameTmp), REQUEST_DOWNLOAD_SAVE_AS);
|
filenameTmp, mimeTmp), REQUEST_DOWNLOAD_SAVE_AS);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
|
||||||
val date = SimpleDateFormat("yyyyMMddHHmm", Locale.ENGLISH).format(Date())
|
val date = SimpleDateFormat("yyyyMMddHHmm", Locale.ENGLISH).format(Date())
|
||||||
val exportName = "newpipe_subscriptions_$date.json"
|
val exportName = "newpipe_subscriptions_$date.json"
|
||||||
|
|
||||||
startActivityForResult(StoredFileHelper.getNewPicker(activity, null, exportName), REQUEST_EXPORT_CODE)
|
startActivityForResult(StoredFileHelper.getNewPicker(activity, null, exportName, "application/json"), REQUEST_EXPORT_CODE)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openReorderDialog() {
|
private fun openReorderDialog() {
|
||||||
|
|
|
@ -66,7 +66,8 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
exportDataPreference.setOnPreferenceClickListener((final Preference p) -> {
|
exportDataPreference.setOnPreferenceClickListener((final Preference p) -> {
|
||||||
final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US);
|
final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US);
|
||||||
startActivityForResult(StoredFileHelper.getNewPicker(getContext(), null,
|
startActivityForResult(StoredFileHelper.getNewPicker(getContext(), null,
|
||||||
"NewPipeData-" + sdf.format(new Date()) + ".zip"), REQUEST_EXPORT_PATH);
|
"NewPipeData-" + sdf.format(new Date()) + ".zip", "application/zip"),
|
||||||
|
REQUEST_EXPORT_PATH);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -467,13 +467,15 @@ public class StoredFileHelper implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Intent getNewPicker(@NonNull final Context ctx, @Nullable final String startPath,
|
public static Intent getNewPicker(@NonNull final Context ctx,
|
||||||
@Nullable final String filename) {
|
@Nullable final String startPath,
|
||||||
|
@Nullable final String filename,
|
||||||
|
@NonNull final String mimeType) {
|
||||||
final Intent i;
|
final Intent i;
|
||||||
if (NewPipeSettings.useStorageAccessFramework(ctx)) {
|
if (NewPipeSettings.useStorageAccessFramework(ctx)) {
|
||||||
i = new Intent(Intent.ACTION_CREATE_DOCUMENT)
|
i = new Intent(Intent.ACTION_CREATE_DOCUMENT)
|
||||||
.putExtra("android.content.extra.SHOW_ADVANCED", true)
|
.putExtra("android.content.extra.SHOW_ADVANCED", true)
|
||||||
.setType("*/*")
|
.setType(mimeType)
|
||||||
.addCategory(Intent.CATEGORY_OPENABLE)
|
.addCategory(Intent.CATEGORY_OPENABLE)
|
||||||
.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
|
.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
|
||||||
| StoredDirectoryHelper.PERMISSION_FLAGS);
|
| StoredDirectoryHelper.PERMISSION_FLAGS);
|
||||||
|
|
|
@ -256,7 +256,7 @@ public class MissionsFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
startActivityForResult(StoredFileHelper.getNewPicker(mContext, startPath,
|
startActivityForResult(StoredFileHelper.getNewPicker(mContext, startPath,
|
||||||
mission.storage.getName()), REQUEST_DOWNLOAD_SAVE_AS);
|
mission.storage.getName(), mission.storage.getType()), REQUEST_DOWNLOAD_SAVE_AS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Ładowanie…
Reference in New Issue