Skip to content

Commit

Permalink
export alarms
Browse files Browse the repository at this point in the history
  • Loading branch information
forrestguice committed May 11, 2022
1 parent f2bf3fc commit d97be8f
Showing 1 changed file with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -561,30 +561,34 @@ public void onFinished(AlarmClockItemExportTask.ExportResult results)
exportTask = null;
showProgress(false);

File file = results.getExportFile();
String path = ((file != null) ? file.getAbsolutePath() : results.getExportUri().toString());

if (results.getResult())
Context context = getActivity();
if (context != null)
{
if (isAdded()) {
String successMessage = getString(R.string.msg_export_success, path);
Toast.makeText(getActivity(), successMessage, Toast.LENGTH_LONG).show();
// TODO: use a snackbar instead; offer 'copy path' action
}
File file = results.getExportFile();
String path = ((file != null) ? file.getAbsolutePath() : ExportTask.getFileName(getContext().getContentResolver(), results.getExportUri()));

if (results.getResult())
{
if (isAdded()) {
String successMessage = getString(R.string.msg_export_success, path);
Toast.makeText(getActivity(), successMessage, Toast.LENGTH_LONG).show();
// TODO: use a snackbar instead; offer 'copy path' action
}

if (Build.VERSION.SDK_INT >= 19) {
if (results.getExportUri() == null) {
if (Build.VERSION.SDK_INT >= 19) {
if (results.getExportUri() == null) {
ExportTask.shareResult(getActivity(), results.getExportFile(), results.getMimeType());
}
} else {
ExportTask.shareResult(getActivity(), results.getExportFile(), results.getMimeType());
}
} else {
ExportTask.shareResult(getActivity(), results.getExportFile(), results.getMimeType());
return;
}
return;
}

if (isAdded()) {
String failureMessage = getString(R.string.msg_export_failure, path);
Toast.makeText(getActivity(), failureMessage, Toast.LENGTH_LONG).show();
if (isAdded()) {
String failureMessage = getString(R.string.msg_export_failure, path);
Toast.makeText(getActivity(), failureMessage, Toast.LENGTH_LONG).show();
}
}
}
};
Expand Down

0 comments on commit d97be8f

Please sign in to comment.