summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/controller
diff options
context:
space:
mode:
authorJohn Hoford <hoford@google.com>2013-04-10 14:58:05 -0700
committerJohn Hoford <hoford@google.com>2013-04-15 11:41:25 -0700
commitcb482deecb95a140b63d4bd43e2560fb9033df86 (patch)
treeebe309eea718401f07f988984798b1b12e327013 /src/com/android/gallery3d/filtershow/controller
parentd02932454e58d6858ec80d64932247f73dd0b19b (diff)
downloadandroid_packages_apps_Snap-cb482deecb95a140b63d4bd43e2560fb9033df86.tar.gz
android_packages_apps_Snap-cb482deecb95a140b63d4bd43e2560fb9033df86.tar.bz2
android_packages_apps_Snap-cb482deecb95a140b63d4bd43e2560fb9033df86.zip
support for simplified parameters in filter
Change-Id: I623e6fb90e8175c7e5e2dfc146f927eecba29817
Diffstat (limited to 'src/com/android/gallery3d/filtershow/controller')
-rw-r--r--src/com/android/gallery3d/filtershow/controller/BasicParameterInt.java105
-rw-r--r--src/com/android/gallery3d/filtershow/controller/BasicParameterStyle.java115
-rw-r--r--src/com/android/gallery3d/filtershow/controller/FilterView.java25
-rw-r--r--src/com/android/gallery3d/filtershow/controller/Parameter.java6
-rw-r--r--src/com/android/gallery3d/filtershow/controller/ParameterSet.java23
5 files changed, 274 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/filtershow/controller/BasicParameterInt.java b/src/com/android/gallery3d/filtershow/controller/BasicParameterInt.java
new file mode 100644
index 000000000..777bc4382
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/BasicParameterInt.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2013 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.controller;
+
+import android.util.Log;
+
+public class BasicParameterInt implements ParameterInteger {
+ protected String mParameterName;
+ protected Control mControl;
+ protected int mMaximum = 100;
+ protected int mMinimum = 0;
+ protected int mDefaultValue;
+ protected int mValue;
+ public final int ID;
+ protected FilterView mEditor;
+ private final String LOGTAG = "BasicParameterInt";
+
+ @Override
+ public void copyFrom(Parameter src) {
+ if (!(src instanceof BasicParameterInt)) {
+ throw new IllegalArgumentException(src.getClass().getName());
+ }
+ BasicParameterInt p = (BasicParameterInt) src;
+ mMaximum = p.mMaximum;
+ mMinimum = p.mMinimum;
+ mDefaultValue = p.mDefaultValue;
+ mValue = p.mValue;
+ }
+
+ public BasicParameterInt(int id, int value) {
+ ID = id;
+ mValue = value;
+ }
+ @Override
+ public String getParameterName() {
+ return mParameterName;
+ }
+
+ @Override
+ public String getParameterType() {
+ return sParameterType;
+ }
+
+ @Override
+ public String getValueString() {
+ return mParameterName + mValue;
+ }
+
+ @Override
+ public void setController(Control control) {
+ mControl = control;
+ }
+
+ @Override
+ public int getMaximum() {
+ return mMaximum;
+ }
+
+ @Override
+ public int getMinimum() {
+ return mMinimum;
+ }
+
+ @Override
+ public int getDefaultValue() {
+ return mDefaultValue;
+ }
+
+ @Override
+ public int getValue() {
+ return mValue;
+ }
+
+ @Override
+ public void setValue(int value) {
+ mValue = value;
+ if (mEditor != null) {
+ mEditor.commitLocalRepresentation();
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getValueString();
+ }
+
+ @Override
+ public void setFilterView(FilterView editor) {
+ mEditor = editor;
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/BasicParameterStyle.java b/src/com/android/gallery3d/filtershow/controller/BasicParameterStyle.java
new file mode 100644
index 000000000..633e41ff6
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/BasicParameterStyle.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2013 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.controller;
+
+import android.content.Context;
+import android.util.Log;
+
+import com.android.gallery3d.filtershow.cache.RenderingRequestCaller;
+
+public class BasicParameterStyle implements ParameterStyles {
+ protected String mParameterName;
+ protected int mSelectedStyle;
+ protected int mNumberOfStyles;
+ protected int mDefaultStyle = 0;
+ protected Control mControl;
+ protected FilterView mEditor;
+ public final int ID;
+ private final String LOGTAG = "BasicParameterStyle";
+
+ @Override
+ public void copyFrom(Parameter src) {
+ if (!(src instanceof BasicParameterStyle)) {
+ throw new IllegalArgumentException(src.getClass().getName());
+ }
+ BasicParameterStyle p = (BasicParameterStyle) src;
+ mNumberOfStyles = p.mNumberOfStyles;
+ mSelectedStyle = p.mSelectedStyle;
+ mDefaultStyle = p.mDefaultStyle;
+ }
+
+ public BasicParameterStyle(int id, int numberOfStyles) {
+ ID = id;
+ mNumberOfStyles = numberOfStyles;
+ }
+
+ @Override
+ public String getParameterName() {
+ return mParameterName;
+ }
+
+ @Override
+ public String getParameterType() {
+ return sParameterType;
+ }
+
+ @Override
+ public String getValueString() {
+ return mParameterName + mSelectedStyle;
+ }
+
+ @Override
+ public void setController(Control control) {
+ mControl = control;
+ }
+
+ @Override
+ public int getNumberOfStyles() {
+ return mNumberOfStyles;
+ }
+
+ @Override
+ public int getDefaultSelected() {
+ return mDefaultStyle;
+ }
+
+ @Override
+ public int getSelected() {
+ return mSelectedStyle;
+ }
+
+ @Override
+ public void setSelected(int selectedStyle) {
+ mSelectedStyle = selectedStyle;
+ if (mEditor != null) {
+ mEditor.commitLocalRepresentation();
+ }
+ }
+
+ @Override
+ public void getIcon(int index, RenderingRequestCaller caller) {
+ Log.v(LOGTAG, "############ " + ID + " getIcon " + index);
+
+ mEditor.computeIcon(index, caller);
+ }
+
+ @Override
+ public String getStyleTitle(int index, Context context) {
+ return "";
+ }
+
+ @Override
+ public String toString() {
+ return getValueString();
+ }
+
+ @Override
+ public void setFilterView(FilterView editor) {
+ mEditor = editor;
+ }
+
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/FilterView.java b/src/com/android/gallery3d/filtershow/controller/FilterView.java
new file mode 100644
index 000000000..2be7f36a9
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/FilterView.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2013 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.controller;
+
+import com.android.gallery3d.filtershow.cache.RenderingRequestCaller;
+
+public interface FilterView {
+ public void computeIcon(int index, RenderingRequestCaller caller);
+
+ public void commitLocalRepresentation();
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/Parameter.java b/src/com/android/gallery3d/filtershow/controller/Parameter.java
index 1e8694ab7..8f4d5c0a5 100644
--- a/src/com/android/gallery3d/filtershow/controller/Parameter.java
+++ b/src/com/android/gallery3d/filtershow/controller/Parameter.java
@@ -16,6 +16,8 @@
package com.android.gallery3d.filtershow.controller;
+import com.android.gallery3d.filtershow.editors.Editor;
+
public interface Parameter {
String getParameterName();
@@ -24,4 +26,8 @@ public interface Parameter {
String getValueString();
public void setController(Control c);
+
+ public void setFilterView(FilterView editor);
+
+ public void copyFrom(Parameter src);
}
diff --git a/src/com/android/gallery3d/filtershow/controller/ParameterSet.java b/src/com/android/gallery3d/filtershow/controller/ParameterSet.java
new file mode 100644
index 000000000..6b50a4d0b
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/ParameterSet.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2013 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.controller;
+
+public interface ParameterSet {
+ int getNumberOfParameters();
+
+ Parameter getFilterParameter(int index);
+}