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