diff --git a/src/com/fsck/k9/helper/MediaScannerNotifier.java b/src/com/fsck/k9/helper/MediaScannerNotifier.java index dd8bfcdff..9dbed11ce 100644 --- a/src/com/fsck/k9/helper/MediaScannerNotifier.java +++ b/src/com/fsck/k9/helper/MediaScannerNotifier.java @@ -1,28 +1,15 @@ package com.fsck.k9.helper; -import android.content.Context; -import android.media.MediaScannerConnection; -import android.media.MediaScannerConnection.MediaScannerConnectionClient; -import android.net.Uri; import java.io.File; +import android.content.Context; +import android.media.MediaScannerConnection; -public class MediaScannerNotifier implements MediaScannerConnectionClient { - private MediaScannerConnection mConnection; - private File mFile; - public MediaScannerNotifier(Context context, File file) { - mFile = file; - mConnection = new MediaScannerConnection(context, this); - mConnection.connect(); - } - - public void onMediaScannerConnected() { - mConnection.scanFile(mFile.getAbsolutePath(), null); - } - - public void onScanCompleted(String path, Uri uri) { - mConnection.disconnect(); +public class MediaScannerNotifier { + public static void notify(Context context, File file) { + String[] paths = { file.getAbsolutePath() }; + MediaScannerConnection.scanFile(context, paths, null, null); } } diff --git a/src/com/fsck/k9/view/AttachmentView.java b/src/com/fsck/k9/view/AttachmentView.java index 8dcef251d..000cf2b87 100644 --- a/src/com/fsck/k9/view/AttachmentView.java +++ b/src/com/fsck/k9/view/AttachmentView.java @@ -227,7 +227,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo displayAttachmentSavedMessage(file.toString()); - new MediaScannerNotifier(context, file); + MediaScannerNotifier.notify(context, file); } catch (IOException ioe) { if (K9.DEBUG) { Log.e(K9.LOG_TAG, "Error saving attachment", ioe);