diff options
author | John Hoford <hoford@google.com> | 2013-04-15 22:10:43 -0700 |
---|---|---|
committer | John Hoford <hoford@google.com> | 2013-04-17 09:39:13 -0700 |
commit | afa8ed9d46e760d4b0c0331cfcb4bb49ef6ba280 (patch) | |
tree | e25c28c831c6d131cb01d89d8480b3b455bc852e /src/com/android/gallery3d/filtershow/filters | |
parent | 5eab0b8e7a7b74d3b2d20a222312680591cb98b6 (diff) | |
download | android_packages_apps_Gallery2-afa8ed9d46e760d4b0c0331cfcb4bb49ef6ba280.tar.gz android_packages_apps_Gallery2-afa8ed9d46e760d4b0c0331cfcb4bb49ef6ba280.tar.bz2 android_packages_apps_Gallery2-afa8ed9d46e760d4b0c0331cfcb4bb49ef6ba280.zip |
Support for save state in images
bug:8626775
Change-Id: I2a34a6027b23dab9c1802f672bfbf399cac0c4f7
Diffstat (limited to 'src/com/android/gallery3d/filtershow/filters')
24 files changed, 185 insertions, 15 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java index 66ad10640..1a2150a1b 100644 --- a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java +++ b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java @@ -16,6 +16,8 @@ package com.android.gallery3d.filtershow.filters; import android.content.res.Resources; +import android.util.Log; + import com.android.gallery3d.filtershow.presets.ImagePreset; import java.util.HashMap; @@ -23,9 +25,12 @@ import java.util.Vector; public abstract class BaseFiltersManager { protected HashMap<Class, ImageFilter> mFilters = null; + protected HashMap<String, FilterRepresentation> mRepresentationLookup = null; + private static final String LOGTAG = "BaseFiltersManager"; protected void init() { mFilters = new HashMap<Class, ImageFilter>(); + mRepresentationLookup = new HashMap<String, FilterRepresentation>(); Vector<Class> filters = new Vector<Class>(); addFilterClasses(filters); for (Class filterClass : filters) { @@ -33,6 +38,12 @@ public abstract class BaseFiltersManager { Object filterInstance = filterClass.newInstance(); if (filterInstance instanceof ImageFilter) { mFilters.put(filterClass, (ImageFilter) filterInstance); + + FilterRepresentation rep = + ((ImageFilter) filterInstance).getDefaultRepresentation(); + if (rep != null) { + addRepresentation(rep); + } } } catch (InstantiationException e) { e.printStackTrace(); @@ -42,6 +53,20 @@ public abstract class BaseFiltersManager { } } + public void addRepresentation(FilterRepresentation rep) { + mRepresentationLookup.put(rep.getSerializationName(), rep); + } + + public FilterRepresentation createFilterFromName(String name) { + try { + return mRepresentationLookup.get(name).clone(); + } catch (Exception e) { + Log.v(LOGTAG, "unable to generate a filter representation for \"" + name + "\""); + e.printStackTrace(); + } + return null; + } + public ImageFilter getFilter(Class c) { return mFilters.get(c); } @@ -50,10 +75,6 @@ public abstract class BaseFiltersManager { return mFilters.get(representation.getFilterClass()); } - public void addFilter(Class filterClass, ImageFilter filter) { - mFilters.put(filterClass, filter); - } - public FilterRepresentation getRepresentation(Class c) { ImageFilter filter = mFilters.get(c); if (filter != null) { diff --git a/src/com/android/gallery3d/filtershow/filters/FilterBasicRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterBasicRepresentation.java index 3ef1e09ed..e0525e367 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterBasicRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterBasicRepresentation.java @@ -29,6 +29,8 @@ public class FilterBasicRepresentation extends FilterRepresentation implements P private int mMaximum; private int mDefaultValue; private int mPreviewValue; + public static final String SERIAL_NAME = "Name"; + public static final String SERIAL_VALUE = "Value"; public FilterBasicRepresentation(String name, int minimum, int value, int maximum) { super(name); @@ -165,4 +167,23 @@ public class FilterBasicRepresentation extends FilterRepresentation implements P public void copyFrom(Parameter src) { useParametersFrom((FilterBasicRepresentation) src); } + + @Override + public String[][] serializeRepresentation() { + String[][] ret = { + {SERIAL_NAME , getName() }, + {SERIAL_VALUE , Integer.toString(mValue)}}; + return ret; + } + + @Override + public void deSerializeRepresentation(String[][] rep) { + super.deSerializeRepresentation(rep); + for (int i = 0; i < rep.length; i++) { + if (SERIAL_VALUE.equals(rep[i][0])) { + mValue = Integer.parseInt(rep[i][1]); + break; + } + } + } } diff --git a/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java index 3511c67af..56d75178e 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java @@ -11,6 +11,7 @@ public class FilterCurvesRepresentation extends FilterRepresentation { public FilterCurvesRepresentation() { super("Curves"); + setSerializationName("CURVES"); setFilterClass(ImageFilterCurves.class); setTextId(R.string.curvesRGB); setButtonId(R.id.curvesButtonRGB); diff --git a/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java index dc59b0cfc..9b144b9e9 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java @@ -49,6 +49,7 @@ public class FilterDrawRepresentation extends FilterRepresentation { public FilterDrawRepresentation() { super("Draw"); + setSerializationName("DRAW"); setFilterClass(ImageFilterDraw.class); setPriority(FilterRepresentation.TYPE_VIGNETTE); setTextId(R.string.imageDraw); diff --git a/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java index 6e2e7ea16..1ceffb4a2 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java @@ -21,7 +21,8 @@ import com.android.gallery3d.app.Log; import com.android.gallery3d.filtershow.editors.ImageOnlyEditor; public class FilterFxRepresentation extends FilterRepresentation { - private static final String LOGTAG = "FilterFxRepresentation"; + private static final String SERIALIZATION_NAME = "LUT3D"; + private static final String LOGTAG = "FilterFxRepresentation"; // TODO: When implementing serialization, we should find a unique way of // specifying bitmaps / names (the resource IDs being random) private int mBitmapResource = 0; @@ -29,6 +30,8 @@ public class FilterFxRepresentation extends FilterRepresentation { public FilterFxRepresentation(String name, int bitmapResource, int nameResource) { super(name); + setSerializationName(SERIALIZATION_NAME); + mBitmapResource = bitmapResource; mNameResource = nameResource; setFilterClass(ImageFilterFx.class); diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java index 3f823ea1e..8a878415c 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java @@ -28,6 +28,7 @@ public class FilterRedEyeRepresentation extends FilterPointRepresentation { public FilterRedEyeRepresentation() { super("RedEye",R.string.redeye,EditorRedEye.ID); + setSerializationName("REDEYE"); setFilterClass(ImageFilterRedEye.class); setOverlayId(R.drawable.photoeditor_effect_redeye); setOverlayOnly(true); diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java index 5bb0e5733..f760e84df 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java @@ -34,7 +34,7 @@ public class FilterRepresentation implements Cloneable { private boolean mShowEditingControls = true; private boolean mShowParameterValue = true; private boolean mShowUtilityPanel = true; - + private String mSerializationName; public static final byte TYPE_BORDER = 1; public static final byte TYPE_FX = 2; public static final byte TYPE_WBALANCE = 3; @@ -63,6 +63,8 @@ public class FilterRepresentation implements Cloneable { representation.setShowEditingControls(showEditingControls()); representation.setShowParameterValue(showParameterValue()); representation.setShowUtilityPanel(showUtilityPanel()); + representation.mSerializationName = mSerializationName; + representation.mTempRepresentation = mTempRepresentation != null ? mTempRepresentation.clone() : null; if (DEBUG) { @@ -96,7 +98,11 @@ public class FilterRepresentation implements Cloneable { return mName; } - public void setName(String name) { + public void setScrName(String name) { + mName = name; + } + + protected void setName(String name) { mName = name; } @@ -104,6 +110,14 @@ public class FilterRepresentation implements Cloneable { return mName; } + public void setSerializationName(String sname) { + mSerializationName = sname; + } + + public String getSerializationName() { + return mSerializationName; + } + public void setPriority(int priority) { mPriority = priority; } @@ -241,4 +255,17 @@ public class FilterRepresentation implements Cloneable { return ""; } + public String[][] serializeRepresentation() { + String[][] ret = { { "Name" , getName() }}; + return ret; + } + + public void deSerializeRepresentation(String[][] rep) { + for (int i = 0; i < rep.length; i++) { + if ("Name".equals(rep[i][0])) { + mName = rep[i][0]; + break; + } + } + } } diff --git a/src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java index 7b69ce9e0..c570a757e 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java @@ -20,11 +20,14 @@ import com.android.gallery3d.R; import com.android.gallery3d.filtershow.editors.EditorTinyPlanet; public class FilterTinyPlanetRepresentation extends FilterBasicRepresentation { + private static final String SERIALIZATION_NAME = "TINYPLANET"; private static final String LOGTAG = "FilterTinyPlanetRepresentation"; + private static final String SERIAL_ANGLE = "Angle"; private float mAngle = 0; public FilterTinyPlanetRepresentation() { super("TinyPlanet", 0, 50, 100); + setSerializationName(SERIALIZATION_NAME); setShowParameterValue(true); setFilterClass(ImageFilterTinyPlanet.class); setPriority(FilterRepresentation.TYPE_TINYPLANET); @@ -62,4 +65,25 @@ public class FilterTinyPlanetRepresentation extends FilterBasicRepresentation { // TinyPlanet always has an effect return false; } + + @Override + public String[][] serializeRepresentation() { + String[][] ret = { + {SERIAL_NAME , getName() }, + {SERIAL_VALUE , Integer.toString(getValue())}, + {SERIAL_ANGLE , Float.toString(mAngle)}}; + return ret; + } + + @Override + public void deSerializeRepresentation(String[][] rep) { + super.deSerializeRepresentation(rep); + for (int i = 0; i < rep.length; i++) { + if (SERIAL_VALUE.equals(rep[i][0])) { + setValue(Integer.parseInt(rep[i][1])); + } else if (SERIAL_ANGLE.equals(rep[i][0])) { + setAngle(Float.parseFloat(rep[i][1])); + } + } + } } diff --git a/src/com/android/gallery3d/filtershow/filters/FilterVignetteRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterVignetteRepresentation.java index eef54ef58..9827088ff 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterVignetteRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterVignetteRepresentation.java @@ -29,6 +29,7 @@ public class FilterVignetteRepresentation extends FilterBasicRepresentation impl public FilterVignetteRepresentation() { super("Vignette", -100, 50, 100); + setSerializationName("VIGNETTE"); setShowParameterValue(true); setPriority(FilterRepresentation.TYPE_VIGNETTE); setTextId(R.string.vignette); @@ -111,4 +112,44 @@ public class FilterVignetteRepresentation extends FilterBasicRepresentation impl public boolean isNil() { return getValue() == 0; } + + private static final String[] sParams = { + "Name", "value", "mCenterX", "mCenterY", "mRadiusX", + "mRadiusY" + }; + + @Override + public String[][] serializeRepresentation() { + String[][] ret = { + { sParams[0], getName() }, + { sParams[1], Integer.toString(getValue()) }, + { sParams[2], Float.toString(mCenterX) }, + { sParams[3], Float.toString(mCenterY) }, + { sParams[4], Float.toString(mRadiusX) }, + { sParams[5], Float.toString(mRadiusY) } + }; + return ret; + } + + @Override + public void deSerializeRepresentation(String[][] rep) { + super.deSerializeRepresentation(rep); + for (int i = 0; i < rep.length; i++) { + String key = rep[i][0]; + String value = rep[i][1]; + if (sParams[0].equals(key)) { + setName(value); + } else if (sParams[1].equals(key)) { + setValue(Integer.parseInt(value)); + } else if (sParams[2].equals(key)) { + mCenterX = Float.parseFloat(value); + } else if (sParams[3].equals(key)) { + mCenterY = Float.parseFloat(value); + } else if (sParams[4].equals(key)) { + mRadiusX = Float.parseFloat(value); + } else if (sParams[5].equals(key)) { + mRadiusY = Float.parseFloat(value); + } + } + } } diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterBwFilter.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterBwFilter.java index a4626cdb2..64c48dffa 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterBwFilter.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterBwFilter.java @@ -23,6 +23,7 @@ import android.graphics.Color; public class ImageFilterBwFilter extends SimpleImageFilter { + private static final String SERIALIZATION_NAME = "BWFILTER"; public ImageFilterBwFilter() { mName = "BW Filter"; @@ -31,6 +32,8 @@ public class ImageFilterBwFilter extends SimpleImageFilter { public FilterRepresentation getDefaultRepresentation() { FilterBasicRepresentation representation = (FilterBasicRepresentation) super.getDefaultRepresentation(); representation.setName("BW Filter"); + representation.setSerializationName(SERIALIZATION_NAME); + representation.setFilterClass(ImageFilterBwFilter.class); representation.setMaximum(180); representation.setMinimum(-180); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterContrast.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterContrast.java index 2097f0d6e..c8b41c248 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterContrast.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterContrast.java @@ -21,6 +21,7 @@ import com.android.gallery3d.R; import android.graphics.Bitmap; public class ImageFilterContrast extends SimpleImageFilter { + private static final String SERIALIZATION_NAME = "CONTRAST"; public ImageFilterContrast() { mName = "Contrast"; @@ -30,6 +31,8 @@ public class ImageFilterContrast extends SimpleImageFilter { FilterBasicRepresentation representation = (FilterBasicRepresentation) super.getDefaultRepresentation(); representation.setName("Contrast"); + representation.setSerializationName(SERIALIZATION_NAME); + representation.setFilterClass(ImageFilterContrast.class); representation.setTextId(R.string.contrast); representation.setButtonId(R.id.contrastButton); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterDownsample.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterDownsample.java index 0b02fc4f6..ea2ff351d 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterDownsample.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterDownsample.java @@ -24,6 +24,7 @@ import com.android.gallery3d.R; import com.android.gallery3d.filtershow.cache.ImageLoader; public class ImageFilterDownsample extends SimpleImageFilter { + private static final String SERIALIZATION_NAME = "DOWNSAMPLE"; private static final int ICON_DOWNSAMPLE_FRACTION = 8; private ImageLoader mImageLoader; @@ -35,6 +36,8 @@ public class ImageFilterDownsample extends SimpleImageFilter { public FilterRepresentation getDefaultRepresentation() { FilterBasicRepresentation representation = (FilterBasicRepresentation) super.getDefaultRepresentation(); representation.setName("Downsample"); + representation.setSerializationName(SERIALIZATION_NAME); + representation.setFilterClass(ImageFilterDownsample.class); representation.setMaximum(100); representation.setMinimum(1); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterEdge.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterEdge.java index 46a9a294c..82de2b73a 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterEdge.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterEdge.java @@ -21,7 +21,7 @@ import android.graphics.Bitmap; import com.android.gallery3d.R; public class ImageFilterEdge extends SimpleImageFilter { - + private static final String SERIALIZATION_NAME = "EDGE"; public ImageFilterEdge() { mName = "Edge"; } @@ -29,6 +29,7 @@ public class ImageFilterEdge extends SimpleImageFilter { public FilterRepresentation getDefaultRepresentation() { FilterRepresentation representation = super.getDefaultRepresentation(); representation.setName("Edge"); + representation.setSerializationName(SERIALIZATION_NAME); representation.setFilterClass(ImageFilterEdge.class); representation.setTextId(R.string.edge); representation.setButtonId(R.id.edgeButton); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java index b0b0b2dd8..6fdcd249b 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java @@ -21,7 +21,7 @@ import com.android.gallery3d.R; import android.graphics.Bitmap; public class ImageFilterExposure extends SimpleImageFilter { - + private static final String SERIALIZATION_NAME = "EXPOSURE"; public ImageFilterExposure() { mName = "Exposure"; } @@ -30,6 +30,7 @@ public class ImageFilterExposure extends SimpleImageFilter { FilterBasicRepresentation representation = (FilterBasicRepresentation) super.getDefaultRepresentation(); representation.setName("Exposure"); + representation.setSerializationName(SERIALIZATION_NAME); representation.setFilterClass(ImageFilterExposure.class); representation.setTextId(R.string.exposure); representation.setButtonId(R.id.exposureButton); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java index 68e8a7c9d..51c66127b 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java @@ -37,6 +37,11 @@ public class ImageFilterFx extends ImageFilter { mFxBitmap = null; } + @Override + public FilterRepresentation getDefaultRepresentation() { + return null; + } + public void useRepresentation(FilterRepresentation representation) { FilterFxRepresentation parameters = (FilterFxRepresentation) representation; mParameters = parameters; @@ -87,4 +92,5 @@ public class ImageFilterFx extends ImageFilter { public void setResources(Resources resources) { mResources = resources; } + } diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterHighlights.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterHighlights.java index 0022a9eae..0725dd1c4 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterHighlights.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterHighlights.java @@ -21,6 +21,7 @@ import android.graphics.Bitmap; import com.android.gallery3d.R; public class ImageFilterHighlights extends SimpleImageFilter { + private static final String SERIALIZATION_NAME = "HIGHLIGHTS"; private static final String LOGTAG = "ImageFilterVignette"; public ImageFilterHighlights() { @@ -33,7 +34,8 @@ public class ImageFilterHighlights extends SimpleImageFilter { public FilterRepresentation getDefaultRepresentation() { FilterBasicRepresentation representation = (FilterBasicRepresentation) super.getDefaultRepresentation(); - representation.setName("Shadows"); + representation.setName("Highlights"); + representation.setSerializationName(SERIALIZATION_NAME); representation.setFilterClass(ImageFilterHighlights.class); representation.setTextId(R.string.highlight_recovery); representation.setButtonId(R.id.highlightRecoveryButton); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java index b1f9f7365..7e6f68548 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java @@ -22,6 +22,7 @@ import com.android.gallery3d.filtershow.editors.BasicEditor; import android.graphics.Bitmap; public class ImageFilterHue extends SimpleImageFilter { + private static final String SERIALIZATION_NAME = "HUE"; private ColorSpaceMatrix cmatrix = null; public ImageFilterHue() { @@ -33,6 +34,7 @@ public class ImageFilterHue extends SimpleImageFilter { FilterBasicRepresentation representation = (FilterBasicRepresentation) super.getDefaultRepresentation(); representation.setName("Hue"); + representation.setSerializationName(SERIALIZATION_NAME); representation.setFilterClass(ImageFilterHue.class); representation.setMinimum(-180); representation.setMaximum(180); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterKMeans.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterKMeans.java index 29e6d162f..93813813f 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterKMeans.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterKMeans.java @@ -22,6 +22,7 @@ import android.text.format.Time; import com.android.gallery3d.R; public class ImageFilterKMeans extends SimpleImageFilter { + private static final String SERIALIZATION_NAME = "KMEANS"; private int mSeed = 0; public ImageFilterKMeans() { @@ -36,6 +37,7 @@ public class ImageFilterKMeans extends SimpleImageFilter { public FilterRepresentation getDefaultRepresentation() { FilterBasicRepresentation representation = (FilterBasicRepresentation) super.getDefaultRepresentation(); representation.setName("KMeans"); + representation.setSerializationName(SERIALIZATION_NAME); representation.setFilterClass(ImageFilterKMeans.class); representation.setMaximum(20); representation.setMinimum(2); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java index c256686fb..0747190fa 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java @@ -6,13 +6,14 @@ import com.android.gallery3d.R; import com.android.gallery3d.filtershow.editors.ImageOnlyEditor; public class ImageFilterNegative extends ImageFilter { - + private static final String SERIALIZATION_NAME = "NEGATIVE"; public ImageFilterNegative() { mName = "Negative"; } public FilterRepresentation getDefaultRepresentation() { FilterRepresentation representation = new FilterDirectRepresentation("Negative"); + representation.setSerializationName(SERIALIZATION_NAME); representation.setFilterClass(ImageFilterNegative.class); representation.setTextId(R.string.negative); representation.setButtonId(R.id.negativeButton); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterSaturated.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterSaturated.java index 0febe4957..adc74c5ec 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterSaturated.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterSaturated.java @@ -21,7 +21,7 @@ import com.android.gallery3d.R; import android.graphics.Bitmap; public class ImageFilterSaturated extends SimpleImageFilter { - + private static final String SERIALIZATION_NAME = "SATURATED"; public ImageFilterSaturated() { mName = "Saturated"; } @@ -31,6 +31,7 @@ public class ImageFilterSaturated extends SimpleImageFilter { FilterBasicRepresentation representation = (FilterBasicRepresentation) super.getDefaultRepresentation(); representation.setName("Saturated"); + representation.setSerializationName(SERIALIZATION_NAME); representation.setFilterClass(ImageFilterSaturated.class); representation.setTextId(R.string.saturation); representation.setButtonId(R.id.saturationButton); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java index fd67ee8fc..845290b80 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java @@ -21,7 +21,7 @@ import com.android.gallery3d.R; import android.graphics.Bitmap; public class ImageFilterShadows extends SimpleImageFilter { - + private static final String SERIALIZATION_NAME = "SHADOWS"; public ImageFilterShadows() { mName = "Shadows"; @@ -31,6 +31,7 @@ public class ImageFilterShadows extends SimpleImageFilter { FilterBasicRepresentation representation = (FilterBasicRepresentation) super.getDefaultRepresentation(); representation.setName("Shadows"); + representation.setSerializationName(SERIALIZATION_NAME); representation.setFilterClass(ImageFilterShadows.class); representation.setTextId(R.string.shadow_recovery); representation.setButtonId(R.id.shadowRecoveryButton); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java index 76ae475ac..057c980f9 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java @@ -19,7 +19,7 @@ package com.android.gallery3d.filtershow.filters; import com.android.gallery3d.R; public class ImageFilterSharpen extends ImageFilterRS { - + private static final String SERIALIZATION_NAME = "SHARPEN"; private static final String LOGTAG = "ImageFilterSharpen"; private ScriptC_convolve3x3 mScript; @@ -31,6 +31,7 @@ public class ImageFilterSharpen extends ImageFilterRS { public FilterRepresentation getDefaultRepresentation() { FilterRepresentation representation = new FilterBasicRepresentation("Sharpen", 0, 0, 100); + representation.setSerializationName(SERIALIZATION_NAME); representation.setShowParameterValue(true); representation.setFilterClass(ImageFilterSharpen.class); representation.setTextId(R.string.sharpness); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterVibrance.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterVibrance.java index ea315d326..900fd906c 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterVibrance.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterVibrance.java @@ -21,7 +21,7 @@ import com.android.gallery3d.R; import android.graphics.Bitmap; public class ImageFilterVibrance extends SimpleImageFilter { - + private static final String SERIALIZATION_NAME = "VIBRANCE"; public ImageFilterVibrance() { mName = "Vibrance"; } @@ -30,6 +30,7 @@ public class ImageFilterVibrance extends SimpleImageFilter { FilterBasicRepresentation representation = (FilterBasicRepresentation) super.getDefaultRepresentation(); representation.setName("Vibrance"); + representation.setSerializationName(SERIALIZATION_NAME); representation.setFilterClass(ImageFilterVibrance.class); representation.setTextId(R.string.vibrance); representation.setButtonId(R.id.vibranceButton); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java index c4c293a4b..84a14c902 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java @@ -22,6 +22,7 @@ import com.android.gallery3d.filtershow.editors.ImageOnlyEditor; import android.graphics.Bitmap; public class ImageFilterWBalance extends ImageFilter { + private static final String SERIALIZATION_NAME = "WBALANCE"; private static final String TAG = "ImageFilterWBalance"; public ImageFilterWBalance() { @@ -30,6 +31,7 @@ public class ImageFilterWBalance extends ImageFilter { public FilterRepresentation getDefaultRepresentation() { FilterRepresentation representation = new FilterDirectRepresentation("WBalance"); + representation.setSerializationName(SERIALIZATION_NAME); representation.setFilterClass(ImageFilterWBalance.class); representation.setPriority(FilterRepresentation.TYPE_WBALANCE); representation.setTextId(R.string.wbalance); |