Commit 2e563131 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Add swapping icons between emoji and keyboard

parent 1e4ac51e
......@@ -14,6 +14,7 @@ import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.text.method.ScrollingMovementMethod
import android.view.*
import android.widget.ImageButton
import chat.rocket.android.R
import chat.rocket.android.chatroom.presentation.ChatRoomPresenter
import chat.rocket.android.chatroom.presentation.ChatRoomView
......@@ -278,7 +279,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiFragment.OnEmojiClickCal
}, 600)
}
button_add_reaction.setOnClickListener {
button_add_reaction.setOnClickListener { view ->
activity?.let {
val editor = text_message
val emojiFragment = EmojiFragment.getOrAttach(it, R.id.emoji_fragment_placeholder, composer)
......@@ -286,11 +287,16 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiFragment.OnEmojiClickCal
if (!isShown()) {
show()
} else {
val button = view as ImageButton
val resourceId: Int
if (softKeyboardVisible) {
resourceId = R.drawable.ic_keyboard_black_24px
KeyboardHelper.hideSoftKeyboard(it)
} else {
resourceId = R.drawable.ic_reaction_24dp
KeyboardHelper.showSoftKeyboard(editor)
}
button.setImageResource(resourceId)
}
}
}
......
......@@ -93,7 +93,6 @@ class EmojiFragment : Fragment() {
} else if (lastVisibleDecorViewHeight + 150 < visibleDecorViewHeight) {
// Notify listener about keyboard being hidden.
softKeyboardVisible = false
hide()
}
}
// Save current decor view height for the next call.
......
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#000000"
android:pathData="M20,5 L4,5 C2.9,5,2.01,5.9,2.01,7 L2,17 C2,18.1,2.9,19,4,19 L20,19
C21.1,19,22,18.1,22,17 L22,7 C22,5.9,21.1,5,20,5 Z M11,8 L13,8 L13,10 L11,10
L11,8 Z M11,11 L13,11 L13,13 L11,13 L11,11 Z M8,8 L10,8 L10,10 L8,10 L8,8 Z
M8,11 L10,11 L10,13 L8,13 L8,11 Z M7,13 L5,13 L5,11 L7,11 L7,13 Z M7,10 L5,10
L5,8 L7,8 L7,10 Z M16,17 L8,17 L8,15 L16,15 L16,17 Z M16,13 L14,13 L14,11 L16,11
L16,13 Z M16,10 L14,10 L14,8 L16,8 L16,10 Z M19,13 L17,13 L17,11 L19,11 L19,13 Z
M19,10 L17,10 L17,8 L19,8 L19,10 Z" />
<path
android:pathData="M0,0 L24,0 L24,24 L0,24 Z M-24,0 L0,0 L0,24 L0,24 Z" />
</vector>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment