RSTest_v11.java revision 41f1e5edee2d2663ae46b64528894896ff96fa3d
1/* 2 * Copyright (C) 2008 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.test_v11; 18 19import android.renderscript.RSSurfaceView; 20import android.renderscript.RenderScript; 21 22import android.app.Activity; 23import android.content.res.Configuration; 24import android.os.Bundle; 25import android.os.Handler; 26import android.os.Looper; 27import android.os.Message; 28import android.provider.Settings.System; 29import android.util.Config; 30import android.util.Log; 31import android.view.Menu; 32import android.view.MenuItem; 33import android.view.View; 34import android.view.Window; 35import android.widget.Button; 36import android.widget.ListView; 37 38import java.lang.Runtime; 39 40public class RSTest_v11 extends Activity { 41 //EventListener mListener = new EventListener(); 42 43 private static final String LOG_TAG = "libRS_jni"; 44 private static final boolean DEBUG = false; 45 private static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV; 46 47 private RSTestView mView; 48 49 // get the current looper (from your Activity UI thread for instance 50 51 @Override 52 public void onCreate(Bundle icicle) { 53 super.onCreate(icicle); 54 55 // Create our Preview view and set it as the content of our 56 // Activity 57 mView = new RSTestView(this); 58 setContentView(mView); 59 } 60 61 @Override 62 protected void onResume() { 63 // Ideally a game should implement onResume() and onPause() 64 // to take appropriate action when the activity loses focus 65 super.onResume(); 66 mView.resume(); 67 } 68 69 @Override 70 protected void onPause() { 71 // Ideally a game should implement onResume() and onPause() 72 // to take appropriate action when the activity loses focus 73 super.onPause(); 74 mView.pause(); 75 } 76 77 static void log(String message) { 78 if (LOG_ENABLED) { 79 Log.v(LOG_TAG, message); 80 } 81 } 82 83 84} 85