mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-06 11:59:58 +02:00
move the save-attachment-toast to onPostExecute()
This commit is contained in:
parent
3edb0cd79c
commit
5f7f9f57c6
2 changed files with 3 additions and 12 deletions
|
@ -198,7 +198,7 @@
|
|||
<string name="share_location_for_two_hours">for 2 hours</string>
|
||||
<string name="share_location_for_six_hours">for 6 hours</string>
|
||||
|
||||
<string name="exported_attachment_to">Saved file to %1$s</string>
|
||||
<string name="file_saved_to">File saved to \"%1$s\".</string>
|
||||
|
||||
<!-- get confirmations -->
|
||||
<string name="ask_leave_group">Are you sure you want to leave this group?</string>
|
||||
|
|
|
@ -63,12 +63,6 @@ public class SaveAttachmentTask extends ProgressDialogAsyncTask<SaveAttachmentTa
|
|||
if (directory == null) return new Pair<>(FAILURE, null);
|
||||
}
|
||||
}
|
||||
final String displayDir = directory;
|
||||
Util.runOnMain(() -> {
|
||||
// Tell the user where the file went
|
||||
// "Saved to " + displayDir
|
||||
Toast.makeText(context, context.getString(R.string.exported_attachment_to, displayDir), Toast.LENGTH_LONG).show();
|
||||
});
|
||||
if (attachments.length > 1) return new Pair<>(SUCCESS, null);
|
||||
else return new Pair<>(SUCCESS, directory);
|
||||
} catch (NoExternalStorageException|IOException ioe) {
|
||||
|
@ -182,8 +176,9 @@ public class SaveAttachmentTask extends ProgressDialogAsyncTask<SaveAttachmentTa
|
|||
Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
case SUCCESS:
|
||||
String dir = result.second();
|
||||
Toast.makeText(context,
|
||||
context.getResources().getString(R.string.done),
|
||||
dir==null? context.getString(R.string.done) : context.getString(R.string.file_saved_to, dir),
|
||||
Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
case WRITE_ACCESS_FAILURE:
|
||||
|
@ -213,10 +208,6 @@ public class SaveAttachmentTask extends ProgressDialogAsyncTask<SaveAttachmentTa
|
|||
}
|
||||
|
||||
public static void showWarningDialog(Context context, OnClickListener onAcceptListener) {
|
||||
showWarningDialog(context, onAcceptListener, 1);
|
||||
}
|
||||
|
||||
public static void showWarningDialog(Context context, OnClickListener onAcceptListener, int count) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setCancelable(true);
|
||||
builder.setMessage(R.string.ask_export_attachment);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue