summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/data/LocalData.java
diff options
context:
space:
mode:
authorztenghui <ztenghui@google.com>2013-08-23 11:47:56 -0700
committerztenghui <ztenghui@google.com>2013-08-28 13:07:45 -0700
commita16e7b50f3148f581439509279f242092e254309 (patch)
treeaa5ba2660ad79635b4f3d4a14691c7ebeac907d7 /src/com/android/camera/data/LocalData.java
parent7446e9fde7cd8dd7904beff592e8819513797ab9 (diff)
downloadandroid_packages_apps_Snap-a16e7b50f3148f581439509279f242092e254309.tar.gz
android_packages_apps_Snap-a16e7b50f3148f581439509279f242092e254309.tar.bz2
android_packages_apps_Snap-a16e7b50f3148f581439509279f242092e254309.zip
Add rotate support in Film Strip
Move the exif related code under src.com.android.camera.exif. Refactor the member variables under LocalMediaData.java. Refactor the LocalData to make sure they are immutables for thread safety. bug:10367037 Change-Id: I0e84bcc0097925b2be749fe016984177a68e0a4d
Diffstat (limited to 'src/com/android/camera/data/LocalData.java')
-rw-r--r--src/com/android/camera/data/LocalData.java30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/com/android/camera/data/LocalData.java b/src/com/android/camera/data/LocalData.java
index 11d36da82..45bcb9ffa 100644
--- a/src/com/android/camera/data/LocalData.java
+++ b/src/com/android/camera/data/LocalData.java
@@ -29,10 +29,15 @@ import java.util.Comparator;
/**
* An abstract interface that represents the local media data. Also implements
* Comparable interface so we can sort in DataAdapter.
+ * Note that all the sub-class of LocalData are designed to be immutable, i.e:
+ * all the members need to be final, and there is no setter. In this way, we
+ * can guarantee thread safety for LocalData.
*/
public interface LocalData extends FilmStripView.ImageData {
static final String TAG = "CAM_LocalData";
+ public static final String MIME_TYPE_JPEG = "image/jpeg";
+
public static final int ACTION_NONE = 0;
public static final int ACTION_PLAY = 1;
public static final int ACTION_DELETE = (1 << 1);
@@ -97,6 +102,17 @@ public interface LocalData extends FilmStripView.ImageData {
/** Removes the data from the storage if possible. */
boolean delete(Context c);
+ /**
+ * Rotate the image in 90 degrees. This is a no-op for non-image.
+ *
+ * @param context Used to update the content provider when rotation is done.
+ * @param adapter Used to update the view.
+ * @param currentDataId Used to update the view.
+ * @param clockwise True if the rotation goes clockwise.
+ */
+ void rotate90Degrees(Context context, LocalDataAdapter adapter,
+ int currentDataId, boolean clockwise);
+
void onFullScreen(boolean fullScreen);
/** Returns {@code true} if it allows swipe to filmstrip in full screen. */
@@ -137,12 +153,17 @@ public interface LocalData extends FilmStripView.ImageData {
int getLocalDataType();
/**
+ * @return The size of the data in bytes
+ */
+ long getSizeInBytes();
+
+ /**
* Refresh the data content.
*
* @param resolver {@link ContentResolver} to refresh the data.
- * @return {@code true} if success, {@code false} otherwise.
+ * @return A new LocalData object if success, null otherwise.
*/
- boolean refresh(ContentResolver resolver);
+ LocalData refresh(ContentResolver resolver);
static class NewestFirstComparator implements Comparator<LocalData> {
@@ -170,5 +191,10 @@ public interface LocalData extends FilmStripView.ImageData {
return cmp;
}
}
+
+ /**
+ * @return the Id of the data.
+ */
+ long getId();
}