Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class SettingsActivity : SimpleActivity() {
setupManageKeyboardLanguages()
setupKeyboardLanguage()
setupKeyboardHeightMultiplier()
setupShowEmojiKey()
setupShowClipboardContent()
setupSentencesCapitalization()
setupShowNumbersRow()
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/kotlin/org/fossify/keyboard/helpers/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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!!)
}

Expand All @@ -247,7 +247,7 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
getKeyboardLayoutXML()
}

keyboard = MyKeyboard(this, keyboardXml, enterKeyType)
keyboard = constructKeyboard(keyboardXml, enterKeyType)
keyboardView!!.setKeyboard(keyboard!!)
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
}
}
15 changes: 15 additions & 0 deletions app/src/main/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,21 @@

</RelativeLayout>

<RelativeLayout
android:id="@+id/settings_show_emoji_key_holder"
style="@style/SettingsHolderSwitchStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<org.fossify.commons.views.MyMaterialSwitch
android:id="@+id/settings_show_emoji_key"
style="@style/SettingsSwitchStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/show_emoji_key" />

</RelativeLayout>

<RelativeLayout
android:id="@+id/settings_keyboard_height_multiplier_holder"
style="@style/SettingsHolderTextViewStyle"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<string name="show_key_borders">Mostra i bordi dei tasti</string>
<string name="show_numbers_row">Mostra i numeri su una riga separata</string>
<string name="start_sentences_capitalized">Inizia le frasi con la lettera maiuscola</string>
<string name="show_emoji_key">Mostra tasto emoji</string>
<string name="emojis">Emoji</string>
<string name="redirection_note">Attiva Tastiera Fossify nella schermata successiva per renderla disponibile. Una volta abilitata, premi \"Indietro\".</string>
<string name="clipboard">Appunti</string>
Expand All @@ -46,4 +47,4 @@
<string name="food_and_drink">Cibo e bevande</string>
<string name="travel_and_places">Viaggi e luoghi</string>
<string name="activities">Attività</string>
</resources>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<string name="show_key_borders">Show key borders</string>
<string name="show_numbers_row">Show numbers on a separate row</string>
<string name="start_sentences_capitalized">Start sentences with a capital letter</string>
<string name="show_emoji_key">Show emoji key</string>
<!-- Emojis -->
<string name="emojis">Emojis</string>
<string name="recently_used">Recently used</string>
Expand Down
Loading