From 4eaa1797890a14eca64012970b7e923b309ec8dd Mon Sep 17 00:00:00 2001 From: Andrew Gunnerson Date: Mon, 6 Sep 2021 13:01:31 -0400 Subject: [PATCH] magikeyboard: Don't force full screen EditTexts on large screen devices Per [1], Android defaults to showing EditTexts in full screen mode when the device is in landscape orientation. This makes sense for phones, but not so much for larger screen devices, like tablets. This commit updates MagiKeyboard to not use full screen mode on large screen devices. The condition for disabling full screen mode is the same as in the AOSP keyboard and should match what other OEM keyboards do as well. [1] https://developer.android.com/reference/android/inputmethodservice/InputMethodService#fullscreen-mode --- .../magikeyboard/MagikeyboardService.kt | 6 +++++ app/src/main/res/values-land/config.xml | 22 +++++++++++++++++++ app/src/main/res/values-sw430dp/config.xml | 22 +++++++++++++++++++ app/src/main/res/values-sw600dp/config.xml | 22 +++++++++++++++++++ app/src/main/res/values-sw768dp/config.xml | 22 +++++++++++++++++++ app/src/main/res/values/config.xml | 22 +++++++++++++++++++ 6 files changed, 116 insertions(+) create mode 100644 app/src/main/res/values-land/config.xml create mode 100644 app/src/main/res/values-sw430dp/config.xml create mode 100644 app/src/main/res/values-sw600dp/config.xml create mode 100644 app/src/main/res/values-sw768dp/config.xml create mode 100644 app/src/main/res/values/config.xml diff --git a/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikeyboardService.kt b/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikeyboardService.kt index 8d19dd523..0712d6622 100644 --- a/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikeyboardService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikeyboardService.kt @@ -178,6 +178,12 @@ class MagikeyboardService : InputMethodService(), KeyboardView.OnKeyboardActionL assignKeyboardView() } + override fun onEvaluateFullscreenMode(): Boolean { + val fullscreenAllowed = resources.getBoolean(R.bool.magikeyboard_allow_fullscreen_mode) + + return fullscreenAllowed && super.onEvaluateFullscreenMode() + } + private fun playVibration(keyCode: Int) { when (keyCode) { Keyboard.KEYCODE_DELETE -> {} diff --git a/app/src/main/res/values-land/config.xml b/app/src/main/res/values-land/config.xml new file mode 100644 index 000000000..3156a7262 --- /dev/null +++ b/app/src/main/res/values-land/config.xml @@ -0,0 +1,22 @@ + + + + true + \ No newline at end of file diff --git a/app/src/main/res/values-sw430dp/config.xml b/app/src/main/res/values-sw430dp/config.xml new file mode 100644 index 000000000..6ad4af76e --- /dev/null +++ b/app/src/main/res/values-sw430dp/config.xml @@ -0,0 +1,22 @@ + + + + false + \ No newline at end of file diff --git a/app/src/main/res/values-sw600dp/config.xml b/app/src/main/res/values-sw600dp/config.xml new file mode 100644 index 000000000..6ad4af76e --- /dev/null +++ b/app/src/main/res/values-sw600dp/config.xml @@ -0,0 +1,22 @@ + + + + false + \ No newline at end of file diff --git a/app/src/main/res/values-sw768dp/config.xml b/app/src/main/res/values-sw768dp/config.xml new file mode 100644 index 000000000..6ad4af76e --- /dev/null +++ b/app/src/main/res/values-sw768dp/config.xml @@ -0,0 +1,22 @@ + + + + false + \ No newline at end of file diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml new file mode 100644 index 000000000..6ad4af76e --- /dev/null +++ b/app/src/main/res/values/config.xml @@ -0,0 +1,22 @@ + + + + false + \ No newline at end of file