package com.android.gallery3d.data;
+import android.content.Intent;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
+import android.support.v4.content.LocalBroadcastManager;
import com.android.gallery3d.app.GalleryApp;
import com.android.gallery3d.common.Utils;
private static final String TOP_LOCAL_VIDEO_SET_PATH =
"/local/video";
+ private static final String ACTION_DELETE_PICTURE =
+ "com.android.gallery3d.action.DELETE_PICTURE";
+
public static final Comparator<MediaItem> sDateTakenComparator =
new DateTakenComparator();
}
}
+ // Sends a local broadcast if a local image or video is deleted. This is
+ // used to update the thumbnail shown in the camera app.
+ public void broadcastLocalDeletion() {
+ LocalBroadcastManager manager = LocalBroadcastManager.getInstance(
+ mApplication.getAndroidContext());
+ Intent intent = new Intent(ACTION_DELETE_PICTURE);
+ manager.sendBroadcast(intent);
+ }
+
private static class NotifyBroker extends ContentObserver {
private WeakHashMap<ChangeNotifier, Object> mNotifiers =
new WeakHashMap<ChangeNotifier, Object>();
GalleryUtils.assertNotInRenderThread();
mResolver.delete(mBaseUri, mWhereClause,
new String[]{String.valueOf(mBucketId)});
+ mApplication.getDataManager().broadcastLocalDeletion();
}
@Override
Uri baseUri = Images.Media.EXTERNAL_CONTENT_URI;
mApplication.getContentResolver().delete(baseUri, "_id=?",
new String[]{String.valueOf(id)});
+ mApplication.getDataManager().broadcastLocalDeletion();
}
private static String getExifOrientation(int orientation) {
Uri baseUri = Video.Media.EXTERNAL_CONTENT_URI;
mApplication.getContentResolver().delete(baseUri, "_id=?",
new String[]{String.valueOf(id)});
+ mApplication.getDataManager().broadcastLocalDeletion();
}
@Override