Merge pull request #2664 from vector-im/feature/ons/emoji_keyboard_settings

Option to hide emoji keyboard.
This commit is contained in:
Benoit Marty 2021-01-14 10:17:33 +01:00 committed by GitHub
commit e041d404f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 0 deletions

View file

@ -8,6 +8,7 @@ Features ✨:
Improvements 🙌:
- Add System theme option and set as default (#904, #2387)
- Warn user when they are leaving a not public room (#1460)
- Option to disable emoji keyboard (#2563)
Bugfix 🐛:
- Unspecced msgType field in m.sticker (#2580)

View file

@ -1164,6 +1164,8 @@ class RoomDetailFragment @Inject constructor(
} else false
}
views.composerLayout.views.composerEmojiButton.isVisible = vectorPreferences.showEmojiKeyboard()
views.composerLayout.callback = object : TextComposerView.Callback {
override fun onAddAttachment() {
if (!::attachmentTypeSelector.isInitialized) {

View file

@ -98,6 +98,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
private const val SETTINGS_VIBRATE_ON_MENTION_KEY = "SETTINGS_VIBRATE_ON_MENTION_KEY"
private const val SETTINGS_SEND_MESSAGE_WITH_ENTER = "SETTINGS_SEND_MESSAGE_WITH_ENTER"
private const val SETTINGS_ENABLE_CHAT_EFFECTS = "SETTINGS_ENABLE_CHAT_EFFECTS"
private const val SETTINGS_SHOW_EMOJI_KEYBOARD = "SETTINGS_SHOW_EMOJI_KEYBOARD"
// Help
private const val SETTINGS_SHOULD_SHOW_HELP_ON_ROOM_LIST_KEY = "SETTINGS_SHOULD_SHOW_HELP_ON_ROOM_LIST_KEY"
@ -207,6 +208,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
SETTINGS_MEDIA_SAVING_PERIOD_SELECTED_KEY,
SETTINGS_PREVIEW_MEDIA_BEFORE_SENDING_KEY,
SETTINGS_SEND_MESSAGE_WITH_ENTER,
SETTINGS_SHOW_EMOJI_KEYBOARD,
SETTINGS_PIN_UNREAD_MESSAGES_PREFERENCE_KEY,
SETTINGS_PIN_MISSED_NOTIFICATIONS_PREFERENCE_KEY,
@ -822,6 +824,15 @@ class VectorPreferences @Inject constructor(private val context: Context) {
return defaultPrefs.getBoolean(SETTINGS_SEND_MESSAGE_WITH_ENTER, false)
}
/**
* Tells if the emoji keyboard button should be visible or not.
*
* @return true to show emoji keyboard button.
*/
fun showEmojiKeyboard(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_SHOW_EMOJI_KEYBOARD, true)
}
/**
* Tells if the rage shake is used.
*

View file

@ -917,6 +917,8 @@
<string name="settings_preview_media_before_sending">Preview media before sending</string>
<string name="settings_send_message_with_enter">Send message with enter</string>
<string name="settings_send_message_with_enter_summary">Enter button of the soft keyboard will send message instead of adding a line break</string>
<string name="settings_show_emoji_keyboard">Show emoji keyboard</string>
<string name="settings_show_emoji_keyboard_summary">Add a button on message composer to open emoji keyboard</string>
<string name="settings_secure_backup_section_title">Secure Backup</string>
<string name="settings_secure_backup_manage">Manage</string>

View file

@ -49,6 +49,12 @@
android:summary="@string/settings_send_message_with_enter_summary"
android:title="@string/settings_send_message_with_enter" />
<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="true"
android:key="SETTINGS_SHOW_EMOJI_KEYBOARD"
android:summary="@string/settings_show_emoji_keyboard_summary"
android:title="@string/settings_show_emoji_keyboard" />
</im.vector.app.core.preference.VectorPreferenceCategory>
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/settings_category_timeline">