mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-17 12:30:07 +03:00
Bubbles: some clean up
This commit is contained in:
parent
baee076e41
commit
5ac155285b
8 changed files with 22 additions and 17 deletions
|
@ -160,7 +160,7 @@ Formatter\.formatShortFileSize===1
|
|||
# android\.text\.TextUtils
|
||||
|
||||
### This is not a rule, but a warning: the number of "enum class" has changed. For Json classes, it is mandatory that they have `@JsonClass(generateAdapter = false)`. If the enum is not used as a Json class, change the value in file forbidden_strings_in_code.txt
|
||||
enum class===115
|
||||
enum class===116
|
||||
|
||||
### Do not import temporary legacy classes
|
||||
import org.matrix.android.sdk.internal.legacy.riot===3
|
||||
|
|
|
@ -145,7 +145,6 @@ class AvatarRenderer @Inject constructor(private val activeSessionHolder: Active
|
|||
}
|
||||
else -> {
|
||||
it.apply(RequestOptions.circleCropTransform())
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,8 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses
|
|||
val addDaySeparator = date.toLocalDate() != nextDate?.toLocalDate()
|
||||
|
||||
val isFirstFromThisSender = nextDisplayableEvent?.root?.senderId != event.root.senderId || addDaySeparator
|
||||
val isLastFromThisSender = prevDisplayableEvent?.root?.senderId != event.root.senderId || prevDisplayableEvent?.root?.localDateTime()?.toLocalDate() != date.toLocalDate()
|
||||
val isLastFromThisSender = prevDisplayableEvent?.root?.senderId != event.root.senderId ||
|
||||
prevDisplayableEvent?.root?.localDateTime()?.toLocalDate() != date.toLocalDate()
|
||||
|
||||
val time = dateFormatter.format(event.root.originServerTs, DateFormatKind.MESSAGE_SIMPLE)
|
||||
val e2eDecoration = getE2EDecoration(roomSummary, event)
|
||||
|
|
|
@ -30,16 +30,21 @@ sealed interface TimelineMessageLayout : Parcelable {
|
|||
data class Default(override val showAvatar: Boolean,
|
||||
override val showDisplayName: Boolean,
|
||||
override val showTimestamp: Boolean,
|
||||
// Keep defaultLayout generated on epoxy items
|
||||
// Keep defaultLayout generated on epoxy items
|
||||
override val layoutRes: Int = 0) : TimelineMessageLayout
|
||||
|
||||
@Parcelize
|
||||
data class Bubble(override val showAvatar: Boolean,
|
||||
override val showDisplayName: Boolean,
|
||||
override val showTimestamp: Boolean = true,
|
||||
val isIncoming: Boolean,
|
||||
val isFirstFromThisSender: Boolean,
|
||||
val isLastFromThisSender: Boolean,
|
||||
override val layoutRes: Int = if (isIncoming) R.layout.item_timeline_event_bubble_incoming_base else R.layout.item_timeline_event_bubble_outgoing_base,
|
||||
data class Bubble(
|
||||
override val showAvatar: Boolean,
|
||||
override val showDisplayName: Boolean,
|
||||
override val showTimestamp: Boolean = true,
|
||||
val isIncoming: Boolean,
|
||||
val isFirstFromThisSender: Boolean,
|
||||
val isLastFromThisSender: Boolean,
|
||||
override val layoutRes: Int = if (isIncoming) {
|
||||
R.layout.item_timeline_event_bubble_incoming_base
|
||||
} else {
|
||||
R.layout.item_timeline_event_bubble_outgoing_base
|
||||
},
|
||||
) : TimelineMessageLayout
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess
|
|||
}
|
||||
|
||||
fun create(params: TimelineItemFactoryParams): TimelineMessageLayout {
|
||||
|
||||
val event = params.event
|
||||
val nextDisplayableEvent = params.nextDisplayableEvent
|
||||
val prevDisplayableEvent = params.prevDisplayableEvent
|
||||
|
@ -78,8 +77,8 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess
|
|||
buildModernLayout(showInformation)
|
||||
}
|
||||
val isFirstFromThisSender = nextDisplayableEvent?.root?.senderId != event.root.senderId || addDaySeparator
|
||||
val isLastFromThisSender = prevDisplayableEvent?.root?.senderId != event.root.senderId
|
||||
|| prevDisplayableEvent?.root?.localDateTime()?.toLocalDate() != date.toLocalDate()
|
||||
val isLastFromThisSender = prevDisplayableEvent?.root?.senderId != event.root.senderId ||
|
||||
prevDisplayableEvent?.root?.localDateTime()?.toLocalDate() != date.toLocalDate()
|
||||
|
||||
TimelineMessageLayout.Bubble(
|
||||
showAvatar = showInformation && !isSentByMe,
|
||||
|
|
|
@ -37,8 +37,8 @@ import im.vector.app.core.utils.DimensionConverter
|
|||
import im.vector.app.features.themes.ThemeUtils
|
||||
|
||||
class MessageBubbleView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0)
|
||||
: RelativeLayout(context, attrs, defStyleAttr), MessageViewConfiguration {
|
||||
defStyleAttr: Int = 0) :
|
||||
RelativeLayout(context, attrs, defStyleAttr), MessageViewConfiguration {
|
||||
|
||||
override var isIncoming: Boolean = false
|
||||
set(value) {
|
||||
|
|
|
@ -3701,4 +3701,5 @@
|
|||
<string name="poll_end_room_list_preview">Poll ended</string>
|
||||
<string name="delete_poll_dialog_title">Remove poll</string>
|
||||
<string name="delete_poll_dialog_content">Are you sure you want to remove this poll? You won\'t be able to recover it once removed.</string>
|
||||
<string name="message_bubbles">Message bubbles</string>
|
||||
</resources>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<im.vector.app.core.preference.VectorSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="SETTINGS_INTERFACE_BUBBLE_KEY"
|
||||
android:title="Message bubbles" />
|
||||
android:title="@string/message_bubbles" />
|
||||
|
||||
<im.vector.app.core.preference.VectorPreference
|
||||
android:dialogTitle="@string/font_size"
|
||||
|
|
Loading…
Add table
Reference in a new issue