Skip to content

Commit 19eb371

Browse files
committed
Do not force soft keyboard visible when hw exists
1 parent 6caaae4 commit 19eb371

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/src/main/java/com/termux/app/DialogUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.app.Activity;
44
import android.app.AlertDialog;
55
import android.content.DialogInterface;
6+
import android.content.res.Configuration;
67
import android.text.Selection;
78
import android.util.TypedValue;
89
import android.view.KeyEvent;
@@ -69,7 +70,10 @@ public void onClick(DialogInterface dialog, int which) {
6970
}
7071

7172
dialogHolder[0] = builder.create();
72-
dialogHolder[0].getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
73+
if ((activity.getResources().getConfiguration().hardKeyboardHidden & Configuration.HARDKEYBOARDHIDDEN_YES) == 0) {
74+
// Show soft keyboard unless hardware keyboard available.
75+
dialogHolder[0].getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
76+
}
7377
dialogHolder[0].show();
7478
}
7579

0 commit comments

Comments
 (0)