diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0b25c90c..30d19a51 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
+### Added
+- Option to disable the emoji key ([#234])
## [1.6.0] - 2025-10-29
### Added
@@ -115,6 +117,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#206]: https://github.com/FossifyOrg/Keyboard/issues/206
[#222]: https://github.com/FossifyOrg/Keyboard/issues/222
[#230]: https://github.com/FossifyOrg/Keyboard/issues/230
+[#234]: https://github.com/FossifyOrg/Keyboard/issues/234
[#238]: https://github.com/FossifyOrg/Keyboard/issues/238
[#239]: https://github.com/FossifyOrg/Keyboard/issues/239
[#251]: https://github.com/FossifyOrg/Keyboard/issues/251
diff --git a/app/src/main/kotlin/org/fossify/keyboard/activities/SettingsActivity.kt b/app/src/main/kotlin/org/fossify/keyboard/activities/SettingsActivity.kt
index be7267ce..08c0eb45 100644
--- a/app/src/main/kotlin/org/fossify/keyboard/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/org/fossify/keyboard/activities/SettingsActivity.kt
@@ -59,6 +59,7 @@ class SettingsActivity : SimpleActivity() {
setupManageKeyboardLanguages()
setupKeyboardLanguage()
setupKeyboardHeightMultiplier()
+ setupShowEmojiKey()
setupShowClipboardContent()
setupSentencesCapitalization()
setupShowNumbersRow()
@@ -237,6 +238,16 @@ class SettingsActivity : SimpleActivity() {
}
}
+ private fun setupShowEmojiKey() {
+ binding.apply {
+ settingsShowEmojiKeyHolder.setOnClickListener {
+ settingsShowEmojiKey.toggle()
+ config.showEmojiKey = settingsShowEmojiKey.isChecked
+ }
+ settingsShowEmojiKey.isChecked = config.showEmojiKey
+ }
+ }
+
private fun setupShowNumbersRow() {
binding.apply {
settingsShowNumbersRow.isChecked = config.showNumbersRow
diff --git a/app/src/main/kotlin/org/fossify/keyboard/helpers/Config.kt b/app/src/main/kotlin/org/fossify/keyboard/helpers/Config.kt
index 1fe5bb24..9d5499e4 100644
--- a/app/src/main/kotlin/org/fossify/keyboard/helpers/Config.kt
+++ b/app/src/main/kotlin/org/fossify/keyboard/helpers/Config.kt
@@ -23,6 +23,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(SENTENCES_CAPITALIZATION, true)
set(enableCapitalization) = prefs.edit().putBoolean(SENTENCES_CAPITALIZATION, enableCapitalization).apply()
+ var showEmojiKey: Boolean
+ get() = prefs.getBoolean(SHOW_EMOJI_KEY, true)
+ set(showEmojiKey) = prefs.edit().putBoolean(SHOW_EMOJI_KEY, showEmojiKey).apply()
+
var showKeyBorders: Boolean
get() = prefs.getBoolean(SHOW_KEY_BORDERS, true)
set(showKeyBorders) = prefs.edit().putBoolean(SHOW_KEY_BORDERS, showKeyBorders).apply()
diff --git a/app/src/main/kotlin/org/fossify/keyboard/helpers/Constants.kt b/app/src/main/kotlin/org/fossify/keyboard/helpers/Constants.kt
index 3aa71601..dfa1c6ea 100644
--- a/app/src/main/kotlin/org/fossify/keyboard/helpers/Constants.kt
+++ b/app/src/main/kotlin/org/fossify/keyboard/helpers/Constants.kt
@@ -15,6 +15,7 @@ const val VIBRATE_ON_KEYPRESS = "vibrate_on_keypress"
const val SHOW_POPUP_ON_KEYPRESS = "show_popup_on_keypress"
const val SHOW_KEY_BORDERS = "show_key_borders"
const val SENTENCES_CAPITALIZATION = "sentences_capitalization"
+const val SHOW_EMOJI_KEY = "show_emoji_key"
const val LAST_EXPORTED_CLIPS_FOLDER = "last_exported_clips_folder"
const val KEYBOARD_LANGUAGE = "keyboard_language"
const val HEIGHT_PERCENTAGE = "height_percentage"
diff --git a/app/src/main/kotlin/org/fossify/keyboard/services/SimpleKeyboardIME.kt b/app/src/main/kotlin/org/fossify/keyboard/services/SimpleKeyboardIME.kt
index 8ce056fa..9a33440e 100644
--- a/app/src/main/kotlin/org/fossify/keyboard/services/SimpleKeyboardIME.kt
+++ b/app/src/main/kotlin/org/fossify/keyboard/services/SimpleKeyboardIME.kt
@@ -209,7 +209,7 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
keyboardMode = KEYBOARD_SYMBOLS
R.xml.keys_symbols
}
- keyboard = MyKeyboard(this, keyboardXml, enterKeyType)
+ keyboard = constructKeyboard(keyboardXml, enterKeyType)
keyboardView!!.setKeyboard(keyboard!!)
}
keyboardView!!.invalidateAllKeys()
@@ -234,7 +234,7 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
R.xml.keys_symbols
}
- keyboard = MyKeyboard(this, keyboardXML, enterKeyType)
+ keyboard = constructKeyboard(keyboardXML, enterKeyType)
keyboardView!!.setKeyboard(keyboard!!)
}
@@ -247,7 +247,7 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
getKeyboardLayoutXML()
}
- keyboard = MyKeyboard(this, keyboardXml, enterKeyType)
+ keyboard = constructKeyboard(keyboardXml, enterKeyType)
keyboardView!!.setKeyboard(keyboard!!)
}
@@ -337,7 +337,7 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
// TODO: Change keyboardMode to enum class
keyboardMode = KEYBOARD_LETTERS
- keyboard = MyKeyboard(this, getKeyboardLayoutXML(), enterKeyType)
+ keyboard = constructKeyboard(getKeyboardLayoutXML(), enterKeyType)
val editorInfo = currentInputEditorInfo
if (editorInfo != null && editorInfo.inputType != TYPE_NULL && keyboard?.mShiftState != ShiftState.ON_PERMANENT) {
@@ -399,11 +399,7 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
getKeyboardLayoutXML()
}
}
- return MyKeyboard(
- context = this,
- xmlLayoutResId = keyboardXml,
- enterKeyType = enterKeyType,
- )
+ return constructKeyboard(keyboardXml, enterKeyType)
}
override fun onUpdateSelection(oldSelStart: Int, oldSelEnd: Int, newSelStart: Int, newSelEnd: Int, candidatesStart: Int, candidatesEnd: Int) {
@@ -582,4 +578,31 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
return Icon.createWithData(byteArray, 0, byteArray.size)
}
+
+ private fun adjustForEmojiButton(keyboard: MyKeyboard): MyKeyboard {
+ if (!config.showEmojiKey && this.keyboardMode == KEYBOARD_LETTERS) {
+ keyboard.mKeys?.let { keys ->
+ val emojiKeyIndex = keys.indexOfFirst { it.code == MyKeyboard.KEYCODE_EMOJI }
+ val spaceKeyIndex = keys.indexOfFirst { it.code == MyKeyboard.KEYCODE_SPACE }
+
+ if (emojiKeyIndex != -1 && spaceKeyIndex != -1) {
+ val emojiKey = keys[emojiKeyIndex]
+ val spaceKey = keys[spaceKeyIndex]
+
+ spaceKey.width += emojiKey.width + emojiKey.gap
+ spaceKey.x = emojiKey.x
+
+ val mutableKeys = keys.toMutableList()
+ mutableKeys.removeAt(emojiKeyIndex)
+ keyboard.mKeys = mutableKeys
+ }
+ }
+ }
+ return keyboard
+ }
+
+ private fun constructKeyboard(keyboardXml: Int, enterKeyType: Int): MyKeyboard {
+ val keyboard = MyKeyboard(this, keyboardXml, enterKeyType)
+ return adjustForEmojiButton(keyboard)
+ }
}
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 2529d2f8..82850b41 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -237,6 +237,21 @@
+
+
+
+
+
+
Mostra i bordi dei tasti
Mostra i numeri su una riga separata
Inizia le frasi con la lettera maiuscola
+ Mostra tasto emoji
Emoji
Attiva Tastiera Fossify nella schermata successiva per renderla disponibile. Una volta abilitata, premi \"Indietro\".
Appunti
@@ -46,4 +47,4 @@
Cibo e bevande
Viaggi e luoghi
AttivitÃ
-
\ No newline at end of file
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index dbadaef0..10499b1d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -36,6 +36,7 @@
Show key borders
Show numbers on a separate row
Start sentences with a capital letter
+ Show emoji key
Emojis
Recently used