mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-08 03:24:04 +08:00
Allow users to enable/disable keyboard instead of just show/hide with keyboard toggle buttons
This `soft-keyboard-toggle-behaviour` key can be used to change the behaviour. The default behaviour is `show/hide`. The user can set the value to `enable/disable` in `termux.properties` file to change default behaviour of keyboard toggle buttons to enable/disable. In this mode, tapping the keyboard toggle button will disable (and hide) the keyboard and tapping on the terminal view will not open the keybaord automatically, until the keyboard toggle button is pressed again manually. This applies to split screen and floating keyboard as well. The keyboard can also be enabled from Settings -> Keyboard I/O -> Soft Keyboard toggle. Running `termux-reload-settings` command will also update the behaviour instantaneously if changed. Fixed issue where "hide-soft-keyboard-on-startup" property wouldn't work if Termux app was switched back from another app. Fixes #1098 Fixed issue where soft keyboard may not show on startup on some devices but it still may fail sometimes. The `TermuxPropertyConstants` class has been updated to `v0.7.0`. Check its Changelog sections for info on changes.
This commit is contained in:
@@ -19,7 +19,9 @@ public class KeyboardUtils {
|
||||
|
||||
public static void setSoftKeyboardVisibility(@NonNull final Runnable showSoftKeyboardRunnable, final Activity activity, final View view, final boolean visible) {
|
||||
if (visible) {
|
||||
view.postDelayed(showSoftKeyboardRunnable, 1000);
|
||||
// A Runnable with a delay is used, otherwise soft keyboard may not automatically open
|
||||
// on some devices, but still may fail
|
||||
view.postDelayed(showSoftKeyboardRunnable, 500);
|
||||
} else {
|
||||
view.removeCallbacks(showSoftKeyboardRunnable);
|
||||
hideSoftKeyboard(activity, view);
|
||||
|
Reference in New Issue
Block a user