diff options
author | Sven Gothel <[email protected]> | 2012-06-21 19:43:59 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-06-21 19:43:59 +0200 |
commit | 533e072a592826df53b90491bcaa606dfddaf646 (patch) | |
tree | cab29af1a38b2c0f51e85063a111c41ed69ba933 /src/test | |
parent | f5c9f5b2fb6bccb923d053f558b924c2ed19b57a (diff) |
NEWT: Add virtual on-screen keyboard visibility interface methods incl. Android implementation.
Note: Currently only w/ Android implementation.
Note: On Android there is no way to reliably be notified of the current keyboard state.
It would be best, if your code does not rely on this information
Window adds:
- setKeyboardVisible(boolean)
- isKeyboardVisible() // unreliable on Android
Diffstat (limited to 'src/test')
3 files changed, 3 insertions, 15 deletions
diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java index 59e78936d..a30262ee3 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java @@ -34,7 +34,6 @@ import java.util.Arrays; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; -import jogamp.newt.driver.android.AndroidWindow; import jogamp.newt.driver.android.NewtBaseActivity; import com.jogamp.common.util.IOUtil; @@ -46,10 +45,8 @@ import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube; import com.jogamp.opengl.util.Animator; -import android.content.Context; import android.os.Bundle; import android.util.Log; -import android.view.inputmethod.InputMethodManager; public class MovieCubeActivity0 extends NewtBaseActivity { static String TAG = "MovieCubeActivity0"; @@ -58,10 +55,7 @@ public class MovieCubeActivity0 extends NewtBaseActivity { @Override public void mousePressed(MouseEvent e) { if(e.getPressure()>2f) { - final AndroidWindow win = (AndroidWindow)e.getSource(); - InputMethodManager mgr = (InputMethodManager) win.getAndroidView().getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - mgr.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); // shows keyboard .. - win.getAndroidView().requestFocus(); + ((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(true); } } }; diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java index 592ecf5d6..4468868f6 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java @@ -30,7 +30,6 @@ package com.jogamp.opengl.test.android; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; -import jogamp.newt.driver.android.AndroidWindow; import jogamp.newt.driver.android.NewtBaseActivity; import com.jogamp.newt.ScreenMode; @@ -42,10 +41,8 @@ import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.util.Animator; -import android.content.Context; import android.os.Bundle; import android.util.Log; -import android.view.inputmethod.InputMethodManager; public class NEWTGearsES2Activity extends NewtBaseActivity { static String TAG = "NEWTGearsES2Activity"; @@ -65,10 +62,7 @@ public class NEWTGearsES2Activity extends NewtBaseActivity { @Override public void mousePressed(MouseEvent e) { if(e.getPressure()>2f) { // show Keyboard - final AndroidWindow win = (AndroidWindow)e.getSource(); - InputMethodManager mgr = (InputMethodManager) win.getAndroidView().getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - mgr.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); // shows keyboard .. - win.getAndroidView().requestFocus(); + ((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(true); } } }); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java index 0454d543c..907be5092 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java @@ -59,7 +59,7 @@ public class NEWTGearsES2ActivityLauncher extends LauncherUtil.BaseActivityLaunc // properties.setProperty("newt.debug", "all"); // props.setProperty("newt.debug.Window", "true"); // props.setProperty("newt.debug.Window.MouseEvent", "true"); - // props.setProperty("newt.debug.Window.KeyEvent", "true"); + props.setProperty("newt.debug.Window.KeyEvent", "true"); } @Override |