diff options
author | ztenghui <ztenghui@google.com> | 2013-06-28 09:25:23 -0700 |
---|---|---|
committer | ztenghui <ztenghui@google.com> | 2013-07-01 15:45:12 -0700 |
commit | 2185e9b81380f7e43608419743c983c5afee43c4 (patch) | |
tree | 5986f546bfced1a6cca39693b9beffaf82a38865 /src/com/android/gallery3d/filtershow/imageshow/MasterImage.java | |
parent | 59e60d36233f4acd67c4542bf849a0bcfce54adc (diff) | |
download | android_packages_apps_Snap-2185e9b81380f7e43608419743c983c5afee43c4.tar.gz android_packages_apps_Snap-2185e9b81380f7e43608419743c983c5afee43c4.tar.bz2 android_packages_apps_Snap-2185e9b81380f7e43608419743c983c5afee43c4.zip |
Fix the save button issue.
When dealing with non Fx filters, the hasModification() really need to go deep
to figure out whether things has changed.
bug:9468909
Change-Id: I89495f147f7af7c35490def84805aae98e3f917f
Diffstat (limited to 'src/com/android/gallery3d/filtershow/imageshow/MasterImage.java')
-rw-r--r-- | src/com/android/gallery3d/filtershow/imageshow/MasterImage.java | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java index 56c4a62b8..44b9d82bc 100644 --- a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java +++ b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java @@ -231,12 +231,22 @@ public class MasterImage implements RenderingRequestCaller { } public synchronized boolean hasModifications() { + // TODO: We need to have a better same effects check to see if two + // presets are functionally the same. Right now, we are relying on a + // stricter check as equals(). + ImagePreset loadedPreset = getLoadedPreset(); if (mPreset == null) { - return getLoadedPreset() != null; + if (loadedPreset == null) { + return false; + } else { + return loadedPreset.hasModifications(); + } } else { - // TODO: same() is quite strict check here. We should be only - // checking for functionality parity. - return !mPreset.same(getLoadedPreset()); + if (loadedPreset == null) { + return mPreset.hasModifications(); + } else { + return !mPreset.equals(getLoadedPreset()); + } } } @@ -304,7 +314,6 @@ public class MasterImage implements RenderingRequestCaller { } } invalidatePreview(); - mActivity.enableSave(hasModifications()); } public FilterRepresentation getCurrentFilterRepresentation() { @@ -404,20 +413,29 @@ public class MasterImage implements RenderingRequestCaller { if (request.getBitmap() == null) { return; } + + boolean needsCheckModification = false; if (request.getType() == RenderingRequest.GEOMETRY_RENDERING) { mGeometryOnlyBitmap = request.getBitmap(); + needsCheckModification = true; } if (request.getType() == RenderingRequest.FILTERS_RENDERING) { mFiltersOnlyBitmap = request.getBitmap(); + needsCheckModification = true; } if (request.getType() == RenderingRequest.PARTIAL_RENDERING && request.getScaleFactor() == getScaleFactor()) { mPartialBitmap = request.getBitmap(); notifyObservers(); + needsCheckModification = true; } if (request.getType() == RenderingRequest.HIGHRES_RENDERING) { mHighresBitmap = request.getBitmap(); notifyObservers(); + needsCheckModification = true; + } + if (needsCheckModification) { + mActivity.enableSave(hasModifications()); } } |