diff options
author | Chung-yih Wang <cywang@google.com> | 2010-12-07 16:25:31 +0800 |
---|---|---|
committer | Chung-yih Wang <cywang@google.com> | 2010-12-07 17:20:45 +0800 |
commit | 95b65b1c84ad44b43bd3defbdba5d881c0881d35 (patch) | |
tree | 925fa459c5a9c9ae41f98b09960da10c8b011fdb /src | |
parent | 17bf7bc255fffcf9ae795a5b3983cd4878383613 (diff) | |
download | LegacyCamera-95b65b1c84ad44b43bd3defbdba5d881c0881d35.zip LegacyCamera-95b65b1c84ad44b43bd3defbdba5d881c0881d35.tar.gz LegacyCamera-95b65b1c84ad44b43bd3defbdba5d881c0881d35.tar.bz2 |
Don't show camera/video thumbnails if no pic/video taken.
Camera: Don't show camera roll stack control if no images were taken
yet.
bug:3252739
Change-Id: I5998ceade0172a45be637fa7c967d266e2079832
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/Camera.java | 6 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 41 |
2 files changed, 28 insertions, 19 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 98e0e7a..ab4ef7b 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -382,7 +382,6 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, mThumbnailButton = (RotateImageView) findViewById(R.id.review_thumbnail); if (mThumbnailButton != null) { - mThumbnailButton.setVisibility(View.VISIBLE); mThumbnailButton.setOnClickListener(this); mThumbnailButton.loadData(ImageManager.getLastImageThumbPath()); updateThumbnailButton(); @@ -409,6 +408,8 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, } list.close(); } + mThumbnailButton.setVisibility( + (mThumbnailButton.getUri() != null) ? View.VISIBLE : View.GONE); } private void setLastPictureThumb(byte[] data, int degree, Uri uri) { @@ -419,6 +420,9 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, BitmapFactory.decodeByteArray(data, 0, data.length, options); lastPictureThumb = Util.rotate(lastPictureThumb, degree); mThumbnailButton.setData(uri, lastPictureThumb); + if (lastPictureThumb != null) { + mThumbnailButton.setVisibility(View.VISIBLE); + } } // If the activity is paused and resumed, this method will be called in diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index abfa52e..db6cffd 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -790,9 +790,7 @@ public class VideoCamera extends NoSearchActivity // Update the last video thumbnail. if (!mIsVideoCaptureIntent) { - if (mThumbnailButton != null && !mThumbnailButton.isUriValid()) { - updateThumbnailButton(); - } + updateThumbnailButton(); } } @@ -1572,34 +1570,41 @@ public class VideoCamera extends NoSearchActivity Bitmap videoFrame = ThumbnailUtils.createVideoThumbnail( mCurrentVideoFilename, Video.Thumbnails.MINI_KIND); mThumbnailButton.setData(mCurrentVideoUri, videoFrame); + if (videoFrame != null) { + mThumbnailButton.setVisibility(View.VISIBLE); + } } } private void initThumbnailButton() { mThumbnailButton = (RotateImageView)findViewById(R.id.review_thumbnail); if (mThumbnailButton != null) { - mThumbnailButton.setVisibility(View.VISIBLE); mThumbnailButton.setOnClickListener(this); mThumbnailButton.loadData(ImageManager.getLastVideoThumbPath()); } } private void updateThumbnailButton() { - IImageList list = ImageManager.makeImageList( - mContentResolver, - dataLocation(), - ImageManager.INCLUDE_VIDEOS, - ImageManager.SORT_ASCENDING, - ImageManager.CAMERA_IMAGE_BUCKET_ID); - int count = list.getCount(); - if (count > 0) { - IImage image = list.getImageAt(count - 1); - Uri uri = image.fullSizeImageUri(); - mThumbnailButton.setData(uri, image.miniThumbBitmap()); - } else { - mThumbnailButton.setData(null, null); + if (mThumbnailButton == null) return; + if (!mThumbnailButton.isUriValid()) { + IImageList list = ImageManager.makeImageList( + mContentResolver, + dataLocation(), + ImageManager.INCLUDE_VIDEOS, + ImageManager.SORT_ASCENDING, + ImageManager.CAMERA_IMAGE_BUCKET_ID); + int count = list.getCount(); + if (count > 0) { + IImage image = list.getImageAt(count - 1); + Uri uri = image.fullSizeImageUri(); + mThumbnailButton.setData(uri, image.miniThumbBitmap()); + } else { + mThumbnailButton.setData(null, null); + } + list.close(); } - list.close(); + mThumbnailButton.setVisibility( + (mThumbnailButton.getUri() != null) ? View.VISIBLE : View.GONE); } private static ImageManager.DataLocation dataLocation() { |