mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Don't open the file after the media scanner added it to the media content provider
This commit is contained in:
parent
dfd40659d1
commit
c3f1420ef6
@ -1,7 +1,6 @@
|
|||||||
package com.fsck.k9.helper;
|
package com.fsck.k9.helper;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.media.MediaScannerConnection;
|
import android.media.MediaScannerConnection;
|
||||||
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
|
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -12,14 +11,11 @@ import java.io.File;
|
|||||||
public class MediaScannerNotifier implements MediaScannerConnectionClient {
|
public class MediaScannerNotifier implements MediaScannerConnectionClient {
|
||||||
private MediaScannerConnection mConnection;
|
private MediaScannerConnection mConnection;
|
||||||
private File mFile;
|
private File mFile;
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public MediaScannerNotifier(Context context, File file) {
|
public MediaScannerNotifier(Context context, File file) {
|
||||||
mFile = file;
|
mFile = file;
|
||||||
mConnection = new MediaScannerConnection(context, this);
|
mConnection = new MediaScannerConnection(context, this);
|
||||||
mConnection.connect();
|
mConnection.connect();
|
||||||
mContext = context;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onMediaScannerConnected() {
|
public void onMediaScannerConnected() {
|
||||||
@ -27,14 +23,6 @@ public class MediaScannerNotifier implements MediaScannerConnectionClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onScanCompleted(String path, Uri uri) {
|
public void onScanCompleted(String path, Uri uri) {
|
||||||
try {
|
|
||||||
if (uri != null) {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
intent.setData(uri);
|
|
||||||
mContext.startActivity(intent);
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
mConnection.disconnect();
|
mConnection.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user