Skip to content

Commit 28e3074

Browse files
committed
fix: crash when keyboard close
1 parent aa32d8b commit 28e3074

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

app_pojavlauncher/src/main/java/org/libsdl/app/SDLActivity.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import android.view.inputmethod.InputMethodManager;
5050
import android.webkit.MimeTypeMap;
5151
import android.widget.Button;
52+
import android.widget.FrameLayout;
5253
import android.widget.LinearLayout;
5354
import android.widget.RelativeLayout;
5455
import android.widget.TextView;
@@ -994,7 +995,8 @@ public void handleMessage(Message msg) {
994995
// Note: On some devices setting view to GONE creates a flicker in landscape.
995996
// Setting the View's sizes to 0 is similar to GONE but without the flicker.
996997
// The sizes will be set to useful values when the keyboard is shown again.
997-
mTextEdit.setLayoutParams(new RelativeLayout.LayoutParams(0, 0));
998+
mTextEdit.setLayoutParams(new FrameLayout.LayoutParams(0, 0));
999+
9981000

9991001
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
10001002
imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0);
@@ -1458,9 +1460,8 @@ public ShowTextInputTask(int input_type, int x, int y, int w, int h) {
14581460

14591461
@Override
14601462
public void run() {
1461-
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(w, h + HEIGHT_PADDING);
1462-
params.leftMargin = x;
1463-
params.topMargin = y;
1463+
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(w, h + HEIGHT_PADDING);
1464+
params.gravity = Gravity.TOP; // TODO: When setting up keyboard panning, set to BOTTOM
14641465

14651466
if (mTextEdit == null) {
14661467
mTextEdit = new SDLDummyEdit(getContext());

0 commit comments

Comments
 (0)