Commit 9497d79d authored by Lucio Maciel's avatar Lucio Maciel

Layout adjustments for url preview

parent 50e854fe
...@@ -5,15 +5,21 @@ import android.net.Uri ...@@ -5,15 +5,21 @@ import android.net.Uri
import android.view.View import android.view.View
import chat.rocket.android.chatroom.viewmodel.UrlPreviewViewModel import chat.rocket.android.chatroom.viewmodel.UrlPreviewViewModel
import chat.rocket.android.util.extensions.content import chat.rocket.android.util.extensions.content
import chat.rocket.android.util.extensions.setVisible
import kotlinx.android.synthetic.main.message_url_preview.view.* import kotlinx.android.synthetic.main.message_url_preview.view.*
class UrlPreviewViewHolder(itemView: View) : BaseViewHolder<UrlPreviewViewModel>(itemView) { class UrlPreviewViewHolder(itemView: View) : BaseViewHolder<UrlPreviewViewModel>(itemView) {
override fun bindViews(data: UrlPreviewViewModel) { override fun bindViews(data: UrlPreviewViewModel) {
with(itemView) { with(itemView) {
if (data.thumbUrl.isNullOrEmpty()) {
image_preview.setVisible(false)
} else {
image_preview.setImageURI(data.thumbUrl) image_preview.setImageURI(data.thumbUrl)
image_preview.setVisible(true)
}
text_host.content = data.hostname text_host.content = data.hostname
text_title.content = data.title text_title.content = data.title
text_description.content = data.description text_description.content = data.description ?: ""
url_preview_layout.setOnClickListener { view -> url_preview_layout.setOnClickListener { view ->
view.context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(data.rawData.url))) view.context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(data.rawData.url)))
......
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