1 /* 2 * Copyright (C) 2010 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 android.opengl.cts; 18 19 import android.app.Activity; 20 import android.opengl.GLSurfaceView; 21 import android.os.Bundle; 22 import android.view.Window; 23 24 import javax.microedition.khronos.egl.EGLConfig; 25 import javax.microedition.khronos.opengles.GL10; 26 27 /** 28 * A minimal activity for testing {@link android.opengl.GLSurfaceView}. 29 * Also accepts non-blank renderers to allow its use for more complex tests. 30 */ 31 public class GLSurfaceViewCtsActivity extends Activity { 32 33 private static class Renderer implements GLSurfaceView.Renderer { 34 onDrawFrame(GL10 gl)35 public void onDrawFrame(GL10 gl) { 36 // Do nothing. 37 } 38 onSurfaceChanged(GL10 gl, int width, int height)39 public void onSurfaceChanged(GL10 gl, int width, int height) { 40 // Do nothing. 41 } 42 onSurfaceCreated(GL10 gl, EGLConfig config)43 public void onSurfaceCreated(GL10 gl, EGLConfig config) { 44 // Do nothing. 45 } 46 } 47 48 private GLSurfaceView mView; 49 50 @Override onCreate(Bundle savedInstanceState)51 public void onCreate(Bundle savedInstanceState) { 52 super.onCreate(savedInstanceState); 53 mView = new GLSurfaceView(this); 54 mView.setRenderer(new Renderer()); 55 this.requestWindowFeature(Window.FEATURE_NO_TITLE); 56 setContentView(mView); 57 } 58 getView()59 public GLSurfaceView getView() { 60 return mView; 61 } 62 63 @Override onResume()64 protected void onResume() { 65 super.onResume(); 66 mView.onResume(); 67 } 68 69 @Override onPause()70 protected void onPause() { 71 super.onPause(); 72 mView.onPause(); 73 } 74 } 75