/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package br.odb.nehe.lesson06;

import android.app.Activity;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.WindowManager;

import java.io.File;


public class GL2JNIActivity extends Activity {

    GL2JNIView mView;
    boolean running = false;
    static AssetManager assets;
    @Override protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        assets = getAssets();
        GL2JNILib.onCreate( assets );

        Bitmap bitmap = null;
        try {
            bitmap = BitmapFactory.decodeStream(assets.open("texture.png"));
            GL2JNILib.setTexture(bitmap);
        } catch (IOException e) {
        }

        mView = new GL2JNIView(getApplication());
        setContentView(mView);
    }

    @Override protected void onPause() {
        super.onPause();

        running = false;
        mView.onPause();
    }

    @Override protected void onResume() {
        super.onResume();
        mView.onResume();

        new Thread(new Runnable() {
            @Override
            public void run() {
                running = true;
                while( running ) {
                    try {
                        Thread.sleep( 20 );
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    GL2JNILib.tick();
                }
            }
        }).start();
    }

    @Override
    protected void onDestroy() {

        GL2JNILib.onDestroy();

        super.onDestroy();
    }
}

@@ -786,16 +786,46 @@
 actory;%0A
+import android.graphics.Rect;%0A
 import a
@@ -867,16 +867,42 @@
 il.Log;%0A
+import android.view.View;%0A
 import a
@@ -950,16 +950,44 @@
 o.File;%0A
+import java.io.IOException;%0A
 %0A%0Apublic
@@ -1111,16 +1111,17 @@
 assets;%0A
+%0A
     @Ove
@@ -1117,32 +1117,36 @@
 ;%0A%0A    @Override
+%0A   
  protected void 
@@ -1261,24 +1261,22 @@
 nCreate(
- 
 assets
- 
 );%0A%0A    
@@ -1572,32 +1572,36 @@
 %7D%0A%0A    @Override
+%0A   
  protected void 
@@ -1708,16 +1708,20 @@
 Override
+%0A   
  protect
@@ -1941,18 +1941,17 @@
 hile
-(
  
+(
 running
- 
 ) %7B%0A
@@ -2017,12 +2017,10 @@
 eep(
- 
 20
- 
 );%0A 

Reformat for Activity in lesson 6