2 * Copyright (C) 2013 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.gallery3d.filtershow.controller;
19 import android.content.Context;
20 import android.util.Log;
22 import com.android.gallery3d.filtershow.cache.RenderingRequestCaller;
24 public class BasicParameterStyle implements ParameterStyles {
25 protected String mParameterName;
26 protected int mSelectedStyle;
27 protected int mNumberOfStyles;
28 protected int mDefaultStyle = 0;
29 protected Control mControl;
30 protected FilterView mEditor;
32 private final String LOGTAG = "BasicParameterStyle";
35 public void copyFrom(Parameter src) {
36 if (!(src instanceof BasicParameterStyle)) {
37 throw new IllegalArgumentException(src.getClass().getName());
39 BasicParameterStyle p = (BasicParameterStyle) src;
40 mNumberOfStyles = p.mNumberOfStyles;
41 mSelectedStyle = p.mSelectedStyle;
42 mDefaultStyle = p.mDefaultStyle;
45 public BasicParameterStyle(int id, int numberOfStyles) {
47 mNumberOfStyles = numberOfStyles;
51 public String getParameterName() {
52 return mParameterName;
56 public String getParameterType() {
57 return sParameterType;
61 public String getValueString() {
62 return mParameterName + mSelectedStyle;
66 public void setController(Control control) {
71 public int getNumberOfStyles() {
72 return mNumberOfStyles;
76 public int getDefaultSelected() {
81 public int getSelected() {
82 return mSelectedStyle;
86 public void setSelected(int selectedStyle) {
87 mSelectedStyle = selectedStyle;
88 if (mEditor != null) {
89 mEditor.commitLocalRepresentation();
94 public void getIcon(int index, RenderingRequestCaller caller) {
95 mEditor.computeIcon(index, caller);
99 public String getStyleTitle(int index, Context context) {
104 public String toString() {
105 return getValueString();
109 public void setFilterView(FilterView editor) {