Using setTextOrHide() extension method inside SessionInfoView

This commit is contained in:
Maxime NATUREL 2022-09-08 13:50:34 +02:00
parent 15cf8b63a0
commit 3970c2ec31
1 changed files with 2 additions and 9 deletions

View File

@ -24,6 +24,7 @@ import androidx.core.view.isVisible
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.date.DateFormatKind import im.vector.app.core.date.DateFormatKind
import im.vector.app.core.date.VectorDateFormatter import im.vector.app.core.date.VectorDateFormatter
import im.vector.app.core.extensions.setTextOrHide
import im.vector.app.core.extensions.setTextWithColoredPart import im.vector.app.core.extensions.setTextWithColoredPart
import im.vector.app.core.resources.ColorProvider import im.vector.app.core.resources.ColorProvider
import im.vector.app.core.resources.DrawableProvider import im.vector.app.core.resources.DrawableProvider
@ -172,15 +173,7 @@ class SessionInfoView @JvmOverloads constructor(
views.sessionInfoLastActivityTextView.isGone = true views.sessionInfoLastActivityTextView.isGone = true
} }
deviceInfo.lastSeenIp views.sessionInfoLastIPAddressTextView.setTextOrHide(deviceInfo.lastSeenIp?.takeIf { isLastSeenDetailsVisible })
?.takeIf { isLastSeenDetailsVisible }
?.let { ipAddress ->
views.sessionInfoLastIPAddressTextView.isVisible = true
views.sessionInfoLastIPAddressTextView.text = ipAddress
}
?: run {
views.sessionInfoLastIPAddressTextView.isGone = true
}
} }
private fun renderDetailsButton(isDetailsButtonVisible: Boolean) { private fun renderDetailsButton(isDetailsButtonVisible: Boolean) {