Index: platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java |
diff --git a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java |
index 950d6b2d5bee33963b08eb80c37e3034f4235095..48cec39f483d658970297cc17813b460b75dc53b 100644 |
--- a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java |
+++ b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java |
@@ -7,22 +7,48 @@ |
package org.skia.viewer; |
-import android.app.ActionBar; |
+import android.app.Activity; |
import android.os.Bundle; |
-import android.provider.Settings; |
-import android.view.View; |
-import android.view.WindowManager; |
+import android.view.Surface; |
+import android.view.SurfaceHolder; |
+import android.view.SurfaceView; |
+ |
+public class ViewerActivity extends Activity implements SurfaceHolder.Callback { |
+ private SurfaceView mView; |
+ private ViewerApplication mApplication; |
+ |
+ private native void onSurfaceCreated(long handle, Surface surface); |
+ private native void onSurfaceChanged(long handle, Surface surface); |
+ private native void onSurfaceDestroyed(long handle); |
-public class ViewerActivity extends android.app.NativeActivity { |
- static { |
- System.loadLibrary("skia_android"); |
- } |
- |
@Override |
- public void onCreate(Bundle savedInstanceState) |
- { |
+ protected void onCreate(Bundle savedInstanceState) { |
super.onCreate(savedInstanceState); |
- ActionBar ab = this.getActionBar(); |
- ab.hide(); |
+ setContentView(R.layout.activity_main); |
+ |
+ mApplication = (ViewerApplication) getApplication(); |
+ mView = (SurfaceView) findViewById(R.id.surfaceView); |
+ mView.getHolder().addCallback(this); |
+ } |
+ |
+ @Override |
+ public void surfaceCreated(SurfaceHolder holder) { |
+ if (mApplication.getNativeHandle() != 0) { |
+ onSurfaceCreated(mApplication.getNativeHandle(), holder.getSurface()); |
+ } |
+ } |
+ |
+ @Override |
+ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { |
+ if (mApplication.getNativeHandle() != 0) { |
+ onSurfaceChanged(mApplication.getNativeHandle(), holder.getSurface()); |
+ } |
+ } |
+ |
+ @Override |
+ public void surfaceDestroyed(SurfaceHolder holder) { |
+ if (mApplication.getNativeHandle() != 0) { |
+ onSurfaceDestroyed(mApplication.getNativeHandle()); |
+ } |
} |
} |