Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java

Issue 1952323004: Initial commit of our new Android app to demo Skia. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Merge Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 package org.skia.viewer; 8 package org.skia.viewer;
9 9
10 import android.app.ActionBar; 10 import android.app.Activity;
11 import android.os.Bundle; 11 import android.os.Bundle;
12 import android.provider.Settings; 12 import android.view.Surface;
13 import android.view.View; 13 import android.view.SurfaceHolder;
14 import android.view.WindowManager; 14 import android.view.SurfaceView;
15 15
16 public class ViewerActivity extends android.app.NativeActivity { 16 public class ViewerActivity extends Activity implements SurfaceHolder.Callback {
17 static { 17 private SurfaceView mView;
18 System.loadLibrary("skia_android"); 18 private ViewerApplication mApplication;
19
20 private native void onSurfaceCreated(long handle, Surface surface);
21 private native void onSurfaceChanged(long handle, Surface surface);
22 private native void onSurfaceDestroyed(long handle);
23
24 @Override
25 protected void onCreate(Bundle savedInstanceState) {
26 super.onCreate(savedInstanceState);
27 setContentView(R.layout.activity_main);
28
29 mApplication = (ViewerApplication) getApplication();
30 mView = (SurfaceView) findViewById(R.id.surfaceView);
31 mView.getHolder().addCallback(this);
19 } 32 }
20 33
21 @Override 34 @Override
22 public void onCreate(Bundle savedInstanceState) 35 public void surfaceCreated(SurfaceHolder holder) {
23 { 36 if (mApplication.getNativeHandle() != 0) {
24 super.onCreate(savedInstanceState); 37 onSurfaceCreated(mApplication.getNativeHandle(), holder.getSurface() );
25 ActionBar ab = this.getActionBar(); 38 }
26 ab.hide(); 39 }
40
41 @Override
42 public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
43 if (mApplication.getNativeHandle() != 0) {
44 onSurfaceChanged(mApplication.getNativeHandle(), holder.getSurface() );
45 }
46 }
47
48 @Override
49 public void surfaceDestroyed(SurfaceHolder holder) {
50 if (mApplication.getNativeHandle() != 0) {
51 onSurfaceDestroyed(mApplication.getNativeHandle());
52 }
27 } 53 }
28 } 54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698