1/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
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
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17package com.android.rs.image2;
18
19import android.app.Activity;
20import android.content.Context;
21import android.support.v8.renderscript.*;
22import android.widget.ImageView;
23import android.widget.SeekBar;
24import android.widget.TextView;
25import android.view.View;
26import android.util.Log;
27import android.widget.Spinner;
28
29public class TestBase  {
30    protected final String TAG = "Img";
31
32    protected RenderScript mRS;
33    protected Allocation mInPixelsAllocation;
34    protected Allocation mInPixelsAllocation2;
35    protected Allocation mOutPixelsAllocation;
36    protected ImageProcessingActivity2 act;
37
38    // Override to use UI elements
39    public void onBar1Changed(int progress) {
40    }
41    public void onBar2Changed(int progress) {
42    }
43    public void onBar3Changed(int progress) {
44    }
45    public void onBar4Changed(int progress) {
46    }
47    public void onBar5Changed(int progress) {
48    }
49
50    // Override to use UI elements
51    // Unused bars will be hidden.
52    public boolean onBar1Setup(SeekBar b, TextView t) {
53        b.setVisibility(View.INVISIBLE);
54        t.setVisibility(View.INVISIBLE);
55        return false;
56    }
57    public boolean onBar2Setup(SeekBar b, TextView t) {
58        b.setVisibility(View.INVISIBLE);
59        t.setVisibility(View.INVISIBLE);
60        return false;
61    }
62    public boolean onBar3Setup(SeekBar b, TextView t) {
63        b.setVisibility(View.INVISIBLE);
64        t.setVisibility(View.INVISIBLE);
65        return false;
66    }
67    public boolean onBar4Setup(SeekBar b, TextView t) {
68        b.setVisibility(View.INVISIBLE);
69        t.setVisibility(View.INVISIBLE);
70        return false;
71    }
72    public boolean onBar5Setup(SeekBar b, TextView t) {
73        b.setVisibility(View.INVISIBLE);
74        t.setVisibility(View.INVISIBLE);
75        return false;
76    }
77
78    public void animateBars(float time) {
79    }
80
81    public boolean onSpinner1Setup(Spinner s) {
82        s.setVisibility(View.INVISIBLE);
83        return false;
84    }
85
86    public final void createBaseTest(ImageProcessingActivity2 ipact) {
87        act = ipact;
88        mRS = ipact.mProcessor.mRS;
89
90        mInPixelsAllocation = ipact.mProcessor.mInPixelsAllocation;
91        mInPixelsAllocation2 = ipact.mProcessor.mInPixelsAllocation2;
92        if (ipact.mProcessor.mOutDisplayAllocation1 == null) {
93            mOutPixelsAllocation = ipact.mProcessor.mOutDisplayAllocationIO;
94        } else {
95            mOutPixelsAllocation = ipact.mProcessor.mOutDisplayAllocation1;
96        }
97
98        createTest(act.getResources());
99    }
100
101    // Must override
102    public void createTest(android.content.res.Resources res) {
103    }
104
105    // Must override
106    public void runTest() {
107    }
108
109    public void destroy() {
110    }
111}
112