summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@google.com>2009-08-05 16:17:38 +0800
committerChih-Chung Chang <chihchung@google.com>2009-08-05 16:17:38 +0800
commit10df8d25c28228ab60385a8d60e908e3e356ab88 (patch)
treece23026977874fe9c9f49d39388b56c5d73ed8be
parent7397efce5e5d065a134cae8f2a048647f7b32c90 (diff)
downloadLegacyCamera-10df8d25c28228ab60385a8d60e908e3e356ab88.zip
LegacyCamera-10df8d25c28228ab60385a8d60e908e3e356ab88.tar.gz
LegacyCamera-10df8d25c28228ab60385a8d60e908e3e356ab88.tar.bz2
Fix 2033184: Crash on delete after downloading/previewing picture attachments.
-rw-r--r--src/com/android/camera/ImageManager.java2
-rw-r--r--src/com/android/camera/ViewImage.java5
-rw-r--r--src/com/android/camera/gallery/SingleImageList.java6
-rw-r--r--src/com/android/camera/gallery/UriImage.java4
4 files changed, 10 insertions, 7 deletions
diff --git a/src/com/android/camera/ImageManager.java b/src/com/android/camera/ImageManager.java
index 986fd03..3fdc0ab 100644
--- a/src/com/android/camera/ImageManager.java
+++ b/src/com/android/camera/ImageManager.java
@@ -302,7 +302,7 @@ public class ImageManager {
return imageList;
}
- private static boolean isSingleImageMode(String uriString) {
+ static boolean isSingleImageMode(String uriString) {
return !uriString.startsWith(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString())
&& !uriString.startsWith(
diff --git a/src/com/android/camera/ViewImage.java b/src/com/android/camera/ViewImage.java
index b16308e..6ce0b50 100644
--- a/src/com/android/camera/ViewImage.java
+++ b/src/com/android/camera/ViewImage.java
@@ -600,6 +600,11 @@ public class ViewImage extends Activity implements View.OnClickListener {
}
}
+ // Don't show the "delete" icon for SingleImageList.
+ if (ImageManager.isSingleImageMode(uri.toString())) {
+ mActionIconPanel.findViewById(R.id.discard).setVisibility(View.GONE);
+ }
+
if (slideshow) {
setMode(MODE_SLIDESHOW);
} else {
diff --git a/src/com/android/camera/gallery/SingleImageList.java b/src/com/android/camera/gallery/SingleImageList.java
index 11e108d..05230af 100644
--- a/src/com/android/camera/gallery/SingleImageList.java
+++ b/src/com/android/camera/gallery/SingleImageList.java
@@ -82,11 +82,7 @@ public class SingleImageList extends BaseImageList {
@Override
public boolean removeImage(IImage image) {
- if (mContentResolver.delete(image.fullSizeImageUri(), null, null) > 0) {
- return true;
- } else {
- return false;
- }
+ return false;
}
@Override
diff --git a/src/com/android/camera/gallery/UriImage.java b/src/com/android/camera/gallery/UriImage.java
index 2f5e42b..eb61e8e 100644
--- a/src/com/android/camera/gallery/UriImage.java
+++ b/src/com/android/camera/gallery/UriImage.java
@@ -142,7 +142,9 @@ class UriImage implements IImage {
public String getMimeType() {
BitmapFactory.Options options = snifBitmapOptions();
- return (options != null) ? options.outMimeType : "";
+ return (options != null && options.outMimeType != null)
+ ? options.outMimeType
+ : "";
}
public int getHeight() {