mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Make sure that files grid in chat bubble is using at most 3 columns
This commit is contained in:
parent
21398c7b37
commit
b6279b03c0
1 changed files with 9 additions and 4 deletions
|
|
@ -436,6 +436,11 @@ class MessageModel
|
||||||
|
|
||||||
displayableContentFound = true
|
displayableContentFound = true
|
||||||
} else {
|
} else {
|
||||||
|
val wrapBefore = if (exactly4Contents) {
|
||||||
|
contentIndex == 2 // To have a 2x2 grid
|
||||||
|
} else {
|
||||||
|
contentIndex % 3 == 0 // To have at most 3 columns
|
||||||
|
}
|
||||||
if (content.isFile) {
|
if (content.isFile) {
|
||||||
Log.d("$TAG Found file content with type [${content.type}/${content.subtype}]")
|
Log.d("$TAG Found file content with type [${content.type}/${content.subtype}]")
|
||||||
contentIndex += 1
|
contentIndex += 1
|
||||||
|
|
@ -456,8 +461,6 @@ class MessageModel
|
||||||
Log.d(
|
Log.d(
|
||||||
"$TAG Found file ready to be displayed [$path] with MIME [${content.type}/${content.subtype}] for message [${chatMessage.messageId}]"
|
"$TAG Found file ready to be displayed [$path] with MIME [${content.type}/${content.subtype}] for message [${chatMessage.messageId}]"
|
||||||
)
|
)
|
||||||
|
|
||||||
val wrapBefore = exactly4Contents && contentIndex == 3
|
|
||||||
val fileSize = content.fileSize.toLong()
|
val fileSize = content.fileSize.toLong()
|
||||||
val timestamp = content.creationTimestamp
|
val timestamp = content.creationTimestamp
|
||||||
val fileModel = FileModel(
|
val fileModel = FileModel(
|
||||||
|
|
@ -496,7 +499,8 @@ class MessageModel
|
||||||
timestamp,
|
timestamp,
|
||||||
isFileEncrypted,
|
isFileEncrypted,
|
||||||
path,
|
path,
|
||||||
chatMessage.isEphemeral
|
chatMessage.isEphemeral,
|
||||||
|
flexboxLayoutWrapBefore = wrapBefore
|
||||||
) { model ->
|
) { model ->
|
||||||
onContentClicked?.invoke(model)
|
onContentClicked?.invoke(model)
|
||||||
}
|
}
|
||||||
|
|
@ -509,7 +513,8 @@ class MessageModel
|
||||||
isFileEncrypted,
|
isFileEncrypted,
|
||||||
name,
|
name,
|
||||||
chatMessage.isEphemeral,
|
chatMessage.isEphemeral,
|
||||||
isWaitingToBeDownloaded = true
|
isWaitingToBeDownloaded = true,
|
||||||
|
flexboxLayoutWrapBefore = wrapBefore
|
||||||
) { model ->
|
) { model ->
|
||||||
downloadContent(model, content)
|
downloadContent(model, content)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue