summaryrefslogtreecommitdiffstats
path: root/src/java/jogamp/common/os/android/StaticContext.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-01-18 02:20:26 +0100
committerSven Gothel <[email protected]>2013-01-18 02:20:26 +0100
commit1b9f0739ecc25105384b557afa698c42e08d4cc6 (patch)
tree50f73f3d0d86bcb38e0db9e46bb55c7258e6d507 /src/java/jogamp/common/os/android/StaticContext.java
parent8018da4e37ac520fb49018fa6323b187526cd29e (diff)
Android Completion for launching main() class via MainLauncher; Fix ActivityLauncher order of delegation/super activity callbacks.
- StaticContext: - Add ViewGroup for standalone tests w/ UI - MainLauncher/LauncherUtil: - Complete launching a main() class from our activity launcher - adding main-cmdline-args - ActivityLauncher - Fix order of delegation/super activity callbacks.
Diffstat (limited to 'src/java/jogamp/common/os/android/StaticContext.java')
-rw-r--r--src/java/jogamp/common/os/android/StaticContext.java27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/java/jogamp/common/os/android/StaticContext.java b/src/java/jogamp/common/os/android/StaticContext.java
index d7f134a..359e603 100644
--- a/src/java/jogamp/common/os/android/StaticContext.java
+++ b/src/java/jogamp/common/os/android/StaticContext.java
@@ -29,9 +29,11 @@ package jogamp.common.os.android;
import android.content.Context;
import android.util.Log;
+import android.view.ViewGroup;
public class StaticContext {
private static Context appContext = null;
+ private static ViewGroup contentViewGroup = null;
private static boolean DEBUG = false;
@@ -42,19 +44,32 @@ public class StaticContext {
* @throws RuntimeException if the context is already registered.
*/
public static final synchronized void init(Context appContext) {
+ init(appContext, null);
+ }
+
+ /**
+ * Register Android application context w/ a ViewGroup for static usage.
+ *
+ * @param appContext mandatory application Context
+ * @param contentViewGroup optional ViewGroup acting as the Window's ContentView, usually a FrameLayout instance.
+ * @throws RuntimeException if the context is already registered.
+ */
+ public static final synchronized void init(Context appContext, ViewGroup contentViewGroup) {
if(null != StaticContext.appContext) {
throw new RuntimeException("Context already set");
}
- if(DEBUG) { Log.d(MD.TAG, "init(appCtx "+appContext+")"); }
+ if(DEBUG) { Log.d(MD.TAG, "init(appCtx "+appContext+", viewGroup "+contentViewGroup+")"); }
StaticContext.appContext = appContext;
+ StaticContext.contentViewGroup = contentViewGroup;
}
/**
- * Unregister the Android application Context
+ * Unregister the Android application Context and ViewGroup
*/
public static final synchronized void clear() {
if(DEBUG) { Log.d(MD.TAG, "clear()"); }
appContext = null;
+ contentViewGroup = null;
}
/**
@@ -64,4 +79,12 @@ public class StaticContext {
public static final synchronized Context getContext() {
return appContext;
}
+
+ /**
+ * Return the registered Android ViewGroup acting as the Window's ContentView
+ * @return
+ */
+ public static final synchronized ViewGroup getContentViewGroup() {
+ return contentViewGroup;
+ }
}