summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java62
-rw-r--r--src/com/android/gallery3d/filtershow/PanelController.java1
-rw-r--r--src/com/android/gallery3d/filtershow/cache/FilteringPipeline.java1
-rw-r--r--src/com/android/gallery3d/filtershow/editors/ImageOnlyEditor.java6
-rw-r--r--src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java39
-rw-r--r--src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java29
6 files changed, 72 insertions, 66 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index 4133d8915..fb8984989 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -119,7 +119,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
private static final int SELECT_PICTURE = 1;
private static final String LOGTAG = "FilterShowActivity";
protected static final boolean ANIMATE_PANELS = true;
- private static int mImageBorderSize = 4; // in percent
private boolean mShowingTinyPlanet = false;
private boolean mShowingImageStatePanel = false;
@@ -398,27 +397,10 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
borders.add(new FilterImageBorderRepresentation(0));
// Google-build borders
- FiltersManager.getManager().addBorders(borders);
-
- // Regular borders
- borders.add(new FilterImageBorderRepresentation(R.drawable.filtershow_border_4x5));
- borders.add(new FilterImageBorderRepresentation(R.drawable.filtershow_border_brush));
- borders.add(new FilterImageBorderRepresentation(R.drawable.filtershow_border_grunge));
- borders.add(new FilterImageBorderRepresentation(R.drawable.filtershow_border_sumi_e));
- borders.add(new FilterImageBorderRepresentation(R.drawable.filtershow_border_tape));
- borders.add(new FilterColorBorderRepresentation(Color.BLACK, mImageBorderSize, 0));
- borders.add(new FilterColorBorderRepresentation(Color.BLACK, mImageBorderSize,
- mImageBorderSize));
- borders.add(new FilterColorBorderRepresentation(Color.WHITE, mImageBorderSize, 0));
- borders.add(new FilterColorBorderRepresentation(Color.WHITE, mImageBorderSize,
- mImageBorderSize));
- int creamColor = Color.argb(255, 237, 237, 227);
- borders.add(new FilterColorBorderRepresentation(creamColor, mImageBorderSize, 0));
- borders.add(new FilterColorBorderRepresentation(creamColor, mImageBorderSize,
- mImageBorderSize));
+ FiltersManager.getManager().addBorders(this, borders);
+
for (int i = 0; i < borders.size(); i++) {
FilterRepresentation filter = borders.elementAt(i);
- filter.setName(getString(R.string.borders));
if (i == 0) {
filter.setName(getString(R.string.none));
}
@@ -738,41 +720,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
}
private void fillFx(LinearLayout listFilters, int buttonId) {
- // TODO: use listview
- // TODO: load the filters straight from the filesystem
-
- FilterFxRepresentation[] fxArray = new FilterFxRepresentation[18];
- int p = 0;
-
- int[] drawid = {
- R.drawable.filtershow_fx_0005_punch,
- R.drawable.filtershow_fx_0000_vintage,
- R.drawable.filtershow_fx_0004_bw_contrast,
- R.drawable.filtershow_fx_0002_bleach,
- R.drawable.filtershow_fx_0001_instant,
- R.drawable.filtershow_fx_0007_washout,
- R.drawable.filtershow_fx_0003_blue_crush,
- R.drawable.filtershow_fx_0008_washout_color,
- R.drawable.filtershow_fx_0006_x_process
- };
-
- int[] fxNameid = {
- R.string.ffx_punch,
- R.string.ffx_vintage,
- R.string.ffx_bw_contrast,
- R.string.ffx_bleach,
- R.string.ffx_instant,
- R.string.ffx_washout,
- R.string.ffx_blue_crush,
- R.string.ffx_washout_color,
- R.string.ffx_x_process
- };
-
- for (int i = 0; i < drawid.length; i++) {
- FilterFxRepresentation fx = new FilterFxRepresentation(getString(fxNameid[i]), drawid[i], fxNameid[i]);
- fxArray[p++] = fx;
- }
-
ImageButton button = (ImageButton) findViewById(buttonId);
FilterFxRepresentation nullFx = new FilterFxRepresentation(getString(R.string.none), 0, R.string.none);
@@ -780,14 +727,11 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
mNullFxFilter.setSelected(true);
Vector<FilterRepresentation> filtersRepresentations = new Vector<FilterRepresentation>();
- FiltersManager.getManager().addLooks(filtersRepresentations);
+ FiltersManager.getManager().addLooks(this, filtersRepresentations);
for (FilterRepresentation representation : filtersRepresentations) {
setupFilterRepresentationButton(representation, listFilters, button);
}
- for (int i = 0; i < p; i++) {
- setupFilterRepresentationButton(fxArray[i], listFilters, button);
- }
}
public void setDefaultPreset() {
diff --git a/src/com/android/gallery3d/filtershow/PanelController.java b/src/com/android/gallery3d/filtershow/PanelController.java
index e9a913610..2cd70e3aa 100644
--- a/src/com/android/gallery3d/filtershow/PanelController.java
+++ b/src/com/android/gallery3d/filtershow/PanelController.java
@@ -598,6 +598,7 @@ public class PanelController implements OnClickListener {
mCurrentEditor = null;
FilterIconButton component = (FilterIconButton) view;
FilterRepresentation representation = component.getFilterRepresentation();
+
if (representation != null) {
mUtilityPanel.setEffectName(representation.getName());
mUtilityPanel.setShowParameter(representation.showParameterValue());
diff --git a/src/com/android/gallery3d/filtershow/cache/FilteringPipeline.java b/src/com/android/gallery3d/filtershow/cache/FilteringPipeline.java
index e63323b92..8202d71bb 100644
--- a/src/com/android/gallery3d/filtershow/cache/FilteringPipeline.java
+++ b/src/com/android/gallery3d/filtershow/cache/FilteringPipeline.java
@@ -151,7 +151,6 @@ public class FilteringPipeline implements Handler.Callback {
Log.e(LOGTAG, "setOriginal called after pipeline initialization!");
return;
}
- Log.v(LOGTAG,"setOriginal, size " + bitmap.getWidth() + " x " + bitmap.getHeight());
mAccessoryPipeline.setOriginal(bitmap);
mPreviewPipeline.setOriginal(bitmap);
mHighresPreviewPipeline.setOriginal(bitmap);
diff --git a/src/com/android/gallery3d/filtershow/editors/ImageOnlyEditor.java b/src/com/android/gallery3d/filtershow/editors/ImageOnlyEditor.java
index a3fc5aab4..d4e66edf8 100644
--- a/src/com/android/gallery3d/filtershow/editors/ImageOnlyEditor.java
+++ b/src/com/android/gallery3d/filtershow/editors/ImageOnlyEditor.java
@@ -26,7 +26,7 @@ import com.android.gallery3d.filtershow.imageshow.ImageShow;
* The editor with no slider for filters without UI
*/
public class ImageOnlyEditor extends Editor {
- public static int ID = R.id.imageOnlyEditor;
+ public final static int ID = R.id.imageOnlyEditor;
private final String LOGTAG = "ImageOnlyEditor";
public ImageOnlyEditor() {
@@ -37,6 +37,10 @@ public class ImageOnlyEditor extends Editor {
super(id);
}
+ public boolean useUtilityPanel() {
+ return false;
+ }
+
@Override
public void createEditor(Context context, FrameLayout frameLayout) {
super.createEditor(context, frameLayout);
diff --git a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java
index 21bdf8dd9..ec9a4368c 100644
--- a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java
+++ b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java
@@ -15,7 +15,10 @@
*/
package com.android.gallery3d.filtershow.filters;
+import android.content.Context;
import android.content.res.Resources;
+
+import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.presets.ImagePreset;
import java.util.HashMap;
@@ -109,12 +112,40 @@ public abstract class BaseFiltersManager {
filters.add(ImageFilterGeometry.class);
}
- public void addBorders(Vector<FilterRepresentation> representations) {
- // Override
+ public void addBorders(Context context, Vector<FilterRepresentation> representations) {
+
}
- public void addLooks(Vector<FilterRepresentation> representations) {
- // Override
+ public void addLooks(Context context, Vector<FilterRepresentation> representations) {
+ int[] drawid = {
+ R.drawable.filtershow_fx_0005_punch,
+ R.drawable.filtershow_fx_0000_vintage,
+ R.drawable.filtershow_fx_0004_bw_contrast,
+ R.drawable.filtershow_fx_0002_bleach,
+ R.drawable.filtershow_fx_0001_instant,
+ R.drawable.filtershow_fx_0007_washout,
+ R.drawable.filtershow_fx_0003_blue_crush,
+ R.drawable.filtershow_fx_0008_washout_color,
+ R.drawable.filtershow_fx_0006_x_process
+ };
+
+ int[] fxNameid = {
+ R.string.ffx_punch,
+ R.string.ffx_vintage,
+ R.string.ffx_bw_contrast,
+ R.string.ffx_bleach,
+ R.string.ffx_instant,
+ R.string.ffx_washout,
+ R.string.ffx_blue_crush,
+ R.string.ffx_washout_color,
+ R.string.ffx_x_process
+ };
+
+ for (int i = 0; i < drawid.length; i++) {
+ FilterFxRepresentation fx = new FilterFxRepresentation(
+ context.getString(fxNameid[i]), drawid[i], fxNameid[i]);
+ representations.add(fx);
+ }
}
public void addEffects(Vector<FilterRepresentation> representations) {
diff --git a/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java b/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java
index 9de9b7b91..97588db1c 100644
--- a/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java
+++ b/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java
@@ -16,7 +16,11 @@
package com.android.gallery3d.filtershow.filters;
+import android.content.Context;
import android.content.res.Resources;
+import android.graphics.Color;
+
+import com.android.gallery3d.R;
import java.util.HashMap;
import java.util.Vector;
@@ -25,7 +29,7 @@ public class FiltersManager extends BaseFiltersManager {
private static FiltersManager sInstance = null;
private static FiltersManager sPreviewInstance = null;
private static FiltersManager sHighresInstance = null;
-
+ private static int mImageBorderSize = 4; // in percent
public FiltersManager() {
init();
}
@@ -44,6 +48,29 @@ public class FiltersManager extends BaseFiltersManager {
return sInstance;
}
+ @Override
+ public void addBorders(Context context, Vector<FilterRepresentation> representations) {
+ // Regular borders
+ representations.add(new FilterImageBorderRepresentation(R.drawable.filtershow_border_4x5));
+ representations.add(
+ new FilterImageBorderRepresentation(R.drawable.filtershow_border_brush));
+ representations.add(
+ new FilterImageBorderRepresentation(R.drawable.filtershow_border_grunge));
+ representations.add(
+ new FilterImageBorderRepresentation(R.drawable.filtershow_border_sumi_e));
+ representations.add(new FilterImageBorderRepresentation(R.drawable.filtershow_border_tape));
+ representations.add(new FilterColorBorderRepresentation(Color.BLACK, mImageBorderSize, 0));
+ representations.add(new FilterColorBorderRepresentation(Color.BLACK, mImageBorderSize,
+ mImageBorderSize));
+ representations.add(new FilterColorBorderRepresentation(Color.WHITE, mImageBorderSize, 0));
+ representations.add(new FilterColorBorderRepresentation(Color.WHITE, mImageBorderSize,
+ mImageBorderSize));
+ int creamColor = Color.argb(255, 237, 237, 227);
+ representations.add(new FilterColorBorderRepresentation(creamColor, mImageBorderSize, 0));
+ representations.add(new FilterColorBorderRepresentation(creamColor, mImageBorderSize,
+ mImageBorderSize));
+ }
+
public static FiltersManager getHighresManager() {
if (sHighresInstance == null) {
sHighresInstance = new FiltersManager();