Jason Sams | e5f2f66 | 2012-05-16 15:43:25 -0700 | [diff] [blame] | 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 | |
| 17 | package com.example.android.rs.fountain; |
| 18 | |
| 19 | import android.renderscript.RSSurfaceView; |
| 20 | import android.renderscript.RenderScript; |
| 21 | |
| 22 | import android.app.Activity; |
| 23 | import android.content.res.Configuration; |
| 24 | import android.os.Bundle; |
| 25 | import android.os.Handler; |
| 26 | import android.os.Looper; |
| 27 | import android.os.Message; |
| 28 | import android.provider.Settings.System; |
| 29 | import android.util.Log; |
| 30 | import android.view.Menu; |
| 31 | import android.view.MenuItem; |
| 32 | import android.view.View; |
| 33 | import android.view.Window; |
| 34 | import android.widget.Button; |
| 35 | import android.widget.ListView; |
| 36 | |
| 37 | import java.lang.Runtime; |
| 38 | |
| 39 | public class Fountain extends Activity { |
| 40 | //EventListener mListener = new EventListener(); |
| 41 | |
| 42 | private static final String LOG_TAG = "libRS_jni"; |
| 43 | private static final boolean DEBUG = false; |
| 44 | private static final boolean LOG_ENABLED = false; |
| 45 | |
| 46 | private FountainView mView; |
| 47 | |
| 48 | // get the current looper (from your Activity UI thread for instance |
| 49 | |
| 50 | |
| 51 | |
| 52 | @Override |
| 53 | public void onCreate(Bundle icicle) { |
| 54 | super.onCreate(icicle); |
| 55 | |
| 56 | // Create our Preview view and set it as the content of our |
| 57 | // Activity |
| 58 | mView = new FountainView(this); |
| 59 | setContentView(mView); |
| 60 | } |
| 61 | |
| 62 | @Override |
| 63 | protected void onResume() { |
| 64 | Log.e("rs", "onResume"); |
| 65 | |
| 66 | // Ideally a game should implement onResume() and onPause() |
| 67 | // to take appropriate action when the activity looses focus |
| 68 | super.onResume(); |
| 69 | mView.resume(); |
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | protected void onPause() { |
| 74 | Log.e("rs", "onPause"); |
| 75 | |
| 76 | // Ideally a game should implement onResume() and onPause() |
| 77 | // to take appropriate action when the activity looses focus |
| 78 | super.onPause(); |
| 79 | mView.pause(); |
| 80 | |
| 81 | |
| 82 | |
| 83 | //Runtime.getRuntime().exit(0); |
| 84 | } |
| 85 | |
| 86 | |
| 87 | static void log(String message) { |
| 88 | if (LOG_ENABLED) { |
| 89 | Log.v(LOG_TAG, message); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | |
| 94 | } |
| 95 | |