From 335839b27f29f4020d4edf21169c4bd455252f4b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 29 Aug 2013 13:13:44 -0400 Subject: [PATCH] [Android] Move the instantiation of the NativeGLSurfaceView into a layout file. This will allow the addition of other components in the future, such as overlays, etc. --- Source/Android/res/layout/emulation_view.xml | 14 ++++++++++++++ .../org/dolphinemu/dolphinemu/DolphinEmulator.java | 4 +--- .../dolphinemu/dolphinemu/NativeGLSurfaceView.java | 6 ++++-- 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 Source/Android/res/layout/emulation_view.xml diff --git a/Source/Android/res/layout/emulation_view.xml b/Source/Android/res/layout/emulation_view.xml new file mode 100644 index 0000000000..017e98602e --- /dev/null +++ b/Source/Android/res/layout/emulation_view.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index a4b24391fb..00aabfaf66 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -27,7 +27,6 @@ import org.dolphinemu.dolphinemu.settings.UserPreferences; public final class DolphinEmulator extends Activity { - private static NativeGLSurfaceView GLview = null; private static boolean Running = false; private float screenWidth; @@ -154,11 +153,10 @@ public final class DolphinEmulator extends Activity screenHeight = displayMetrics.heightPixels; String FileName = data.getStringExtra("Select"); - GLview = new NativeGLSurfaceView(this); this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight); NativeLibrary.SetFilename(FileName); - setContentView(GLview); + setContentView(R.layout.emulation_view); Running = true; } } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java index d35b8a4adb..4551e5b94c 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java @@ -7,6 +7,7 @@ package org.dolphinemu.dolphinemu; import android.content.Context; +import android.util.AttributeSet; import android.view.SurfaceHolder; import android.view.SurfaceView; @@ -24,9 +25,10 @@ public final class NativeGLSurfaceView extends SurfaceView * * @param context The current {@link Context}. */ - public NativeGLSurfaceView(Context context) + public NativeGLSurfaceView(Context context, AttributeSet attribs) { - super(context); + super(context, attribs); + if (!Created) { myRun = new Thread()