Simple attachments in messages history (#164)
* new attachments in messages history - photo, video, audio, file, link * improve attachments in messages history and adjusted font size for logo's text in auth screen * audio duration, file preview and url preview are now visible in attachments in messages history screen * make MessageBubble width adapt to attachments container width * topbar back icon crossfade animation * implement rich text for message input * handle click and long click on attachments * added click and long click handlers for attachments in message bubbles * enabled opening photos, files, and links when clicked. * implemented basic long-click logging for photos. * handled back press to return to Conversations from other tabs. * corrected the logic for filtering and selecting video images. * updated string resources for attachments, including a new "Clip" string. * make MessageBubble mention text underline on out messages
This commit is contained in:
-67
@@ -1,67 +0,0 @@
|
||||
package dev.meloda.fast.chatmaterials.presentation
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import coil.compose.AsyncImage
|
||||
import dev.meloda.fast.chatmaterials.model.UiChatMaterial
|
||||
|
||||
@Composable
|
||||
fun ChatMaterialItem(
|
||||
item: UiChatMaterial,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
when (item) {
|
||||
is UiChatMaterial.Photo -> {
|
||||
AsyncImage(
|
||||
model = item.previewUrl,
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.aspectRatio(1f)
|
||||
.clickable(onClick = onClick)
|
||||
)
|
||||
}
|
||||
|
||||
is UiChatMaterial.Video -> {
|
||||
AsyncImage(
|
||||
model = item.previewUrl,
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.aspectRatio(1f)
|
||||
)
|
||||
}
|
||||
|
||||
is UiChatMaterial.Audio -> {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Text(
|
||||
text = item.title,
|
||||
style = MaterialTheme.typography.bodyLarge
|
||||
)
|
||||
Text(text = item.artist)
|
||||
}
|
||||
|
||||
Text(text = item.duration)
|
||||
}
|
||||
}
|
||||
|
||||
is UiChatMaterial.File -> {}
|
||||
|
||||
is UiChatMaterial.Link -> {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user