Skip to content

Commit

Permalink
Fixed bug 3065 - Screen is flickering during closing on-screen keyboa…
Browse files Browse the repository at this point in the history
…rd on Android

Deve

When I'm trying to close on-screen keyboard using SDL_StopTextInput() function by touching the screen (SDL_FINGERUP or SDL_FINGERDOWN event), the screen is flickering. It is white for a while.

Note that it usually works without problems when I use phone's "back" button. I noticed flickering occasionally too, but not that often.

Philipp Wiesemann

The attached patch maybe fixes the flicker but not the actual fault causing it.
  • Loading branch information
slouken committed Oct 1, 2016
1 parent c9be93c commit 4e6f219
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion android-project/src/org/libsdl/app/SDLActivity.java
Expand Up @@ -369,7 +369,10 @@ public void handleMessage(Message msg) {
break;
case COMMAND_TEXTEDIT_HIDE:
if (mTextEdit != null) {
mTextEdit.setVisibility(View.GONE);
// Note: On some devices setting view to GONE creates a flicker in landscape.
// Setting the View's sizes to 0 is similar to GONE but without the flicker.
// The sizes will be set to useful values when the keyboard is shown again.
mTextEdit.setLayoutParams(new AbsoluteLayout.LayoutParams(0, 0, 0, 0));

InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0);
Expand Down

0 comments on commit 4e6f219

Please sign in to comment.