Skip to content

Commit 4cf60e3

Browse files
committed
Dismiss emoji keyboard when starting search
1 parent 79bc2d7 commit 4cf60e3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
271271
activity?.invalidateOptionsMenu()
272272
}
273273

274-
private fun dismissEmojiKeyboard() {
274+
fun dismissEmojiKeyboard() {
275275
// Check if the keyboard was ever initialized.
276276
// It may be the case when you are looking a not joined room
277277
if (::emojiKeyboardPopup.isInitialized) {

app/src/main/java/chat/rocket/android/chatroom/ui/Menu.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ private fun ChatRoomFragment.setupSearchMessageMenuItem(menu: Menu, context: Con
7979
.setShowAsActionFlags(
8080
MenuItem.SHOW_AS_ACTION_IF_ROOM or MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
8181
)
82+
.setOnActionExpandListener(object : MenuItem.OnActionExpandListener {
83+
override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
84+
dismissEmojiKeyboard()
85+
return true
86+
}
87+
88+
override fun onMenuItemActionCollapse(item: MenuItem?) = true
89+
})
8290

8391
(searchItem?.actionView as? SearchView)?.let {
8492
// TODO: Check why we need to stylize the search text programmatically instead of by defining it in the styles.xml (ChatRoom.SearchView)

0 commit comments

Comments
 (0)