|
@@ -3,7 +3,6 @@ package io.nexilis.alpha.ui.components
|
|
|
import android.graphics.BitmapFactory
|
|
|
import androidx.compose.foundation.Image
|
|
|
import androidx.compose.foundation.background
|
|
|
-import androidx.compose.foundation.layout.Box
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
import androidx.compose.foundation.layout.aspectRatio
|
|
@@ -134,7 +133,10 @@ fun ContentChat(modifier: Modifier = Modifier, message: Message) {
|
|
|
)
|
|
|
FileDesc(file = message.file_id)
|
|
|
}
|
|
|
- FileProgress(message = message)
|
|
|
+ FileProgress(
|
|
|
+ message = message,
|
|
|
+ modifier = Modifier.align(Alignment.CenterVertically)
|
|
|
+ )
|
|
|
}
|
|
|
val messageText = message.message_text.split("|").last()
|
|
|
if (messageText.isNotEmpty()) {
|
|
@@ -269,29 +271,27 @@ fun FileDesc(file: String, modifier: Modifier = Modifier) {
|
|
|
fun FileProgress(message: Message, modifier: Modifier = Modifier) {
|
|
|
val context = LocalContext.current
|
|
|
val progressViewModel: ProgressViewModel = hiltViewModel()
|
|
|
- Box {
|
|
|
- val progress by progressViewModel.get(message.message_id).observeAsState()
|
|
|
- progress?.let {
|
|
|
- if (it.value > 0f && it.value < 1f) {
|
|
|
- CircularProgressIndicator(
|
|
|
- progress = { it.value },
|
|
|
- modifier = modifier
|
|
|
- .size(32.dp),
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
- val file = File(context.filesDir, message.file_id)
|
|
|
- if (!file.exists()) {
|
|
|
- IconButton(
|
|
|
- onClick = { /*TODO*/ },
|
|
|
+ val progress by progressViewModel.get(message.message_id).observeAsState()
|
|
|
+ progress?.let {
|
|
|
+ if (it.value > 0f && it.value < 1f) {
|
|
|
+ CircularProgressIndicator(
|
|
|
+ progress = { it.value },
|
|
|
modifier = modifier
|
|
|
- ) {
|
|
|
- Icon(
|
|
|
- imageVector = Icons.Default.DownloadForOffline,
|
|
|
- contentDescription = null,
|
|
|
- tint = Color.LightGray
|
|
|
- )
|
|
|
- }
|
|
|
+ .size(32.dp),
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ val file = File(context.filesDir, message.file_id)
|
|
|
+ if (!file.exists()) {
|
|
|
+ IconButton(
|
|
|
+ onClick = { /*TODO*/ },
|
|
|
+ modifier = modifier
|
|
|
+ ) {
|
|
|
+ Icon(
|
|
|
+ imageVector = Icons.Default.DownloadForOffline,
|
|
|
+ contentDescription = null,
|
|
|
+ tint = Color.LightGray
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|