aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android/apps
diff options
context:
space:
mode:
Diffstat (limited to 'platform_tools/android/apps')
-rw-r--r--platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java7
-rw-r--r--platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java17
2 files changed, 24 insertions, 0 deletions
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 e3260c25f7..d6fe710aeb 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
@@ -60,6 +60,7 @@ public class ViewerActivity
setContentView(R.layout.activity_main);
mApplication = (ViewerApplication) getApplication();
+ mApplication.setViewerActivity(this);
mView = (SurfaceView) findViewById(R.id.surfaceView);
mView.getHolder().addCallback(this);
@@ -67,6 +68,12 @@ public class ViewerActivity
}
@Override
+ protected void onDestroy() {
+ mApplication.setViewerActivity(null);
+ super.onDestroy();
+ }
+
+ @Override
public void surfaceCreated(SurfaceHolder holder) {
if (mApplication.getNativeHandle() != 0) {
onSurfaceCreated(mApplication.getNativeHandle(), holder.getSurface());
diff --git a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java
index 9389f72208..4b890bd5e1 100644
--- a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java
+++ b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java
@@ -11,6 +11,7 @@ import android.app.Application;
public class ViewerApplication extends Application {
private long mNativeHandle = 0;
+ private ViewerActivity mViewerActivity;
static {
System.loadLibrary("skia_android");
@@ -38,4 +39,20 @@ public class ViewerApplication extends Application {
public long getNativeHandle() {
return mNativeHandle;
}
+
+ public void setViewerActivity(ViewerActivity viewerActivity) {
+ this.mViewerActivity = viewerActivity;
+ }
+
+ public void setTitle(String title) {
+ final String finalTitle = title;
+ if (mViewerActivity != null) {
+ mViewerActivity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mViewerActivity.setTitle(finalTitle);
+ }
+ });
+ }
+ }
}