From 147af26e86b7fa8f2d195651e3786c0102346702 Mon Sep 17 00:00:00 2001 From: nicolasroard Date: Wed, 13 Feb 2013 15:51:25 -0800 Subject: Fix sync representations Change-Id: I8b1b159a2350f7ee8bcdc7e71faf82ab5df2755b --- .../filtershow/filters/FilterRepresentation.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java') diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java index 8ac191de7..513cdcdef 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java @@ -40,6 +40,8 @@ public class FilterRepresentation implements Cloneable { public static final byte TYPE_NORMAL = 5; public static final byte TYPE_TINYPLANET = 6; + public FilterRepresentation mTempRepresentation = null; + public FilterRepresentation(String name) { mName = name; } @@ -107,6 +109,24 @@ public class FilterRepresentation implements Cloneable { public void useParametersFrom(FilterRepresentation a) { } + public synchronized void updateTempParametersFrom(FilterRepresentation representation) { + if (mTempRepresentation == null) { + try { + mTempRepresentation = representation.clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + } else { + mTempRepresentation.useParametersFrom(representation); + } + } + + public synchronized void synchronizeRepresentation() { + if (mTempRepresentation != null) { + useParametersFrom(mTempRepresentation); + } + } + public boolean allowsMultipleInstances() { return false; } @@ -185,4 +205,5 @@ public class FilterRepresentation implements Cloneable { public String getStateRepresentation() { return ""; } + } -- cgit v1.2.3