diff options
author | nicolasroard <nicolasroard@google.com> | 2013-02-11 15:44:04 -0800 |
---|---|---|
committer | nicolasroard <nicolasroard@google.com> | 2013-02-11 15:44:04 -0800 |
commit | da1c8d757aad7f7f0077ff99283b3db98e2ea395 (patch) | |
tree | 9d0dda1a620b90c67de5e863cf07158e991ee3f5 /src/com/android/gallery3d/filtershow/PanelController.java | |
parent | c4447bec1e57d301739f37be3258ecc896edc595 (diff) | |
download | android_packages_apps_Snap-da1c8d757aad7f7f0077ff99283b3db98e2ea395.tar.gz android_packages_apps_Snap-da1c8d757aad7f7f0077ff99283b3db98e2ea395.tar.bz2 android_packages_apps_Snap-da1c8d757aad7f7f0077ff99283b3db98e2ea395.zip |
Move useFilterRepresentation to PanelController
Change-Id: I8abd9b2bd1b808df6a84e334b6eaa36b1c16750d
Diffstat (limited to 'src/com/android/gallery3d/filtershow/PanelController.java')
-rw-r--r-- | src/com/android/gallery3d/filtershow/PanelController.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/filtershow/PanelController.java b/src/com/android/gallery3d/filtershow/PanelController.java index e4140141c..ce7216289 100644 --- a/src/com/android/gallery3d/filtershow/PanelController.java +++ b/src/com/android/gallery3d/filtershow/PanelController.java @@ -447,6 +447,29 @@ public class PanelController implements OnClickListener { */ } + public void useFilterRepresentation(FilterRepresentation filterRepresentation) { + if (filterRepresentation == null) { + return; + } + if (MasterImage.getImage().getCurrentFilterRepresentation() == filterRepresentation) { + return; + } + ImagePreset oldPreset = MasterImage.getImage().getPreset(); + ImagePreset copy = new ImagePreset(oldPreset); + FilterRepresentation representation = copy.getRepresentation(filterRepresentation); + if (representation == null) { + copy.addFilter(filterRepresentation); + } else { + if (filterRepresentation.allowsMultipleInstances()) { + representation.useParametersFrom(filterRepresentation); + copy.setHistoryName(filterRepresentation.getName()); + } + filterRepresentation = representation; + } + MasterImage.getImage().setPreset(copy, true); + MasterImage.getImage().setCurrentFilterRepresentation(filterRepresentation); + } + public void showComponent(View view) { boolean doPanelTransition = true; @@ -476,7 +499,6 @@ public class PanelController implements OnClickListener { if (view instanceof FilterIconButton) { mCurrentEditor = null; FilterIconButton component = (FilterIconButton) view; - ImageFilter filter = component.getImageFilter(); FilterRepresentation representation = component.getFilterRepresentation(); if (representation != null) { mUtilityPanel.setEffectName(representation.getName()); |