diff --git a/app/src/keyboards/java/be/scri/helpers/ui/KeyboardUIManager.kt b/app/src/keyboards/java/be/scri/helpers/ui/KeyboardUIManager.kt index 4ecb128c..4fe40d65 100644 --- a/app/src/keyboards/java/be/scri/helpers/ui/KeyboardUIManager.kt +++ b/app/src/keyboards/java/be/scri/helpers/ui/KeyboardUIManager.kt @@ -697,7 +697,8 @@ class KeyboardUIManager( val isTablet = (context.resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK) >= - Configuration.SCREENLAYOUT_SIZE_LARGE + Configuration.SCREENLAYOUT_SIZE_LARGE || + context.resources.configuration.smallestScreenWidthDp >= GeneralKeyboardIME.SMALLEST_SCREEN_WIDTH_TABLET val emojiCount = if (isAutoSuggestEnabled) autoSuggestEmojis?.size ?: 0 else 0 diff --git a/app/src/keyboards/java/be/scri/services/EnglishKeyboardIME.kt b/app/src/keyboards/java/be/scri/services/EnglishKeyboardIME.kt index 8978d723..8818bdb9 100644 --- a/app/src/keyboards/java/be/scri/services/EnglishKeyboardIME.kt +++ b/app/src/keyboards/java/be/scri/services/EnglishKeyboardIME.kt @@ -11,12 +11,6 @@ import be.scri.helpers.KeyHandler * The EnglishKeyboardIME class provides the input method for the English language keyboard. */ class EnglishKeyboardIME : GeneralKeyboardIME("English") { - companion object { - const val SMALLEST_SCREEN_WIDTH_TABLET = 600 - } - - private fun isTablet(): Boolean = resources.configuration.smallestScreenWidthDp >= SMALLEST_SCREEN_WIDTH_TABLET - override fun getKeyboardLayoutXML(): Int = when { isTablet() -> R.xml.keys_letters_english_tablet diff --git a/app/src/keyboards/java/be/scri/services/FrenchKeyboardIME.kt b/app/src/keyboards/java/be/scri/services/FrenchKeyboardIME.kt index e389ad15..fdd26509 100644 --- a/app/src/keyboards/java/be/scri/services/FrenchKeyboardIME.kt +++ b/app/src/keyboards/java/be/scri/services/FrenchKeyboardIME.kt @@ -11,12 +11,6 @@ import be.scri.helpers.KeyHandler * The FrenchKeyboardIME class provides the input method for the French language keyboard. */ class FrenchKeyboardIME : GeneralKeyboardIME("French") { - companion object { - const val SMALLEST_SCREEN_WIDTH_TABLET = 600 - } - - private fun isTablet(): Boolean = resources.configuration.smallestScreenWidthDp >= SMALLEST_SCREEN_WIDTH_TABLET - override fun getKeyboardLayoutXML(): Int = when { isTablet() -> R.xml.keys_letters_french_tablet diff --git a/app/src/keyboards/java/be/scri/services/GeneralKeyboardIME.kt b/app/src/keyboards/java/be/scri/services/GeneralKeyboardIME.kt index 16115def..a826df99 100644 --- a/app/src/keyboards/java/be/scri/services/GeneralKeyboardIME.kt +++ b/app/src/keyboards/java/be/scri/services/GeneralKeyboardIME.kt @@ -186,7 +186,10 @@ abstract class GeneralKeyboardIME( private var currentVerbForConjugation: String? = null private var selectedConjugationSubCategory: String? = null + protected open fun isTablet(): Boolean = resources.configuration.smallestScreenWidthDp >= SMALLEST_SCREEN_WIDTH_TABLET + internal companion object { + const val SMALLEST_SCREEN_WIDTH_TABLET = 600 const val DEFAULT_SHIFT_PERM_TOGGLE_SPEED = 500 const val TEXT_LENGTH = 20 const val NOUN_TYPE_SIZE = 20f diff --git a/app/src/keyboards/java/be/scri/services/GermanKeyboardIME.kt b/app/src/keyboards/java/be/scri/services/GermanKeyboardIME.kt index 618e79f1..da401d38 100644 --- a/app/src/keyboards/java/be/scri/services/GermanKeyboardIME.kt +++ b/app/src/keyboards/java/be/scri/services/GermanKeyboardIME.kt @@ -12,12 +12,6 @@ import be.scri.helpers.PreferencesHelper.getIsAccentCharacterDisabled * The GermanKeyboardIME class provides the input method for the German language keyboard. */ class GermanKeyboardIME : GeneralKeyboardIME("German") { - companion object { - const val SMALLEST_SCREEN_WIDTH_TABLET = 600 - } - - private fun isTablet(): Boolean = resources.configuration.smallestScreenWidthDp >= SMALLEST_SCREEN_WIDTH_TABLET - override fun getKeyboardLayoutXML(): Int = if (isTablet()) { R.xml.keys_letters_german_tablet diff --git a/app/src/keyboards/java/be/scri/services/ItalianKeyboardIME.kt b/app/src/keyboards/java/be/scri/services/ItalianKeyboardIME.kt index 26826de0..2579944f 100644 --- a/app/src/keyboards/java/be/scri/services/ItalianKeyboardIME.kt +++ b/app/src/keyboards/java/be/scri/services/ItalianKeyboardIME.kt @@ -11,12 +11,6 @@ import be.scri.helpers.KeyHandler * The ItalianKeyboardIME class provides the input method for the Italian language keyboard. */ class ItalianKeyboardIME : GeneralKeyboardIME("Italian") { - companion object { - const val SMALLEST_SCREEN_WIDTH_TABLET = 600 - } - - private fun isTablet(): Boolean = resources.configuration.smallestScreenWidthDp >= SMALLEST_SCREEN_WIDTH_TABLET - override fun getKeyboardLayoutXML(): Int = when { isTablet() -> R.xml.keys_letters_italian_tablet diff --git a/app/src/keyboards/java/be/scri/services/PortugueseKeyboardIME.kt b/app/src/keyboards/java/be/scri/services/PortugueseKeyboardIME.kt index 05c5c7f0..ecad059d 100644 --- a/app/src/keyboards/java/be/scri/services/PortugueseKeyboardIME.kt +++ b/app/src/keyboards/java/be/scri/services/PortugueseKeyboardIME.kt @@ -11,12 +11,6 @@ import be.scri.helpers.KeyHandler * The PortugueseKeyboardIME class provides the input method for the Portuguese language keyboard. */ class PortugueseKeyboardIME : GeneralKeyboardIME("Portuguese") { - companion object { - const val SMALLEST_SCREEN_WIDTH_TABLET = 600 - } - - private fun isTablet(): Boolean = resources.configuration.smallestScreenWidthDp >= SMALLEST_SCREEN_WIDTH_TABLET - override fun getKeyboardLayoutXML(): Int = when { isTablet() -> R.xml.keys_letters_portuguese_tablet diff --git a/app/src/keyboards/java/be/scri/services/RussianKeyboardIME.kt b/app/src/keyboards/java/be/scri/services/RussianKeyboardIME.kt index afb59dbf..f0f228ad 100644 --- a/app/src/keyboards/java/be/scri/services/RussianKeyboardIME.kt +++ b/app/src/keyboards/java/be/scri/services/RussianKeyboardIME.kt @@ -11,12 +11,6 @@ import be.scri.helpers.KeyHandler * The RussianKeyboardIME class provides the input method for the Russian language keyboard. */ class RussianKeyboardIME : GeneralKeyboardIME("Russian") { - companion object { - const val SMALLEST_SCREEN_WIDTH_TABLET = 600 - } - - private fun isTablet(): Boolean = resources.configuration.smallestScreenWidthDp >= SMALLEST_SCREEN_WIDTH_TABLET - override fun getKeyboardLayoutXML(): Int = when { isTablet() -> R.xml.keys_letters_russian_tablet diff --git a/app/src/keyboards/java/be/scri/services/SpanishKeyboardIME.kt b/app/src/keyboards/java/be/scri/services/SpanishKeyboardIME.kt index 605844d6..3227b348 100644 --- a/app/src/keyboards/java/be/scri/services/SpanishKeyboardIME.kt +++ b/app/src/keyboards/java/be/scri/services/SpanishKeyboardIME.kt @@ -12,12 +12,6 @@ import be.scri.helpers.PreferencesHelper.getIsAccentCharacterDisabled * The SpanishKeyboardIME class provides the input method for the Spanish language keyboard. */ class SpanishKeyboardIME : GeneralKeyboardIME("Spanish") { - companion object { - const val SMALLEST_SCREEN_WIDTH_TABLET = 600 - } - - private fun isTablet(): Boolean = resources.configuration.smallestScreenWidthDp >= SMALLEST_SCREEN_WIDTH_TABLET - override fun getKeyboardLayoutXML(): Int = when { isTablet() -> R.xml.keys_letters_spanish_tablet diff --git a/app/src/keyboards/java/be/scri/services/SwedishKeyboardIME.kt b/app/src/keyboards/java/be/scri/services/SwedishKeyboardIME.kt index f423aae6..2772ff7f 100644 --- a/app/src/keyboards/java/be/scri/services/SwedishKeyboardIME.kt +++ b/app/src/keyboards/java/be/scri/services/SwedishKeyboardIME.kt @@ -12,12 +12,6 @@ import be.scri.helpers.PreferencesHelper.getIsAccentCharacterDisabled * The SwedishKeyboardIME class provides the input method for the Swedish language keyboard. */ class SwedishKeyboardIME : GeneralKeyboardIME("Swedish") { - companion object { - const val SMALLEST_SCREEN_WIDTH_TABLET = 600 - } - - private fun isTablet(): Boolean = resources.configuration.smallestScreenWidthDp >= SMALLEST_SCREEN_WIDTH_TABLET - override fun getKeyboardLayoutXML(): Int = when { isTablet() -> R.xml.keys_letters_swedish_tablet