Fix sometimes overlapping URL preview text with timestamp
Change-Id: Ib441c2d0a447051b4dde2990111f748f1f3f2d66
This commit is contained in:
parent
1f37da276e
commit
6a8cd9a329
|
@ -183,5 +183,6 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
|
|||
} // else: will be handled in onStateUpdated
|
||||
holder.previewUrlView.footerWidth = height
|
||||
holder.previewUrlView.footerHeight = height
|
||||
holder.previewUrlView.updateFooterSpace()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,16 +148,7 @@ class PreviewUrlView @JvmOverloads constructor(
|
|||
private fun renderData(previewUrlData: PreviewUrlData, imageContentRenderer: ImageContentRenderer) {
|
||||
// Set footer sizes before setText() calls so they are available onMeasure
|
||||
val siteText = previewUrlData.siteName.takeIf { it != previewUrlData.title }
|
||||
val siteViewHidden = siteText == null || siteText.isBlank() // identical to setTextOrHide
|
||||
if (siteViewHidden) {
|
||||
views.urlPreviewDescription.footerWidth = footerWidth
|
||||
views.urlPreviewDescription.footerHeight = footerHeight
|
||||
} else {
|
||||
views.urlPreviewSite.footerWidth = footerWidth
|
||||
views.urlPreviewSite.footerHeight = footerHeight
|
||||
views.urlPreviewDescription.footerWidth = 0
|
||||
views.urlPreviewDescription.footerHeight = 0
|
||||
}
|
||||
updateFooterSpaceInternal(siteText)
|
||||
|
||||
isVisible = true
|
||||
views.urlPreviewTitle.setTextOrHide(previewUrlData.title)
|
||||
|
@ -175,4 +166,23 @@ class PreviewUrlView @JvmOverloads constructor(
|
|||
views.urlPreviewDescription.isVisible = false
|
||||
views.urlPreviewSite.isVisible = false
|
||||
}
|
||||
|
||||
public fun updateFooterSpace() {
|
||||
val siteText = views.urlPreviewSite.text as String?
|
||||
updateFooterSpaceInternal(siteText)
|
||||
requestLayout()
|
||||
}
|
||||
|
||||
private fun updateFooterSpaceInternal(siteText: String?) {
|
||||
val siteViewHidden = siteText == null || siteText.isBlank() // identical to setTextOrHide
|
||||
if (siteViewHidden) {
|
||||
views.urlPreviewDescription.footerWidth = footerWidth
|
||||
views.urlPreviewDescription.footerHeight = footerHeight
|
||||
} else {
|
||||
views.urlPreviewSite.footerWidth = footerWidth
|
||||
views.urlPreviewSite.footerHeight = footerHeight
|
||||
views.urlPreviewDescription.footerWidth = 0
|
||||
views.urlPreviewDescription.footerHeight = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue