summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/filtershow_strings.xml2
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java12
-rw-r--r--src/com/android/gallery3d/filtershow/cache/ImageLoader.java3
-rw-r--r--src/com/android/gallery3d/filtershow/tools/SaveImage.java11
4 files changed, 25 insertions, 3 deletions
diff --git a/res/values/filtershow_strings.xml b/res/values/filtershow_strings.xml
index a79bdb0b7..9a41f3c34 100644
--- a/res/values/filtershow_strings.xml
+++ b/res/values/filtershow_strings.xml
@@ -20,6 +20,8 @@
<!-- String shown when we cannot load the image when starting the activity [CHAR LIMIT=NONE] -->
<string name="cannot_load_image">Cannot load the image!</string>
+ <!-- String shown when we cannot load the original to edit [CHAR LIMIT=NONE] -->
+ <string name="cannot_edit_original">Cannot edit original</string>
<!-- String displayed when showing the original image [CHAR LIMIT=NONE] -->
<string name="original_picture_text">@string/original</string>
<!-- String displayed when setting the homepage wallpaper in the background [CHAR LIMIT=NONE] -->
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index 4f1f7f07f..b18eeb1bf 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -732,9 +732,15 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
}
if (!result) {
- cannotLoadImage();
- // TODO: We should figure out the best way preventing this from
- // happening, e.g: early checking.
+ if (!mOriginalImageUri.equals(mSelectedImageUri)) {
+ mOriginalImageUri = mSelectedImageUri;
+ mOriginalPreset = null;
+ Toast.makeText(FilterShowActivity.this,
+ R.string.cannot_edit_original, Toast.LENGTH_SHORT).show();
+ startLoadBitmap(mOriginalImageUri);
+ } else {
+ cannotLoadImage();
+ }
return;
}
diff --git a/src/com/android/gallery3d/filtershow/cache/ImageLoader.java b/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
index 15ffb1814..30cd3f33c 100644
--- a/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
+++ b/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
@@ -392,6 +392,9 @@ public final class ImageLoader {
Bitmap bmap = loadConstrainedBitmap(uri, context, maxSideLength, originalBounds, false);
if (bmap != null) {
bmap = orientBitmap(bmap, orientation);
+ if (bmap.getConfig()!= Bitmap.Config.ARGB_8888){
+ bmap = bmap.copy( Bitmap.Config.ARGB_8888,true);
+ }
}
return bmap;
}
diff --git a/src/com/android/gallery3d/filtershow/tools/SaveImage.java b/src/com/android/gallery3d/filtershow/tools/SaveImage.java
index 5aafbff33..abcdcf820 100644
--- a/src/com/android/gallery3d/filtershow/tools/SaveImage.java
+++ b/src/com/android/gallery3d/filtershow/tools/SaveImage.java
@@ -436,6 +436,17 @@ public class SaveImage {
// We are using the destination file name such that photos sitting in
// the auxiliary directory are matching the parent directory.
File newSrcFile = new File(auxDiretory, dstFile.getName());
+ // Maintain the suffix during move
+ String to = newSrcFile.getName();
+ String from = srcFile.getName();
+ to = to.substring(to.lastIndexOf("."));
+ from = from.substring(from.lastIndexOf("."));
+
+ if (!to.equals(from)) {
+ String name = dstFile.getName();
+ name = name.substring(0, name.lastIndexOf(".")) + from;
+ newSrcFile = new File(auxDiretory, name);
+ }
if (!newSrcFile.exists()) {
srcFile.renameTo(newSrcFile);