Fixed bug #4843 - Can not get the ime candidatelist like chinese/japaness input method

This commit is contained in:
Sylvain
2021-10-17 23:17:54 +02:00
parent 7fb4364391
commit ccb12457f9
3 changed files with 40 additions and 1 deletions

View File

@@ -102,6 +102,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
public static boolean mBrokenLibraries = true;
public static int mInputType = 1;
// Main components
protected static SDLActivity mSingleton;
protected static SDLSurface mSurface;
@@ -1184,6 +1186,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE;
}
/**
* This method is called by SDL using JNI.
*/
public static int setInputType(int type) {
mInputType = type;
return 0;
}
/**
* This method is called by SDL using JNI.
*/
@@ -2182,7 +2192,14 @@ class DummyEdit extends View implements View.OnKeyListener {
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
ic = new SDLInputConnection(this, true);
outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
if (SDLActivity.mInputType == 0) {
/* 0 normal: use input method */
outAttrs.inputType = InputType.TYPE_CLASS_TEXT;
} else {
/* 1 password (default): can not use input methodjust use english */
outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
}
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
| EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */;