Add button to share exported database export (#6746)
Also hide path, is not accessible on recent Android versions anyway.
This commit is contained in:
parent
34c7fd576f
commit
0a6a3d6854
|
@ -147,7 +147,7 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat {
|
|||
.subscribe(output -> {
|
||||
Uri fileUri = FileProvider.getUriForFile(context.getApplicationContext(),
|
||||
context.getString(R.string.provider_authority), output);
|
||||
showExportSuccessDialog(output.toString(), fileUri, exportType);
|
||||
showExportSuccessSnackbar(fileUri, exportType.contentType);
|
||||
}, this::showExportErrorDialog, progressDialog::dismiss);
|
||||
} else {
|
||||
DocumentFileExportWorker worker = new DocumentFileExportWorker(exportWriter, context, uri);
|
||||
|
@ -155,7 +155,7 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat {
|
|||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(output ->
|
||||
showExportSuccessDialog(output.getUri().toString(), output.getUri(), exportType),
|
||||
showExportSuccessSnackbar(output.getUri(), exportType.contentType),
|
||||
this::showExportErrorDialog, progressDialog::dismiss);
|
||||
}
|
||||
}
|
||||
|
@ -191,20 +191,15 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat {
|
|||
builder.show();
|
||||
}
|
||||
|
||||
private void showExportSuccessDialog(String path, Uri streamUri, Export exportType) {
|
||||
final MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(getContext());
|
||||
alert.setNeutralButton(android.R.string.ok, (dialog, which) -> dialog.dismiss());
|
||||
alert.setTitle(R.string.export_success_title);
|
||||
alert.setMessage(getContext().getString(R.string.export_success_sum, path));
|
||||
alert.setPositiveButton(R.string.send_label, (dialog, which) -> {
|
||||
void showExportSuccessSnackbar(Uri uri, String mimeType) {
|
||||
Snackbar.make(getView(), R.string.export_success_title, Snackbar.LENGTH_LONG)
|
||||
.setAction(R.string.share_label, v ->
|
||||
new ShareCompat.IntentBuilder(getContext())
|
||||
.setType(exportType.contentType)
|
||||
.setSubject(getString(exportType.labelResId))
|
||||
.addStream(streamUri)
|
||||
.setChooserTitle(R.string.send_label)
|
||||
.startChooser();
|
||||
});
|
||||
alert.create().show();
|
||||
.setType(mimeType)
|
||||
.addStream(uri)
|
||||
.setChooserTitle(R.string.share_label)
|
||||
.startChooser())
|
||||
.show();
|
||||
}
|
||||
|
||||
private void showExportErrorDialog(final Throwable error) {
|
||||
|
@ -264,7 +259,7 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat {
|
|||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(() -> {
|
||||
Snackbar.make(getView(), R.string.export_success_title, Snackbar.LENGTH_LONG).show();
|
||||
showExportSuccessSnackbar(uri, "application/x-sqlite3");
|
||||
progressDialog.dismiss();
|
||||
}, this::showExportErrorDialog);
|
||||
}
|
||||
|
|
|
@ -138,7 +138,6 @@
|
|||
<string name="feed_auto_download_never">Never</string>
|
||||
<string name="feed_new_episodes_action_add_to_inbox">Add to inbox</string>
|
||||
<string name="feed_new_episodes_action_nothing">Nothing</string>
|
||||
<string name="send_label">Send…</string>
|
||||
<string name="episode_cleanup_never">Never</string>
|
||||
<string name="episode_cleanup_except_favorite_removal">When not favorited</string>
|
||||
<string name="episode_cleanup_queue_removal">When not in queue</string>
|
||||
|
@ -590,7 +589,6 @@
|
|||
<string name="please_wait">Please wait…</string>
|
||||
<string name="export_error_label">Export error</string>
|
||||
<string name="export_success_title">Export successful</string>
|
||||
<string name="export_success_sum">The exported file was written to:\n\n%1$s</string>
|
||||
<string name="opml_import_ask_read_permission">Access to external storage is required to read the OPML file</string>
|
||||
<string name="successful_import_label">Import successful</string>
|
||||
<string name="import_ok">Please press OK to restart AntennaPod</string>
|
||||
|
|
Loading…
Reference in New Issue