Change 'save attachment' experience

- Don't use toast with path to file to notify user of success
- Don't trigger scan of file using MediaScanner API

Both functions are now handled by the DownloadManager.
This commit is contained in:
cketti 2016-01-06 23:27:43 +01:00
parent d47305a58f
commit 905359a291
2 changed files with 1 additions and 25 deletions

View file

@ -1,15 +0,0 @@
package com.fsck.k9.helper;
import java.io.File;
import android.content.Context;
import android.media.MediaScannerConnection;
public class MediaScannerNotifier {
public static void notify(Context context, File file) {
String[] paths = { file.getAbsolutePath() };
MediaScannerConnection.scanFile(context, paths, null, null);
}
}

View file

@ -28,7 +28,6 @@ import com.fsck.k9.cache.TemporaryAttachmentStore;
import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.controller.MessagingListener;
import com.fsck.k9.helper.FileHelper;
import com.fsck.k9.helper.MediaScannerNotifier;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.Part;
import com.fsck.k9.mail.internet.MimeUtility;
@ -280,11 +279,6 @@ public class AttachmentController {
return resolveInfos.size();
}
private void displayAttachmentSavedMessage(final String filename) {
String message = context.getString(R.string.message_view_status_attachment_saved, filename);
displayMessageToUser(message);
}
private void displayAttachmentNotSavedMessage() {
String message = context.getString(R.string.message_view_status_attachment_not_saved);
displayMessageToUser(message);
@ -373,10 +367,7 @@ public class AttachmentController {
@Override
protected void onPostExecute(File file) {
messageViewFragment.enableAttachmentButtons(attachment);
if (file != null) {
displayAttachmentSavedMessage(file.toString());
MediaScannerNotifier.notify(context, file);
} else {
if (file == null) {
displayAttachmentNotSavedMessage();
}
}