summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/controller
diff options
context:
space:
mode:
authorJohn Hoford <hoford@google.com>2013-08-05 15:07:14 -0700
committerJohn Hoford <hoford@google.com>2013-08-09 17:21:22 -0700
commitf4b659334750a5aa75f929d18857a2ab93c9d939 (patch)
treefe4a4e7827129a79e694282a1506b9979ef1c712 /src/com/android/gallery3d/filtershow/controller
parent8c3d2b9ab605cb8e5e883932147b8a378748ef32 (diff)
downloadandroid_packages_apps_Gallery2-f4b659334750a5aa75f929d18857a2ab93c9d939.tar.gz
android_packages_apps_Gallery2-f4b659334750a5aa75f929d18857a2ab93c9d939.tar.bz2
android_packages_apps_Gallery2-f4b659334750a5aa75f929d18857a2ab93c9d939.zip
fix draw
Change-Id: I535221edd992c1a8c659c398dba61158e0c1d87d
Diffstat (limited to 'src/com/android/gallery3d/filtershow/controller')
-rw-r--r--src/com/android/gallery3d/filtershow/controller/BasicParameterStyle.java2
-rw-r--r--src/com/android/gallery3d/filtershow/controller/BitmapCaller.java23
-rw-r--r--src/com/android/gallery3d/filtershow/controller/FilterView.java2
-rw-r--r--src/com/android/gallery3d/filtershow/controller/ParameterBrightness.java40
-rw-r--r--src/com/android/gallery3d/filtershow/controller/ParameterHue.java40
-rw-r--r--src/com/android/gallery3d/filtershow/controller/ParameterIconStyle.java33
-rw-r--r--src/com/android/gallery3d/filtershow/controller/ParameterOpacity.java39
-rw-r--r--src/com/android/gallery3d/filtershow/controller/ParameterSaturation.java40
-rw-r--r--src/com/android/gallery3d/filtershow/controller/ParameterStyles.java2
-rw-r--r--src/com/android/gallery3d/filtershow/controller/SliderBrightness.java75
-rw-r--r--src/com/android/gallery3d/filtershow/controller/SliderHue.java86
-rw-r--r--src/com/android/gallery3d/filtershow/controller/SliderOpacity.java76
-rw-r--r--src/com/android/gallery3d/filtershow/controller/SliderSaturation.java77
-rw-r--r--src/com/android/gallery3d/filtershow/controller/StyleChooser.java6
14 files changed, 535 insertions, 6 deletions
diff --git a/src/com/android/gallery3d/filtershow/controller/BasicParameterStyle.java b/src/com/android/gallery3d/filtershow/controller/BasicParameterStyle.java
index fb9f95e97..498dcc698 100644
--- a/src/com/android/gallery3d/filtershow/controller/BasicParameterStyle.java
+++ b/src/com/android/gallery3d/filtershow/controller/BasicParameterStyle.java
@@ -90,7 +90,7 @@ public class BasicParameterStyle implements ParameterStyles {
}
@Override
- public void getIcon(int index, RenderingRequestCaller caller) {
+ public void getIcon(int index, BitmapCaller caller) {
mEditor.computeIcon(index, caller);
}
diff --git a/src/com/android/gallery3d/filtershow/controller/BitmapCaller.java b/src/com/android/gallery3d/filtershow/controller/BitmapCaller.java
new file mode 100644
index 000000000..e06c7e21a
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/BitmapCaller.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;
+
+import android.graphics.Bitmap;
+
+public interface BitmapCaller {
+ public void available(Bitmap bmap);
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/FilterView.java b/src/com/android/gallery3d/filtershow/controller/FilterView.java
index 9ca81dc35..9ca0e604c 100644
--- a/src/com/android/gallery3d/filtershow/controller/FilterView.java
+++ b/src/com/android/gallery3d/filtershow/controller/FilterView.java
@@ -19,7 +19,7 @@ package com.android.gallery3d.filtershow.controller;
import com.android.gallery3d.filtershow.pipeline.RenderingRequestCaller;
public interface FilterView {
- public void computeIcon(int index, RenderingRequestCaller caller);
+ public void computeIcon(int index, BitmapCaller caller);
public void commitLocalRepresentation();
}
diff --git a/src/com/android/gallery3d/filtershow/controller/ParameterBrightness.java b/src/com/android/gallery3d/filtershow/controller/ParameterBrightness.java
new file mode 100644
index 000000000..669df93c9
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/ParameterBrightness.java
@@ -0,0 +1,40 @@
+/*
+ * 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 class ParameterBrightness extends BasicParameterInt {
+ public static String sParameterType = "ParameterBrightness";
+ float[] mHSVO = new float[4];
+
+ public ParameterBrightness(int id, int value) {
+ super(id, value, 0, 255);
+ }
+
+ @Override
+ public String getParameterType() {
+ return sParameterType;
+ }
+
+ public void setColor(float[] hsvo) {
+ mHSVO = hsvo;
+ }
+
+ public float[] getColor() {
+ mHSVO[3] = getValue() / (float) getMaximum();
+ return mHSVO;
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/ParameterHue.java b/src/com/android/gallery3d/filtershow/controller/ParameterHue.java
new file mode 100644
index 000000000..7682ec9d5
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/ParameterHue.java
@@ -0,0 +1,40 @@
+/*
+ * 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 class ParameterHue extends BasicParameterInt {
+ public static String sParameterType = "ParameterHue";
+ float[] mHSVO = new float[4];
+
+ public ParameterHue(int id, int value) {
+ super(id, value, 0, 360);
+ }
+
+ @Override
+ public String getParameterType() {
+ return sParameterType;
+ }
+
+ public void setColor(float[] hsvo) {
+ mHSVO = hsvo;
+ }
+
+ public float[] getColor() {
+ mHSVO[3] = getValue() / (float) getMaximum();
+ return mHSVO;
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/ParameterIconStyle.java b/src/com/android/gallery3d/filtershow/controller/ParameterIconStyle.java
new file mode 100644
index 000000000..a26ee65b0
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/ParameterIconStyle.java
@@ -0,0 +1,33 @@
+/*
+ * 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.graphics.Bitmap;
+
+public class ParameterIconStyle extends BasicParameterStyle {
+ Bitmap[] mBitmaps;
+
+ public ParameterIconStyle(int id, Bitmap[] styles) {
+ super(id, styles.length);
+ mBitmaps = styles;
+ }
+
+ @Override
+ public void getIcon(int index, BitmapCaller caller) {
+ caller.available(mBitmaps[index]);
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/ParameterOpacity.java b/src/com/android/gallery3d/filtershow/controller/ParameterOpacity.java
new file mode 100644
index 000000000..aecbf4aa4
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/ParameterOpacity.java
@@ -0,0 +1,39 @@
+/*
+ * 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 class ParameterOpacity extends BasicParameterInt {
+ public static String sParameterType = "ParameterOpacity";
+ float[] mHSVO = new float[4];
+
+ public ParameterOpacity(int id, int value) {
+ super(id, value, 0, 255);
+ }
+
+ @Override
+ public String getParameterType() {
+ return sParameterType;
+ }
+
+ public void setColor(float[] hsvo) {
+ mHSVO = hsvo;
+ }
+
+ public float[] getColor() {
+ mHSVO[3] = getValue() / (float) getMaximum();
+ return mHSVO;
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/ParameterSaturation.java b/src/com/android/gallery3d/filtershow/controller/ParameterSaturation.java
new file mode 100644
index 000000000..a6a4cb148
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/ParameterSaturation.java
@@ -0,0 +1,40 @@
+/*
+ * 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 class ParameterSaturation extends BasicParameterInt {
+ public static String sParameterType = "ParameterSaturation";
+ float[] mHSVO = new float[4];
+
+ public ParameterSaturation(int id, int value) {
+ super(id, value, 0, 100);
+ }
+
+ @Override
+ public String getParameterType() {
+ return sParameterType;
+ }
+
+ public void setColor(float[] hsvo) {
+ mHSVO = hsvo;
+ }
+
+ public float[] getColor() {
+ mHSVO[3] = getValue() / (float) getMaximum();
+ return mHSVO;
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/ParameterStyles.java b/src/com/android/gallery3d/filtershow/controller/ParameterStyles.java
index 7d250a0bf..91d5a0005 100644
--- a/src/com/android/gallery3d/filtershow/controller/ParameterStyles.java
+++ b/src/com/android/gallery3d/filtershow/controller/ParameterStyles.java
@@ -31,7 +31,7 @@ public interface ParameterStyles extends Parameter {
void setSelected(int value);
- void getIcon(int index, RenderingRequestCaller caller);
+ void getIcon(int index, BitmapCaller caller);
String getStyleTitle(int index, Context context);
}
diff --git a/src/com/android/gallery3d/filtershow/controller/SliderBrightness.java b/src/com/android/gallery3d/filtershow/controller/SliderBrightness.java
new file mode 100644
index 000000000..6dc86882d
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/SliderBrightness.java
@@ -0,0 +1,75 @@
+/*
+ * 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.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.LinearLayout;
+
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.colorpicker.ColorBrightnessView;
+import com.android.gallery3d.filtershow.colorpicker.ColorListener;
+import com.android.gallery3d.filtershow.colorpicker.ColorOpacityView;
+import com.android.gallery3d.filtershow.editors.Editor;
+
+public class SliderBrightness implements Control {
+ private ColorBrightnessView mColorOpacityView;
+ private ParameterBrightness mParameter;
+ Editor mEditor;
+
+ @Override
+ public void setUp(ViewGroup container, Parameter parameter, Editor editor) {
+ container.removeAllViews();
+ mEditor = editor;
+ Context context = container.getContext();
+ mParameter = (ParameterBrightness) parameter;
+ LayoutInflater inflater =
+ (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ LinearLayout lp = (LinearLayout) inflater.inflate(
+ R.layout.filtershow_brightness, container, true);
+
+ mColorOpacityView = (ColorBrightnessView) lp.findViewById(R.id.brightnessView);
+ updateUI();
+ mColorOpacityView.addColorListener(new ColorListener() {
+ @Override
+ public void setColor(float[] hsvo) {
+ mParameter.setValue((int)(255* hsvo[3]));
+ mEditor.commitLocalRepresentation();
+ }
+ });
+ }
+
+ @Override
+ public View getTopView() {
+ return mColorOpacityView;
+ }
+
+ @Override
+ public void setPrameter(Parameter parameter) {
+ mParameter = (ParameterBrightness) parameter;
+ if (mColorOpacityView != null) {
+ updateUI();
+ }
+ }
+
+ @Override
+ public void updateUI() {
+ mColorOpacityView.setColor(mParameter.getColor());
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/SliderHue.java b/src/com/android/gallery3d/filtershow/controller/SliderHue.java
new file mode 100644
index 000000000..a550afd79
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/SliderHue.java
@@ -0,0 +1,86 @@
+/*
+ * 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.graphics.Canvas;
+import android.graphics.ColorFilter;
+import android.graphics.LinearGradient;
+import android.graphics.Paint;
+import android.graphics.RectF;
+import android.graphics.Shader;
+import android.graphics.drawable.Drawable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.LinearLayout;
+import android.widget.SeekBar;
+import android.widget.SeekBar.OnSeekBarChangeListener;
+
+import com.android.gallery3d.R;
+import com.android.gallery3d.app.Log;
+import com.android.gallery3d.filtershow.colorpicker.ColorHueView;
+import com.android.gallery3d.filtershow.colorpicker.ColorListener;
+import com.android.gallery3d.filtershow.colorpicker.ColorOpacityView;
+import com.android.gallery3d.filtershow.editors.Editor;
+
+public class SliderHue implements Control {
+ public static String LOGTAG = "SliderHue";
+ private ColorHueView mColorOpacityView;
+ private ParameterHue mParameter;
+ Editor mEditor;
+
+ @Override
+ public void setUp(ViewGroup container, Parameter parameter, Editor editor) {
+ container.removeAllViews();
+ mEditor = editor;
+ Context context = container.getContext();
+ mParameter = (ParameterHue) parameter;
+ LayoutInflater inflater =
+ (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ LinearLayout lp = (LinearLayout) inflater.inflate(
+ R.layout.filtershow_hue, container, true);
+
+ mColorOpacityView = (ColorHueView) lp.findViewById(R.id.hueView);
+ updateUI();
+ mColorOpacityView.addColorListener(new ColorListener() {
+ @Override
+ public void setColor(float[] hsvo) {
+ mParameter.setValue((int)(360* hsvo[3]));
+ mEditor.commitLocalRepresentation();
+ }
+ });
+ }
+
+ @Override
+ public View getTopView() {
+ return mColorOpacityView;
+ }
+
+ @Override
+ public void setPrameter(Parameter parameter) {
+ mParameter = (ParameterHue) parameter;
+ if (mColorOpacityView != null) {
+ updateUI();
+ }
+ }
+
+ @Override
+ public void updateUI() {
+ mColorOpacityView.setColor(mParameter.getColor());
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/SliderOpacity.java b/src/com/android/gallery3d/filtershow/controller/SliderOpacity.java
new file mode 100644
index 000000000..cd21e9b76
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/SliderOpacity.java
@@ -0,0 +1,76 @@
+/*
+ * 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.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.LinearLayout;
+import android.widget.SeekBar;
+import android.widget.SeekBar.OnSeekBarChangeListener;
+
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.colorpicker.ColorListener;
+import com.android.gallery3d.filtershow.colorpicker.ColorOpacityView;
+import com.android.gallery3d.filtershow.editors.Editor;
+
+public class SliderOpacity implements Control {
+ private ColorOpacityView mColorOpacityView;
+ private ParameterOpacity mParameter;
+ private Editor mEditor;
+
+ @Override
+ public void setUp(ViewGroup container, Parameter parameter, Editor editor) {
+ container.removeAllViews();
+ mEditor = editor;
+ Context context = container.getContext();
+ mParameter = (ParameterOpacity) parameter;
+ LayoutInflater inflater =
+ (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ LinearLayout lp = (LinearLayout) inflater.inflate(
+ R.layout.filtershow_opacity, container, true);
+
+ mColorOpacityView = (ColorOpacityView) lp.findViewById(R.id.opacityView);
+ updateUI();
+ mColorOpacityView.addColorListener(new ColorListener() {
+ @Override
+ public void setColor(float[] hsvo) {
+ mParameter.setValue((int) (255 * hsvo[3]));
+ mEditor.commitLocalRepresentation();
+ }
+ });
+ }
+
+ @Override
+ public View getTopView() {
+ return mColorOpacityView;
+ }
+
+ @Override
+ public void setPrameter(Parameter parameter) {
+ mParameter = (ParameterOpacity) parameter;
+ if (mColorOpacityView != null) {
+ updateUI();
+ }
+ }
+
+ @Override
+ public void updateUI() {
+ mColorOpacityView.setColor(mParameter.getColor());
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/SliderSaturation.java b/src/com/android/gallery3d/filtershow/controller/SliderSaturation.java
new file mode 100644
index 000000000..1f2b3fbd8
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/controller/SliderSaturation.java
@@ -0,0 +1,77 @@
+/*
+ * 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.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.LinearLayout;
+import android.widget.SeekBar;
+import android.widget.SeekBar.OnSeekBarChangeListener;
+
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.colorpicker.ColorListener;
+import com.android.gallery3d.filtershow.colorpicker.ColorOpacityView;
+import com.android.gallery3d.filtershow.colorpicker.ColorSaturationView;
+import com.android.gallery3d.filtershow.editors.Editor;
+
+public class SliderSaturation implements Control {
+ private ColorSaturationView mColorOpacityView;
+ private ParameterSaturation mParameter;
+ private Editor mEditor;
+
+ @Override
+ public void setUp(ViewGroup container, Parameter parameter, Editor editor) {
+ container.removeAllViews();
+ mEditor = editor;
+ Context context = container.getContext();
+ mParameter = (ParameterSaturation) parameter;
+ LayoutInflater inflater =
+ (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ LinearLayout lp = (LinearLayout) inflater.inflate(
+ R.layout.filtershow_saturation, container, true);
+
+ mColorOpacityView = (ColorSaturationView) lp.findViewById(R.id.saturationView);
+ updateUI();
+ mColorOpacityView.addColorListener(new ColorListener() {
+ @Override
+ public void setColor(float[] hsvo) {
+ mParameter.setValue((int) (255 * hsvo[3]));
+ mEditor.commitLocalRepresentation();
+ }
+ });
+ }
+
+ @Override
+ public View getTopView() {
+ return mColorOpacityView;
+ }
+
+ @Override
+ public void setPrameter(Parameter parameter) {
+ mParameter = (ParameterSaturation) parameter;
+ if (mColorOpacityView != null) {
+ updateUI();
+ }
+ }
+
+ @Override
+ public void updateUI() {
+ mColorOpacityView.setColor(mParameter.getColor());
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/controller/StyleChooser.java b/src/com/android/gallery3d/filtershow/controller/StyleChooser.java
index fb613abc7..97a47dd98 100644
--- a/src/com/android/gallery3d/filtershow/controller/StyleChooser.java
+++ b/src/com/android/gallery3d/filtershow/controller/StyleChooser.java
@@ -54,10 +54,10 @@ public class StyleChooser implements Control {
}
});
mLinearLayout.addView(button);
- mParameter.getIcon(i, new RenderingRequestCaller() {
+ mParameter.getIcon(i, new BitmapCaller() {
@Override
- public void available(RenderingRequest request) {
- Bitmap bmap = request.getBitmap();
+ public void available(Bitmap bmap) {
+
if (bmap == null) {
return;
}