summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java32
-rw-r--r--src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java7
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java2
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java1
-rw-r--r--src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java2
5 files changed, 29 insertions, 15 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index 26a70d4..2f9269f 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -194,11 +194,11 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
mPanelController.addPanel(R.id.geometryButton, R.id.geometryList, 2);
mPanelController.addPanel(R.id.colorsButton, R.id.colorsFxList, 3);
- fillFilters();
- fillGeometry();
fillFx((LinearLayout) findViewById(R.id.listFilters), R.id.fxButton);
LoadBordersTask loadBorders = new LoadBordersTask((LinearLayout) findViewById(R.id.listBorders));
loadBorders.execute();
+ fillGeometry();
+ fillFilters();
mPanelController.addView(findViewById(R.id.applyEffect));
@@ -221,24 +221,28 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
mPanelController.setCurrentPanel(R.id.fxButton);
}
+ private void fillPanel(Vector<FilterRepresentation> representations, int layoutId, int buttonId) {
+ ImageButton button = (ImageButton) findViewById(buttonId);
+ LinearLayout layout = (LinearLayout) findViewById(layoutId);
+
+ for (FilterRepresentation representation : representations) {
+ setupFilterRepresentationButton(representation, layout, button);
+ }
+ }
+
private void fillFilters() {
Vector<FilterRepresentation> filtersRepresentations = new Vector<FilterRepresentation>();
-
FiltersManager filtersManager = FiltersManager.getManager();
filtersManager.addEffects(filtersRepresentations);
-
- ImageButton colorsButton = (ImageButton) findViewById(R.id.colorsButton);
- for (FilterRepresentation representation : filtersRepresentations) {
- setupFilterRepresentationButton(representation,
- (LinearLayout) findViewById(R.id.listColorsFx), colorsButton);
- }
+ fillPanel(filtersRepresentations, R.id.listColorsFx, R.id.colorsButton);
}
private void fillGeometry() {
- // TODO: move to a separate function.
+ Vector<FilterRepresentation> filtersRepresentations = new Vector<FilterRepresentation>();
+ FiltersManager filtersManager = FiltersManager.getManager();
+
GeometryMetadata geo = new GeometryMetadata();
int[] editorsId = geo.getEditorIds();
- ImageButton geometryButton = (ImageButton) findViewById(R.id.geometryButton);
for (int i = 0; i < editorsId.length; i++) {
int editorId = editorsId[i];
GeometryMetadata geometry = new GeometryMetadata(geo);
@@ -247,9 +251,11 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
geometry.setTextId(editorInfo.getTextId());
geometry.setOverlayId(editorInfo.getOverlayId());
geometry.setOverlayOnly(editorInfo.getOverlayOnly());
- setupFilterRepresentationButton(
- geometry, (LinearLayout) findViewById(R.id.listGeometry), geometryButton);
+ filtersRepresentations.add(geometry);
}
+
+ filtersManager.addTools(filtersRepresentations);
+ fillPanel(filtersRepresentations, R.id.listGeometry, R.id.geometryButton);
}
private void processIntent() {
diff --git a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java
index 820bdbf..1fe2ac6 100644
--- a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java
+++ b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java
@@ -74,7 +74,6 @@ public abstract class BaseFiltersManager {
public void addEffects(Vector<FilterRepresentation> representations) {
representations.add(getRepresentation(ImageFilterTinyPlanet.class));
- representations.add(getRepresentation(ImageFilterRedEye.class));
representations.add(getRepresentation(ImageFilterWBalance.class));
representations.add(getRepresentation(ImageFilterExposure.class));
representations.add(getRepresentation(ImageFilterVignette.class));
@@ -84,7 +83,6 @@ public abstract class BaseFiltersManager {
representations.add(getRepresentation(ImageFilterVibrance.class));
representations.add(getRepresentation(ImageFilterSharpen.class));
representations.add(getRepresentation(ImageFilterCurves.class));
- representations.add(getRepresentation(ImageFilterDraw.class));
representations.add(getRepresentation(ImageFilterHue.class));
representations.add(getRepresentation(ImageFilterSaturated.class));
representations.add(getRepresentation(ImageFilterBwFilter.class));
@@ -93,6 +91,11 @@ public abstract class BaseFiltersManager {
representations.add(getRepresentation(ImageFilterKMeans.class));
}
+ public void addTools(Vector<FilterRepresentation> representations) {
+ representations.add(getRepresentation(ImageFilterRedEye.class));
+ representations.add(getRepresentation(ImageFilterDraw.class));
+ }
+
public void resetBitmapsRS() {
for (Class c : mFilters.keySet()) {
ImageFilter filter = mFilters.get(c);
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java
index 8b8504b..dc59b0c 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java
@@ -54,6 +54,8 @@ public class FilterDrawRepresentation extends FilterRepresentation {
setTextId(R.string.imageDraw);
setButtonId(R.id.drawOnImageButton);
setEditorId(EditorDraw.ID);
+ setOverlayId(R.drawable.filtershow_drawing);
+ setOverlayOnly(true);
}
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
index fb39660..3f823ea 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
@@ -30,6 +30,7 @@ public class FilterRedEyeRepresentation extends FilterPointRepresentation {
super("RedEye",R.string.redeye,EditorRedEye.ID);
setFilterClass(ImageFilterRedEye.class);
setOverlayId(R.drawable.photoeditor_effect_redeye);
+ setOverlayOnly(true);
}
public void addRect(RectF rect, RectF bounds) {
diff --git a/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java b/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java
index b05b546..d6b8718 100644
--- a/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java
+++ b/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java
@@ -17,6 +17,7 @@
package com.android.gallery3d.filtershow.filters;
import java.util.HashMap;
+import java.util.Vector;
public class FiltersManager extends BaseFiltersManager {
private static FiltersManager sInstance = null;
@@ -36,4 +37,5 @@ public class FiltersManager extends BaseFiltersManager {
public static void reset() {
sInstance = null;
}
+
}