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
@ -93,18 +93,18 @@ object TextUtils {
|
||||
when {
|
||||
hours > 0 -> {
|
||||
appendHours(context, builder, hours)
|
||||
if(minutes > 0) {
|
||||
if (minutes > 0) {
|
||||
builder.append(" ")
|
||||
appendMinutes(context, builder, minutes)
|
||||
}
|
||||
if(seconds > 0) {
|
||||
if (seconds > 0) {
|
||||
builder.append(" ")
|
||||
appendSeconds(context, builder, seconds)
|
||||
}
|
||||
}
|
||||
minutes > 0 -> {
|
||||
appendMinutes(context, builder, minutes)
|
||||
if(seconds > 0) {
|
||||
if (seconds > 0) {
|
||||
builder.append(" ")
|
||||
appendSeconds(context, builder, seconds)
|
||||
}
|
||||
|
@ -216,7 +216,12 @@ class MessageItemFactory @Inject constructor(
|
||||
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)
|
||||
}
|
||||
return messageItem?.apply {
|
||||
|
@ -107,5 +107,4 @@ abstract class AbsMessageLocationItem<H : AbsMessageLocationItem.Holder> : AbsMe
|
||||
val staticMapPinImageView by bind<ImageView>(R.id.staticMapPinImageView)
|
||||
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 kotlinx.parcelize.Parcelize
|
||||
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.util.MatrixItem
|
||||
|
||||
|
@ -66,6 +66,11 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess
|
||||
MessageType.MSGTYPE_VIDEO,
|
||||
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 {
|
||||
@ -145,9 +150,11 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess
|
||||
}
|
||||
|
||||
private fun MessageContent?.timestampInsideMessage(): Boolean {
|
||||
if (this == null) return false
|
||||
if (msgType == MessageType.MSGTYPE_LOCATION || msgType == MessageType.MSGTYPE_BEACON_LOCATION_DATA) return vectorPreferences.labsRenderLocationsInTimeline()
|
||||
return this.msgType in MSG_TYPES_WITH_TIMESTAMP_INSIDE_MESSAGE
|
||||
return when {
|
||||
this == null -> false
|
||||
msgType in MSG_TYPES_WITH_LOCATION_DATA -> vectorPreferences.labsRenderLocationsInTimeline()
|
||||
else -> msgType in MSG_TYPES_WITH_TIMESTAMP_INSIDE_MESSAGE
|
||||
}
|
||||
}
|
||||
|
||||
private fun MessageContent?.shouldAddMessageOverlay(): Boolean {
|
||||
|
@ -104,7 +104,10 @@ class LocationLiveMessageBannerView @JvmOverloads constructor(
|
||||
countDownTimer = object : CountDownTimer(it, REMAINING_TIME_COUNTER_INTERVAL_IN_MS) {
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user