summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Hoford <hoford@google.com>2013-01-18 08:59:35 -0800
committerJohn Hoford <hoford@google.com>2013-01-18 15:53:52 -0800
commit0cd4c8706f242f7a5d625e5b88509fc646859807 (patch)
tree83d08b8c5330037cae2fd358cc48bce33076a4c6
parent6c95a5c97615593181365d8f320e733eb2df54e0 (diff)
downloadandroid_packages_apps_Snap-0cd4c8706f242f7a5d625e5b88509fc646859807.tar.gz
android_packages_apps_Snap-0cd4c8706f242f7a5d625e5b88509fc646859807.tar.bz2
android_packages_apps_Snap-0cd4c8706f242f7a5d625e5b88509fc646859807.zip
refactor the filter/editor relationship
Change-Id: I1f9a735166c28c65734fbb85201774fb6f664076
-rw-r--r--src/com/android/gallery3d/filtershow/EditorPlaceHolder.java78
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java21
-rw-r--r--src/com/android/gallery3d/filtershow/PanelController.java46
-rw-r--r--src/com/android/gallery3d/filtershow/editors/BasicEditor.java85
-rw-r--r--src/com/android/gallery3d/filtershow/editors/Editor.java127
-rw-r--r--src/com/android/gallery3d/filtershow/editors/EditorCurves.java37
-rw-r--r--src/com/android/gallery3d/filtershow/editors/EditorZoom.java37
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilter.java3
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java6
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/ImageDraw.java1
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/ImageShow.java1
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/MasterImage.java2
-rw-r--r--src_pd/com/android/gallery3d/filtershow/editors/EditorManager.java32
13 files changed, 455 insertions, 21 deletions
diff --git a/src/com/android/gallery3d/filtershow/EditorPlaceHolder.java b/src/com/android/gallery3d/filtershow/EditorPlaceHolder.java
new file mode 100644
index 000000000..1b6c5ea58
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/EditorPlaceHolder.java
@@ -0,0 +1,78 @@
+package com.android.gallery3d.filtershow;
+
+import android.content.Context;
+import android.util.Log;
+import android.view.View;
+import android.widget.FrameLayout;
+
+import com.android.gallery3d.filtershow.cache.ImageLoader;
+import com.android.gallery3d.filtershow.editors.Editor;
+import com.android.gallery3d.filtershow.imageshow.ImageShow;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Vector;
+
+public class EditorPlaceHolder {
+ private static final String LOGTAG = "PanelController";
+
+ private FilterShowActivity mActivity = null;
+ private FrameLayout mContainer = null;
+ private HashMap<Integer, Editor> mEditors = new HashMap<Integer, Editor>();
+ private Vector<ImageShow> mOldViews = new Vector<ImageShow>();
+ private ImageLoader mImageLoader = null;
+
+ public EditorPlaceHolder(FilterShowActivity activity) {
+ mActivity = activity;
+ }
+
+ public void setContainer(FrameLayout container) {
+ mContainer = container;
+ }
+
+ public void addEditor(Editor c) {
+ mEditors.put(c.getID(), c);
+ }
+
+ public boolean contains(int type) {
+ if (mEditors.get(type) != null) {
+ return true;
+ }
+ return false;
+ }
+
+ public Editor showEditor(int type) {
+ Editor editor = mEditors.get(type);
+ if (editor == null) {
+ return null;
+ }
+
+ try {
+ editor.createEditor(mActivity, mContainer);
+ editor.setImageLoader(mImageLoader);
+ mContainer.setVisibility(View.VISIBLE);
+ mContainer.removeAllViews();
+ mContainer.addView(editor.getTopLevelView());
+ hideOldViews();
+ editor.setVisibility(View.VISIBLE);
+ return editor;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public void setOldViews(Vector<ImageShow> views) {
+ mOldViews = views;
+ }
+
+ public void hideOldViews() {
+ for (View view : mOldViews) {
+ view.setVisibility(View.GONE);
+ }
+ }
+
+ public void setImageLoader(ImageLoader imageLoader) {
+ mImageLoader = imageLoader;
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index e8e629a5a..376538086 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -47,6 +47,7 @@ import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
+import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
@@ -58,6 +59,7 @@ import android.widget.Toast;
import com.android.gallery3d.R;
import com.android.gallery3d.data.LocalAlbum;
import com.android.gallery3d.filtershow.cache.ImageLoader;
+import com.android.gallery3d.filtershow.editors.EditorManager;
import com.android.gallery3d.filtershow.filters.FiltersManager;
import com.android.gallery3d.filtershow.filters.ImageFilter;
import com.android.gallery3d.filtershow.filters.ImageFilterBorder;
@@ -104,11 +106,9 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
private final PanelController mPanelController = new PanelController();
private ImageLoader mImageLoader = null;
private ImageShow mImageShow = null;
- private ImageCurves mImageCurves = null;
private ImageRedEyes mImageRedEyes = null;
private ImageDraw mImageDraw = null;
private ImageStraighten mImageStraighten = null;
- private ImageZoom mImageZoom = null;
private ImageCrop mImageCrop = null;
private ImageRotate mImageRotate = null;
private ImageFlip mImageFlip = null;
@@ -130,6 +130,8 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
private LinearLayout listFilters = null;
private LinearLayout listBorders = null;
+ private EditorPlaceHolder mEditorPlaceHolder = new EditorPlaceHolder(this);
+
private static final int SELECT_PICTURE = 1;
private static final String LOGTAG = "FilterShowActivity";
protected static final boolean ANIMATE_PANELS = true;
@@ -200,9 +202,7 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
listColors = (LinearLayout) findViewById(R.id.listColorsFx);
mImageShow = (ImageShow) findViewById(R.id.imageShow);
- mImageCurves = (ImageCurves) findViewById(R.id.imageCurves);
mImageStraighten = (ImageStraighten) findViewById(R.id.imageStraighten);
- mImageZoom = (ImageZoom) findViewById(R.id.imageZoom);
mImageCrop = (ImageCrop) findViewById(R.id.imageCrop);
mImageRotate = (ImageRotate) findViewById(R.id.imageRotate);
mImageFlip = (ImageFlip) findViewById(R.id.imageFlip);
@@ -214,9 +214,7 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
ImageCrop.setTouchTolerance((int) getPixelsFromDip(25));
ImageCrop.setMinCropSize((int) getPixelsFromDip(55));
mImageViews.add(mImageShow);
- mImageViews.add(mImageCurves);
mImageViews.add(mImageStraighten);
- mImageViews.add(mImageZoom);
mImageViews.add(mImageCrop);
mImageViews.add(mImageRotate);
mImageViews.add(mImageFlip);
@@ -226,6 +224,11 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
mImageLoader.addCacheListener(imageShow);
}
+ mEditorPlaceHolder.setContainer((FrameLayout) findViewById(R.id.editorContainer));
+ EditorManager.addEditors(mEditorPlaceHolder);
+ mEditorPlaceHolder.setOldViews(mImageViews);
+ mEditorPlaceHolder.setImageLoader(mImageLoader);
+
mListFx = findViewById(R.id.fxList);
mListBorders = findViewById(R.id.bordersList);
mListGeometry = findViewById(R.id.geometryList);
@@ -248,9 +251,7 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
mBottomPanelButtons.add(mColorsButton);
mImageShow.setImageLoader(mImageLoader);
- mImageCurves.setImageLoader(mImageLoader);
mImageStraighten.setImageLoader(mImageLoader);
- mImageZoom.setImageLoader(mImageLoader);
mImageCrop.setImageLoader(mImageLoader);
mImageRotate.setImageLoader(mImageLoader);
mImageFlip.setImageLoader(mImageLoader);
@@ -259,14 +260,13 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
mImageDraw.setImageLoader(mImageLoader);
mPanelController.setActivity(this);
+ mPanelController.setEditorPlaceHolder(mEditorPlaceHolder);
mPanelController.addImageView(findViewById(R.id.imageShow));
- mPanelController.addImageView(findViewById(R.id.imageCurves));
mPanelController.addImageView(findViewById(R.id.imageStraighten));
mPanelController.addImageView(findViewById(R.id.imageCrop));
mPanelController.addImageView(findViewById(R.id.imageRotate));
mPanelController.addImageView(findViewById(R.id.imageFlip));
- mPanelController.addImageView(findViewById(R.id.imageZoom));
mPanelController.addImageView(findViewById(R.id.imageTinyPlanet));
mPanelController.addImageView(findViewById(R.id.imageRedEyes));
mPanelController.addImageView(findViewById(R.id.imageDraw));
@@ -311,7 +311,6 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
seekBar.setMax(SEEK_BAR_MAX);
mImageShow.setSeekBar(seekBar);
- mImageZoom.setSeekBar(seekBar);
mImageTinyPlanet.setSeekBar(seekBar);
mPanelController.setRowPanel(findViewById(R.id.secondRowPanel));
mPanelController.setUtilityPanel(this, findViewById(R.id.filterButtonsList),
diff --git a/src/com/android/gallery3d/filtershow/PanelController.java b/src/com/android/gallery3d/filtershow/PanelController.java
index 9f49e89f5..7f99218de 100644
--- a/src/com/android/gallery3d/filtershow/PanelController.java
+++ b/src/com/android/gallery3d/filtershow/PanelController.java
@@ -26,6 +26,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.editors.Editor;
import com.android.gallery3d.filtershow.filters.ImageFilter;
import com.android.gallery3d.filtershow.filters.ImageFilterTinyPlanet;
import com.android.gallery3d.filtershow.imageshow.ImageCrop;
@@ -234,7 +235,9 @@ public class PanelController implements OnClickListener {
private UtilityPanel mUtilityPanel = null;
private MasterImage mMasterImage = MasterImage.getImage();
private ImageShow mCurrentImage = null;
+ private Editor mCurrentEditor = null;
private FilterShowActivity mActivity = null;
+ private EditorPlaceHolder mEditorPlaceHolder = null;
public void setActivity(FilterShowActivity activity) {
mActivity = activity;
@@ -276,6 +279,10 @@ public class PanelController implements OnClickListener {
if (mCurrentImage != null) {
mCurrentImage.resetParameter();
mCurrentImage.select();
+ if (mCurrentEditor != null) {
+ mCurrentEditor.reflectCurrentFilter();
+ }
+
}
if (mDisableFilterButtons) {
mActivity.enableFilterButtons();
@@ -292,6 +299,10 @@ public class PanelController implements OnClickListener {
mMasterImage.onHistoryItemClick(position);
showPanel(mCurrentPanel);
mCurrentImage.select();
+ if (mCurrentEditor != null) {
+ mCurrentEditor.reflectCurrentFilter();
+ }
+
if (mDisableFilterButtons) {
mActivity.enableFilterButtons();
mActivity.resetHistory();
@@ -456,19 +467,32 @@ public class PanelController implements OnClickListener {
mUtilityPanel.hideAccessoryViews();
if (view instanceof FilterIconButton) {
+ mCurrentEditor = null;
FilterIconButton component = (FilterIconButton) view;
ImageFilter filter = component.getImageFilter();
if (filter.getEditingViewId() != 0) {
- mCurrentImage = showImageView(filter.getEditingViewId());
+ if (mEditorPlaceHolder.contains(filter.getEditingViewId())) {
+ mCurrentEditor = mEditorPlaceHolder.showEditor(filter.getEditingViewId());
+ mCurrentImage = mCurrentEditor.getImageShow();
+ mCurrentEditor.setPanelController(this);
+ } else {
+ mCurrentImage = showImageView(filter.getEditingViewId());
+ }
mCurrentImage.setShowControls(filter.showEditingControls());
String ename = mCurrentImage.getContext().getString(filter.getTextId());
mUtilityPanel.setEffectName(ename);
- if (mCurrentImage.useUtilityPanel()) {
- mCurrentImage.openUtilityPanel(mUtilityPanel.mAccessoryViewList);
- }
+
mUtilityPanel.setShowParameter(filter.showParameterValue());
mMasterImage.setCurrentFilter(filter);
mCurrentImage.select();
+ if (mCurrentEditor != null) {
+ mCurrentEditor.reflectCurrentFilter();
+ if (mCurrentEditor.useUtilityPanel()) {
+ mCurrentEditor.openUtilityPanel(mUtilityPanel.mAccessoryViewList);
+ }
+ } else if (mCurrentImage.useUtilityPanel()) {
+ mCurrentImage.openUtilityPanel(mUtilityPanel.mAccessoryViewList);
+ }
}
return;
}
@@ -535,9 +559,19 @@ public class PanelController implements OnClickListener {
break;
}
}
- if (mCurrentImage.useUtilityPanel()) {
+ mCurrentImage.select();
+ if (mCurrentEditor != null) {
+ mCurrentEditor.reflectCurrentFilter();
+ if (mCurrentEditor.useUtilityPanel()) {
+ mCurrentEditor.openUtilityPanel(mUtilityPanel.mAccessoryViewList);
+ }
+ } else if (mCurrentImage.useUtilityPanel()) {
mCurrentImage.openUtilityPanel(mUtilityPanel.mAccessoryViewList);
}
- mCurrentImage.select();
+
+ }
+
+ public void setEditorPlaceHolder(EditorPlaceHolder editorPlaceHolder) {
+ mEditorPlaceHolder = editorPlaceHolder;
}
}
diff --git a/src/com/android/gallery3d/filtershow/editors/BasicEditor.java b/src/com/android/gallery3d/filtershow/editors/BasicEditor.java
new file mode 100644
index 000000000..c28a56438
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/editors/BasicEditor.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gallery3d.filtershow.editors;
+
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.filters.ImageFilter;
+
+import android.content.Context;
+import android.util.Log;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.SeekBar;
+import android.widget.SeekBar.OnSeekBarChangeListener;
+
+/**
+ * The basic editor that all the one parameter filters
+ */
+public class BasicEditor extends Editor implements OnSeekBarChangeListener {
+ public static int ID = R.id.basicEditor;
+ private SeekBar mSeekBar;
+ private final String LOGTAG = "Editor";
+
+ public BasicEditor() {
+ super(ID);
+ }
+
+ @Override
+ public void createEditor(Context context, FrameLayout frameLayout) {
+ super.createEditor(context, frameLayout);
+ unpack(R.id.basicEditor, R.layout.filtershow_default_editor);
+ mSeekBar = (SeekBar) mView.findViewById(R.id.filterSeekBar);
+ mSeekBar.setOnSeekBarChangeListener(this);
+ }
+
+ @Override
+ public void reflectCurrentFilter() {
+ ImageFilter filter = mImageShow.getCurrentFilter();
+ if (filter == null) {
+ return;
+ }
+ boolean f = filter.showParameterValue();
+ mSeekBar.setVisibility((f) ? View.VISIBLE : View.INVISIBLE);
+ int parameter = filter.getParameter();
+ int maxp = filter.getMaxParameter();
+ int minp = filter.getMinParameter();
+ mSeekBar.setMax(maxp - minp);
+ mSeekBar.setProgress(parameter - minp);
+ }
+
+ @Override
+ public void onProgressChanged(SeekBar sbar, int progress, boolean arg2) {
+ ImageFilter filter = mImageShow.getCurrentFilter();
+ int minp = filter.getMinParameter();
+ int value = progress + minp;
+ mImageShow.onNewValue(value);
+ mView.invalidate();
+ if (filter.showParameterValue()) {
+ mPanelController.onNewValue(value);
+ }
+
+ Log.v(LOGTAG, " #### progress=" + value);
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar arg0) {
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar arg0) {
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/editors/Editor.java b/src/com/android/gallery3d/filtershow/editors/Editor.java
new file mode 100644
index 000000000..a9b2fd425
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/editors/Editor.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gallery3d.filtershow.editors;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+import com.android.gallery3d.filtershow.PanelController;
+import com.android.gallery3d.filtershow.cache.ImageLoader;
+import com.android.gallery3d.filtershow.imageshow.ImageShow;
+
+/**
+ * Base class for Editors Must contain a mImageShow and a top level view
+ */
+public class Editor {
+ protected Context mContext;
+ protected View mView;
+ protected ImageShow mImageShow;
+ protected FrameLayout mFrameLayout;
+ protected PanelController mPanelController;
+ protected int mID;
+ private final String LOGTAG = "Editor";
+
+ public void setPanelController(PanelController panelController) {
+ this.mPanelController = panelController;
+ }
+
+ protected Editor(int id) {
+ mID = id;
+ }
+ public int getID() {
+ return mID;
+ }
+
+ public void createEditor(Context context,FrameLayout frameLayout) {
+ mContext = context;
+ mFrameLayout = frameLayout;
+ }
+
+ protected void unpack(int viewid, int layoutid) {
+
+ if (mView == null) {
+ mView = mFrameLayout.findViewById(viewid);
+ if (mView == null) {
+ LayoutInflater inflater = (LayoutInflater) mContext.getSystemService
+ (Context.LAYOUT_INFLATER_SERVICE);
+ mView = inflater.inflate(layoutid, mFrameLayout, false);
+ mFrameLayout.addView(mView, mView.getLayoutParams());
+ }
+ }
+ mImageShow = findImageShow(mView);
+ }
+
+ private ImageShow findImageShow(View view) {
+ if (view instanceof ImageShow) {
+ return (ImageShow) view;
+ }
+ if (!(view instanceof ViewGroup)) {
+ return null;
+ }
+ ViewGroup vg = (ViewGroup) view;
+ int n = vg.getChildCount();
+ for (int i = 0; i < n; i++) {
+ View v = vg.getChildAt(i);
+ if (v instanceof ImageShow) {
+ return (ImageShow) v;
+ } else if (v instanceof ViewGroup) {
+ return findImageShow(v);
+ }
+ }
+ return null;
+ }
+
+ public View getTopLevelView() {
+ return mView;
+ }
+
+ public ImageShow getImageShow() {
+ return mImageShow;
+ }
+
+ public void setImageLoader(ImageLoader imageLoader) {
+ mImageShow.setImageLoader(imageLoader);
+ }
+
+ public void setVisibility(int visible) {
+ mView.setVisibility(visible);
+ }
+
+ /**
+ * called after the filter is set and the select is called
+ */
+ public void reflectCurrentFilter() {
+ }
+
+ public boolean useUtilityPanel() {
+ if (mImageShow != null) {
+ return mImageShow.useUtilityPanel();
+ }
+ return false;
+ }
+
+ public void openUtilityPanel(LinearLayout mAccessoryViewList) {
+ if (mImageShow != null) {
+ mImageShow.openUtilityPanel(mAccessoryViewList);
+ }
+ }
+
+}
diff --git a/src/com/android/gallery3d/filtershow/editors/EditorCurves.java b/src/com/android/gallery3d/filtershow/editors/EditorCurves.java
new file mode 100644
index 000000000..a3360483a
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/editors/EditorCurves.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gallery3d.filtershow.editors;
+
+import android.content.Context;
+import android.widget.FrameLayout;
+
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.ui.ImageCurves;
+
+public class EditorCurves extends Editor {
+ public static final int ID = R.id.imageCurves;
+
+ public EditorCurves() {
+ super(ID);
+ }
+
+ @Override
+ public void createEditor(Context context, FrameLayout frameLayout) {
+ super.createEditor(context, frameLayout);
+ mView = mImageShow = new ImageCurves(context);
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/editors/EditorZoom.java b/src/com/android/gallery3d/filtershow/editors/EditorZoom.java
new file mode 100644
index 000000000..b8642457d
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/editors/EditorZoom.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gallery3d.filtershow.editors;
+
+import android.content.Context;
+import android.widget.FrameLayout;
+
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.imageshow.ImageZoom;
+
+public class EditorZoom extends Editor {
+ public static final int ID = R.id.imageZoom;
+
+ public EditorZoom() {
+ super(ID);
+ }
+
+ @Override
+ public void createEditor(Context context, FrameLayout frameLayout) {
+ super.createEditor(context, frameLayout);
+ mView = mImageShow = new ImageZoom(context);
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java
index 46e159aea..db74cc8bc 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java
@@ -19,6 +19,7 @@ package com.android.gallery3d.filtershow.filters;
import android.graphics.Bitmap;
import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.editors.BasicEditor;
import com.android.gallery3d.filtershow.presets.ImagePreset;
public class ImageFilter implements Cloneable {
@@ -65,7 +66,7 @@ public class ImageFilter implements Cloneable {
}
public int getEditingViewId() {
- return R.id.imageShow;
+ return BasicEditor.ID;
}
public boolean showEditingControls() {
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java
index e2ea388dc..6b9869be3 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java
@@ -17,6 +17,7 @@
package com.android.gallery3d.filtershow.filters;
import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.editors.BasicEditor;
import android.graphics.Bitmap;
@@ -41,6 +42,11 @@ public class ImageFilterHue extends ImageFilter {
}
@Override
+ public int getEditingViewId() {
+ return BasicEditor.ID;
+ }
+
+ @Override
public ImageFilter clone() throws CloneNotSupportedException {
ImageFilterHue filter = (ImageFilterHue) super.clone();
filter.cmatrix = new ColorSpaceMatrix(cmatrix);
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageDraw.java b/src/com/android/gallery3d/filtershow/imageshow/ImageDraw.java
index cca06e4d7..16c2422c2 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/ImageDraw.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/ImageDraw.java
@@ -46,7 +46,6 @@ public class ImageDraw extends ImageShow {
float[] mTmpPoint = new float[2]; // so we do not malloc
@Override
public boolean onTouchEvent(MotionEvent event) {
- super.onTouchEvent(event);
if (event.getPointerCount() != 1) {
return false;
}
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java b/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java
index 55bdb6e8e..3d22e05ef 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java
@@ -26,6 +26,7 @@ import android.graphics.RectF;
import android.net.Uri;
import android.os.Handler;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.GestureDetector;
import android.view.GestureDetector.OnDoubleTapListener;
import android.view.GestureDetector.OnGestureListener;
diff --git a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
index 5dc7b172d..98bef52c7 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
@@ -181,12 +181,10 @@ public class MasterImage {
return;
}
- // FIXME getImageForPreset caller
Bitmap bitmap = mLoader.getImageForPreset(null, mPreset, true);
if (bitmap != null) {
mFilteredImage = bitmap;
- notifyObservers();
}
updatePresets(false);
if (mGeometryOnlyPreset != null) {
diff --git a/src_pd/com/android/gallery3d/filtershow/editors/EditorManager.java b/src_pd/com/android/gallery3d/filtershow/editors/EditorManager.java
new file mode 100644
index 000000000..0c73183b2
--- /dev/null
+++ b/src_pd/com/android/gallery3d/filtershow/editors/EditorManager.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gallery3d.filtershow.editors;
+
+import com.android.gallery3d.filtershow.EditorPlaceHolder;
+import com.android.gallery3d.filtershow.editors.BasicEditor;
+import com.android.gallery3d.filtershow.editors.EditorCurves;
+import com.android.gallery3d.filtershow.editors.EditorZoom;
+
+public class EditorManager {
+
+ public static void addEditors(EditorPlaceHolder editorPlaceHolder) {
+ editorPlaceHolder.addEditor(new EditorZoom());
+ editorPlaceHolder.addEditor(new EditorCurves());
+ editorPlaceHolder.addEditor(new BasicEditor());
+ }
+
+}