mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Fix code quality issues
This commit is contained in:
parent
16be69ebae
commit
59567e39b4
@ -216,7 +216,12 @@ class MessageItemFactory @Inject constructor(
|
|||||||
buildMessageTextItem(messageContent.body, false, informationData, highlight, callback, attributes)
|
buildMessageTextItem(messageContent.body, false, informationData, highlight, callback, attributes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is MessageBeaconInfoContent -> liveLocationShareMessageItemFactory.create(informationData.liveLocationShareSummaryData, highlight, attributes)
|
is MessageBeaconInfoContent ->
|
||||||
|
liveLocationShareMessageItemFactory.create(
|
||||||
|
informationData.liveLocationShareSummaryData,
|
||||||
|
highlight,
|
||||||
|
attributes
|
||||||
|
)
|
||||||
else -> buildNotHandledMessageItem(messageContent, informationData, highlight, callback, attributes)
|
else -> buildNotHandledMessageItem(messageContent, informationData, highlight, callback, attributes)
|
||||||
}
|
}
|
||||||
return messageItem?.apply {
|
return messageItem?.apply {
|
||||||
|
@ -107,5 +107,4 @@ abstract class AbsMessageLocationItem<H : AbsMessageLocationItem.Holder> : AbsMe
|
|||||||
val staticMapPinImageView by bind<ImageView>(R.id.staticMapPinImageView)
|
val staticMapPinImageView by bind<ImageView>(R.id.staticMapPinImageView)
|
||||||
val staticMapErrorTextView by bind<TextView>(R.id.staticMapErrorTextView)
|
val staticMapErrorTextView by bind<TextView>(R.id.staticMapErrorTextView)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@ import android.os.Parcelable
|
|||||||
import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout
|
import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import org.matrix.android.sdk.api.session.crypto.verification.VerificationState
|
import org.matrix.android.sdk.api.session.crypto.verification.VerificationState
|
||||||
import org.matrix.android.sdk.api.session.room.model.message.LocationInfo
|
|
||||||
import org.matrix.android.sdk.api.session.room.model.message.MessageBeaconLocationDataContent
|
|
||||||
import org.matrix.android.sdk.api.session.room.send.SendState
|
import org.matrix.android.sdk.api.session.room.send.SendState
|
||||||
import org.matrix.android.sdk.api.util.MatrixItem
|
import org.matrix.android.sdk.api.util.MatrixItem
|
||||||
|
|
||||||
|
@ -66,6 +66,11 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess
|
|||||||
MessageType.MSGTYPE_VIDEO,
|
MessageType.MSGTYPE_VIDEO,
|
||||||
MessageType.MSGTYPE_BEACON_INFO,
|
MessageType.MSGTYPE_BEACON_INFO,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val MSG_TYPES_WITH_LOCATION_DATA = setOf(
|
||||||
|
MessageType.MSGTYPE_LOCATION,
|
||||||
|
MessageType.MSGTYPE_BEACON_LOCATION_DATA
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val cornerRadius: Float by lazy {
|
private val cornerRadius: Float by lazy {
|
||||||
@ -145,9 +150,11 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun MessageContent?.timestampInsideMessage(): Boolean {
|
private fun MessageContent?.timestampInsideMessage(): Boolean {
|
||||||
if (this == null) return false
|
return when {
|
||||||
if (msgType == MessageType.MSGTYPE_LOCATION || msgType == MessageType.MSGTYPE_BEACON_LOCATION_DATA) return vectorPreferences.labsRenderLocationsInTimeline()
|
this == null -> false
|
||||||
return this.msgType in MSG_TYPES_WITH_TIMESTAMP_INSIDE_MESSAGE
|
msgType in MSG_TYPES_WITH_LOCATION_DATA -> vectorPreferences.labsRenderLocationsInTimeline()
|
||||||
|
else -> msgType in MSG_TYPES_WITH_TIMESTAMP_INSIDE_MESSAGE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun MessageContent?.shouldAddMessageOverlay(): Boolean {
|
private fun MessageContent?.shouldAddMessageOverlay(): Boolean {
|
||||||
|
@ -104,7 +104,10 @@ class LocationLiveMessageBannerView @JvmOverloads constructor(
|
|||||||
countDownTimer = object : CountDownTimer(it, REMAINING_TIME_COUNTER_INTERVAL_IN_MS) {
|
countDownTimer = object : CountDownTimer(it, REMAINING_TIME_COUNTER_INTERVAL_IN_MS) {
|
||||||
override fun onTick(millisUntilFinished: Long) {
|
override fun onTick(millisUntilFinished: Long) {
|
||||||
val duration = Duration.ofMillis(millisUntilFinished.coerceAtLeast(0L))
|
val duration = Duration.ofMillis(millisUntilFinished.coerceAtLeast(0L))
|
||||||
subTitle.text = context.getString(R.string.location_share_live_remaining_time, TextUtils.formatDurationWithUnits(context, duration))
|
subTitle.text = context.getString(
|
||||||
|
R.string.location_share_live_remaining_time,
|
||||||
|
TextUtils.formatDurationWithUnits(context, duration)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFinish() {
|
override fun onFinish() {
|
||||||
|
Loading…
Reference in New Issue
Block a user