Show the soft keyboard provided by Android without a text field

for pure text input for editing the name of the savegame.
This commit is contained in:
Bernhard Kaindl
2012-08-07 13:28:55 +02:00
parent cb96c4e85f
commit 267b9174eb
6 changed files with 40 additions and 1 deletions

View File

@@ -307,6 +307,12 @@ public class MainActivity extends Activity {
System.exit(0);
}
public void togglePlainAndroidSoftKeyboardInput()
{
InputMethodManager imm = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
public void showScreenKeyboard(final String oldText, boolean sendBackspace)
{
if(Globals.CompatibilityHacksTextInputEmulatesHwKeyboard)

View File

@@ -524,6 +524,21 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
return 1;
}
public void togglePlainAndroidSoftKeyboardInput() // Called from native code
{
class Callback implements Runnable
{
public MainActivity parent;
public void run()
{
parent.togglePlainAndroidSoftKeyboardInput();
}
}
Callback cb = new Callback();
cb.parent = context;
context.runOnUiThread(cb);
}
public void showScreenKeyboard(final String oldText, int sendBackspace) // Called from native code
{
class Callback implements Runnable