mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 23:25:20 +03:00
Merge pull request #2802 from nextcloud/issue-1090
Implemented automatic scrolling to quoted messages on tap
This commit is contained in:
commit
7c75f8254d
2 changed files with 16 additions and 0 deletions
|
@ -40,6 +40,7 @@ import coil.load
|
|||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
||||
import com.nextcloud.talk.controllers.ChatController
|
||||
import com.nextcloud.talk.databinding.ItemCustomIncomingTextMessageBinding
|
||||
import com.nextcloud.talk.extensions.loadBotsAvatar
|
||||
import com.nextcloud.talk.extensions.loadChangelogBotAvatar
|
||||
|
@ -198,6 +199,11 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) : MessageHolde
|
|||
ContextCompat.getColor(binding.messageQuote.quoteColoredView.context, R.color.high_emphasis_text)
|
||||
)
|
||||
}
|
||||
|
||||
binding.messageQuote.quotedChatMessageView.setOnClickListener() {
|
||||
val chatController = commonMessageInterface as ChatController
|
||||
chatController.jumpToQuotedMessage(parentChatMessage)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showAvatarOnChatMessage(message: ChatMessage) {
|
||||
|
|
|
@ -3487,6 +3487,16 @@ class ChatController(args: Bundle) :
|
|||
)
|
||||
}
|
||||
|
||||
fun jumpToQuotedMessage(parentMessage: ChatMessage) {
|
||||
for (position in 0 until (adapter!!.items.size)) {
|
||||
val currentItem = adapter?.items?.get(position)?.item
|
||||
if (currentItem is ChatMessage && currentItem.id == parentMessage.id) {
|
||||
layoutManager!!.scrollToPosition(position)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun logConversationInfos(methodName: String) {
|
||||
Log.d(TAG, " |-----------------------------------------------")
|
||||
Log.d(TAG, " | method: $methodName")
|
||||
|
|
Loading…
Reference in a new issue