diff options
author | John Hoford <hoford@google.com> | 2013-08-20 15:37:37 -0700 |
---|---|---|
committer | John Hoford <hoford@google.com> | 2013-08-20 15:47:11 -0700 |
commit | 441d7a8930360d1c043daabd76a6599f2a8a60ba (patch) | |
tree | 5ee5741dc2a531a06a2021798fe19888d724bc70 | |
parent | 675948f8f6337fe2873067a74db789d46a41ec36 (diff) | |
download | android_packages_apps_Gallery2-441d7a8930360d1c043daabd76a6599f2a8a60ba.tar.gz android_packages_apps_Gallery2-441d7a8930360d1c043daabd76a6599f2a8a60ba.tar.bz2 android_packages_apps_Gallery2-441d7a8930360d1c043daabd76a6599f2a8a60ba.zip |
fix gif issue
bug:7877538
Change-Id: I807198ca6d0d0db33fdbcc8b6bd1bf6dab9ba86a
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); |