From a5e47821f783cc14ba0ec3d3910af79dab3a870c Mon Sep 17 00:00:00 2001 From: John Hoford Date: Mon, 8 Apr 2013 19:32:45 -0700 Subject: make basic editor based on ParametricEditor Change-Id: Ie0a799d7e85f4e21fdd86ffbdca9814a3cc40c61 --- .../filtershow/controller/BasicSlider.java | 1 + .../filtershow/controller/ParameterStyles.java | 37 +++++++ .../filtershow/controller/StyleChooser.java | 102 ++++++++++++++++++ .../filtershow/controller/TitledSlider.java | 1 + .../gallery3d/filtershow/editors/BasicEditor.java | 116 +++++++++++++-------- .../filtershow/editors/ParametricEditor.java | 29 ++++-- 6 files changed, 239 insertions(+), 47 deletions(-) create mode 100644 src/com/android/gallery3d/filtershow/controller/ParameterStyles.java create mode 100644 src/com/android/gallery3d/filtershow/controller/StyleChooser.java (limited to 'src/com') diff --git a/src/com/android/gallery3d/filtershow/controller/BasicSlider.java b/src/com/android/gallery3d/filtershow/controller/BasicSlider.java index c54fe77d8..df5b6ae73 100644 --- a/src/com/android/gallery3d/filtershow/controller/BasicSlider.java +++ b/src/com/android/gallery3d/filtershow/controller/BasicSlider.java @@ -34,6 +34,7 @@ public class BasicSlider implements Control { @Override public void setUp(ViewGroup container, Parameter parameter, Editor editor) { + container.removeAllViews(); mEditor = editor; Context context = container.getContext(); mParameter = (ParameterInteger) parameter; diff --git a/src/com/android/gallery3d/filtershow/controller/ParameterStyles.java b/src/com/android/gallery3d/filtershow/controller/ParameterStyles.java new file mode 100644 index 000000000..c267d3da3 --- /dev/null +++ b/src/com/android/gallery3d/filtershow/controller/ParameterStyles.java @@ -0,0 +1,37 @@ +/* + * 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 com.android.gallery3d.filtershow.cache.RenderingRequestCaller; + +public interface ParameterStyles extends Parameter { + public static String sParameterType = "ParameterStyles"; + + int getNumberOfStyles(); + + int getDefaultSelected(); + + int getSelected(); + + void setSelected(int value); + + void getIcon(int index, RenderingRequestCaller caller); + + String getStyleTitle(int index, Context context); +} diff --git a/src/com/android/gallery3d/filtershow/controller/StyleChooser.java b/src/com/android/gallery3d/filtershow/controller/StyleChooser.java new file mode 100644 index 000000000..201f6613e --- /dev/null +++ b/src/com/android/gallery3d/filtershow/controller/StyleChooser.java @@ -0,0 +1,102 @@ +package com.android.gallery3d.filtershow.controller; + +import android.content.Context; +import android.content.res.Resources; +import android.graphics.Bitmap; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.ScaleDrawable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; + +import com.android.gallery3d.R; +import com.android.gallery3d.filtershow.cache.RenderingRequest; +import com.android.gallery3d.filtershow.cache.RenderingRequestCaller; +import com.android.gallery3d.filtershow.editors.Editor; + +import java.util.Vector; + +public class StyleChooser implements Control, RenderingRequestCaller { + private final String LOGTAG = "StyleChooser"; + protected ParameterStyles mParameter; + protected LinearLayout mLinearLayout; + protected Editor mEditor; + private View mTopView; + private int mProcessingButton = 0; + private Vector