-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ability to set input type on android #2405
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
--- a/src/main/java/org/libsdl/app/SDLActivity.java | ||
+++ b/src/main/java/org/libsdl/app/SDLActivity.java | ||
@@ -196,6 +196,15 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh | ||
@@ -94,6 +94,8 @@ | ||
// This is what SDL runs in. It invokes SDL_main(), eventually | ||
protected static Thread mSDLThread; | ||
|
||
+ public static int keyboardInputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So at the end the changes you made to this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are correct. |
||
+ | ||
protected static SDLGenericMotionListener_API12 getMotionListener() { | ||
if (mMotionListener == null) { | ||
if (Build.VERSION.SDK_INT >= 26) { | ||
@@ -196,6 +198,15 @@ | ||
Log.v(TAG, "onCreate()"); | ||
super.onCreate(savedInstanceState); | ||
|
||
+ SDLActivity.initialize(); | ||
+ // So we can call stuff from static callbacks | ||
+ mSingleton = this; | ||
|
@@ -16,19 +25,19 @@ | |
// Load shared libraries | ||
String errorMsgBrokenLib = ""; | ||
try { | ||
@@ -639,7 +648,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh | ||
@@ -639,7 +650,7 @@ | ||
Handler commandHandler = new SDLCommandHandler(); | ||
|
||
// Send a message from the SDLMain thread | ||
- boolean sendCommand(int command, Object data) { | ||
+ protected boolean sendCommand(int command, Object data) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh god it's so hard to read a diff of a diff, I initially tought you changed that. |
||
Message msg = commandHandler.obtainMessage(); | ||
msg.arg1 = command; | ||
msg.obj = data; | ||
@@ -1051,6 +1061,21 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh | ||
@@ -1051,6 +1062,21 @@ | ||
return Arrays.copyOf(filtered, used); | ||
} | ||
|
||
+ /** | ||
+ * Calls turnActive() on singleton to keep loading screen active | ||
+ */ | ||
|
@@ -45,11 +54,11 @@ | |
+ | ||
+ | ||
// APK expansion files support | ||
|
||
/** com.android.vending.expansion.zipfile.ZipResourceFile object or null. */ | ||
@@ -1341,14 +1366,13 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh | ||
@@ -1341,14 +1367,13 @@ | ||
}; | ||
|
||
public void onSystemUiVisibilityChange(int visibility) { | ||
- if (SDLActivity.mFullscreenModeActive && (visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0 || (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) { | ||
- | ||
|
@@ -62,13 +71,21 @@ | |
} | ||
- | ||
} | ||
} | ||
@@ -1475,6 +1499,7 @@ class SDLMain implements Runnable { | ||
} | ||
|
||
@@ -1475,6 +1500,7 @@ | ||
String[] arguments = SDLActivity.mSingleton.getArguments(); | ||
|
||
Log.v("SDL", "Running main function " + function + " from library " + library); | ||
+ SDLActivity.mSingleton.appConfirmedActive(); | ||
SDLActivity.nativeRunMain(library, function, arguments); | ||
|
||
Log.v("SDL", "Finished main function"); | ||
@@ -2002,7 +2028,7 @@ | ||
public InputConnection onCreateInputConnection(EditorInfo outAttrs) { | ||
ic = new SDLInputConnection(this, true); | ||
|
||
- outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; | ||
+ outAttrs.inputType = SDLActivity.keyboardInputType; | ||
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI | ||
| EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK nice, then someone could write the Python wrapper in
pythonforandroid/recipes/android/src/android/
later, correct?If you already have done so for your project you could share the code snipped in some comments. Or better make a follow up PR after this one is merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it could be.
This change keyboard function is being utilized kivy/kivy#7231