diff options
author | Wu-cheng Li <wuchengli@google.com> | 2010-01-23 15:45:39 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2010-01-30 19:44:52 +0800 |
commit | 4c4300c71229638183d814ab8374e09f722910f5 (patch) | |
tree | 74433bbded099adab785c4e978d75a1abcbccb71 /core | |
parent | 4bc1772ccacf6adde33adf8dff9c696bc7bf76e3 (diff) | |
download | frameworks_base-4c4300c71229638183d814ab8374e09f722910f5.zip frameworks_base-4c4300c71229638183d814ab8374e09f722910f5.tar.gz frameworks_base-4c4300c71229638183d814ab8374e09f722910f5.tar.bz2 |
Add Camera.getSupportedThumbnailSizes() and Size.equals().
bug:2375986
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/hardware/Camera.java | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index abb74cd..82012b0 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -658,6 +658,25 @@ public class Camera { width = w; height = h; } + /** + * Compares {@code obj} to this size. + * + * @param obj the object to compare this size with. + * @return {@code true} if the width and height of {@code obj} is the + * same as those of this size. {@code false} otherwise. + */ + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Size)) { + return false; + } + Size s = (Size) obj; + return width == s.width && height == s.height; + } + @Override + public int hashCode() { + return width * 32713 + height; + } /** width of the picture */ public int width; /** height of the picture */ @@ -685,6 +704,7 @@ public class Camera { private static final String KEY_PREVIEW_FRAME_RATE = "preview-frame-rate"; private static final String KEY_PICTURE_SIZE = "picture-size"; private static final String KEY_PICTURE_FORMAT = "picture-format"; + private static final String KEY_JPEG_THUMBNAIL_SIZE = "jpeg-thumbnail-size"; private static final String KEY_JPEG_THUMBNAIL_WIDTH = "jpeg-thumbnail-width"; private static final String KEY_JPEG_THUMBNAIL_HEIGHT = "jpeg-thumbnail-height"; private static final String KEY_JPEG_THUMBNAIL_QUALITY = "jpeg-thumbnail-quality"; @@ -954,7 +974,9 @@ public class Camera { } /** - * Sets the dimensions for EXIF thumbnail in Jpeg picture. + * Sets the dimensions for EXIF thumbnail in Jpeg picture. If + * applications set both width and height to 0, EXIF will not contain + * thumbnail. * * @param width the width of the thumbnail, in pixels * @param height the height of the thumbnail, in pixels @@ -976,6 +998,18 @@ public class Camera { } /** + * Gets the supported jpeg thumbnail sizes. + * + * @return a List of Size object. This method will always return a list + * with at least two elements. Size 0,0 (no thumbnail) is always + * supported. + */ + public List<Size> getSupportedJpegThumbnailSizes() { + String str = get(KEY_JPEG_THUMBNAIL_SIZE + SUPPORTED_VALUES_SUFFIX); + return splitSize(str); + } + + /** * Sets the quality of the EXIF thumbnail in Jpeg picture. * * @param quality the JPEG quality of the EXIF thumbnail. The range is 1 |