summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-02-08 18:13:24 -0800
committernicolasroard <nicolasroard@google.com>2013-02-08 18:13:24 -0800
commit878fcb4379718e13504dbebe8cf51fc2b60de22b (patch)
tree508d5abb45d1b395579e076329ee9733793dc954 /src
parent7451e88f78f802542d25f4ad406b4f2f5f67c5f0 (diff)
downloadandroid_packages_apps_Snap-878fcb4379718e13504dbebe8cf51fc2b60de22b.tar.gz
android_packages_apps_Snap-878fcb4379718e13504dbebe8cf51fc2b60de22b.tar.bz2
android_packages_apps_Snap-878fcb4379718e13504dbebe8cf51fc2b60de22b.zip
Move filter type to representations
Change-Id: I2d49447c57f4ff49001d27cdfa6482ca320c7a8b
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java2
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java1
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.java2
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java16
-rw-r--r--src/com/android/gallery3d/filtershow/presets/ImagePreset.java12
5 files changed, 25 insertions, 8 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java
index 3ea678c44..0c0791ae4 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java
@@ -27,7 +27,7 @@ public class FilterColorBorderRepresentation extends FilterRepresentation {
mBorderSize = size;
mBorderRadius = radius;
setFilterClass(ImageFilterParametricBorder.class);
- setPriority(ImageFilter.TYPE_BORDER);
+ setPriority(FilterRepresentation.TYPE_BORDER);
}
public String toString() {
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java
index 5aff39df4..1234767c4 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java
@@ -31,6 +31,7 @@ public class FilterFxRepresentation extends FilterRepresentation {
mBitmapResource = bitmapResource;
mNameResource = nameResource;
setFilterClass(ImageFilterFx.class);
+ setFilterType(FilterRepresentation.TYPE_FX);
}
public String toString() {
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.java
index 2b40fccc0..7c9f58faa 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.java
@@ -23,7 +23,7 @@ public class FilterImageBorderRepresentation extends FilterRepresentation {
super("ImageBorder");
mDrawableResource = drawableResource;
setFilterClass(ImageFilterBorder.class);
- setPriority(ImageFilter.TYPE_BORDER);
+ setPriority(FilterRepresentation.TYPE_BORDER);
// load the drawable at init as we are in a background thread
// (see FilterShowActivity's LoadBordersTask)
ImageFilterBorder filter = (ImageFilterBorder) FiltersManager.getManager().getFilter(getFilterClass());
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
index 7d9d7f923..7d162f087 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
@@ -29,6 +29,14 @@ public class FilterRepresentation implements Cloneable {
private boolean mShowParameterValue;
private Class mFilterClass;
+ public static final byte TYPE_BORDER = 1;
+ public static final byte TYPE_FX = 2;
+ public static final byte TYPE_WBALANCE = 3;
+ public static final byte TYPE_VIGNETTE = 4;
+ public static final byte TYPE_NORMAL = 5;
+ public static final byte TYPE_TINYPLANET = 6;
+ private byte filterType = TYPE_NORMAL;
+
public FilterRepresentation(String name) {
mName = name;
}
@@ -60,6 +68,14 @@ public class FilterRepresentation implements Cloneable {
return mName;
}
+ public byte getFilterType() {
+ return filterType;
+ }
+
+ protected void setFilterType(byte type) {
+ filterType = type;
+ }
+
public void setName(String name) {
mName = name;
}
diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java
index fb58d1ff9..c7d14e80b 100644
--- a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java
+++ b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java
@@ -172,11 +172,11 @@ public class ImagePreset {
return false;
}
for (FilterRepresentation representation : mFilters) {
- if (representation.getPriority() == ImageFilter.TYPE_VIGNETTE
+ if (representation.getPriority() == FilterRepresentation.TYPE_VIGNETTE
&& !representation.isNil()) {
return false;
}
- if (representation.getPriority() == ImageFilter.TYPE_TINYPLANET
+ if (representation.getPriority() == FilterRepresentation.TYPE_TINYPLANET
&& !representation.isNil()) {
return false;
}
@@ -323,20 +323,20 @@ public class ImagePreset {
public void addFilter(FilterRepresentation representation) {
Log.v(LOGTAG, "*** Add Filter *** " + representation);
- if (representation.getPriority() == ImageFilter.TYPE_BORDER) {
+ if (representation.getPriority() == FilterRepresentation.TYPE_BORDER) {
setHistoryName(representation.getName());
setBorder(representation);
- } else if (representation.getPriority() == ImageFilter.TYPE_FX) {
+ } else if (representation.getPriority() == FilterRepresentation.TYPE_FX) {
boolean found = false;
for (int i = 0; i < mFilters.size(); i++) {
int type = mFilters.elementAt(i).getPriority();
if (found) {
- if (type != ImageFilter.TYPE_VIGNETTE) {
+ if (type != FilterRepresentation.TYPE_VIGNETTE) {
mFilters.remove(i);
continue;
}
}
- if (type == ImageFilter.TYPE_FX) {
+ if (type == FilterRepresentation.TYPE_FX) {
mFilters.remove(i);
mFilters.add(i, representation);
setHistoryName(representation.getName());