diff options
| author | 2010-01-23 15:45:39 +0800 | |
|---|---|---|
| committer | 2010-01-30 19:44:52 +0800 | |
| commit | 4c4300c71229638183d814ab8374e09f722910f5 (patch) | |
| tree | 74433bbded099adab785c4e978d75a1abcbccb71 | |
| parent | 4bc1772ccacf6adde33adf8dff9c696bc7bf76e3 (diff) | |
Add Camera.getSupportedThumbnailSizes() and Size.equals().
bug:2375986
| -rw-r--r-- | api/current.xml | 15 | ||||
| -rw-r--r-- | core/java/android/hardware/Camera.java | 36 |
2 files changed, 48 insertions, 3 deletions
diff --git a/api/current.xml b/api/current.xml index 85908c1802a4..9f92b739aa2e 100644 --- a/api/current.xml +++ b/api/current.xml @@ -70360,6 +70360,17 @@ visibility="public" > </method> +<method name="getSupportedJpegThumbnailSizes" + return="java.util.List<android.hardware.Camera.Size>" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> <method name="getSupportedPictureFormats" return="java.util.List<java.lang.Integer>" abstract="false" @@ -340828,7 +340839,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="f" type="java.io.File"> +<parameter name="uri" type="java.lang.String"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> @@ -340845,7 +340856,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="uri" type="java.lang.String"> +<parameter name="f" type="java.io.File"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index abb74cd31392..82012b06f33f 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 |