Preserve focus after layout

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2020-04-09 11:04:01 +02:00
parent 060c72b244
commit 93b745ae6f
No known key found for this signature in database
GPG Key ID: CDE0BBD2738C4CC0
2 changed files with 4 additions and 0 deletions

View File

@ -93,6 +93,7 @@ import com.stfalcon.chatkit.utils.DateFormatter
import com.uber.autodispose.lifecycle.LifecycleScopeProvider
import com.vanniktech.emoji.EmojiPopup
import kotlinx.android.synthetic.main.controller_chat.view.*
import kotlinx.android.synthetic.main.conversations_list_view.view.*
import kotlinx.android.synthetic.main.item_message_quote.view.*
import kotlinx.android.synthetic.main.lobby_view.view.*
import kotlinx.android.synthetic.main.view_message_input.view.*
@ -188,6 +189,8 @@ class ChatView(private val bundle: Bundle) : BaseView(), ImageLoaderInterface {
val layoutManager = LinearLayoutManager(activity, RecyclerView.VERTICAL, false)
layoutManager.stackFromEnd = true
view.messagesRecyclerView.initRecyclerView(layoutManager, messagesAdapter, true)
view.messagesRecyclerView.preserveFocusAfterLayout = true
emojiPopup = view.messageInput.let {
EmojiPopup.Builder.fromRootView(view).setOnEmojiPopupShownListener {

View File

@ -101,6 +101,7 @@ class ConversationsListView : BaseView() {
view.apply {
recyclerView.adapter = adapter
recyclerView.preserveFocusAfterLayout = true
with(swipeRefreshLayoutView) {
setColorSchemeResources(R.color.colorPrimary)
setOnRefreshListener {