diff options
Diffstat (limited to 'src/com/android/gallery3d/data/MediaItem.java')
-rw-r--r-- | src/com/android/gallery3d/data/MediaItem.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/data/MediaItem.java b/src/com/android/gallery3d/data/MediaItem.java index 13612321c..b682c2d1b 100644 --- a/src/com/android/gallery3d/data/MediaItem.java +++ b/src/com/android/gallery3d/data/MediaItem.java @@ -16,11 +16,11 @@ package com.android.gallery3d.data; -import com.android.gallery3d.util.ThreadPool.Job; - import android.graphics.Bitmap; import android.graphics.BitmapRegionDecoder; +import com.android.gallery3d.util.ThreadPool.Job; + // MediaItem represents an image or a video item. public abstract class MediaItem extends MediaObject { // NOTE: These type numbers are stored in the image cache, so it should not @@ -89,4 +89,16 @@ public abstract class MediaItem extends MediaObject { // Returns 0, 0 if the information is not available. public abstract int getWidth(); public abstract int getHeight(); + + public static int getTargetSize(int type) { + switch (type) { + case TYPE_THUMBNAIL: + return THUMBNAIL_TARGET_SIZE; + case TYPE_MICROTHUMBNAIL: + return MICROTHUMBNAIL_TARGET_SIZE; + default: + throw new RuntimeException( + "should only request thumb/microthumb from cache"); + } + } } |