Skip to content

Commit

Permalink
show percentage on filetransfers
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Nov 1, 2024
1 parent f7dff3d commit fed403e
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions src/main/kotlin/com/zoffcc/applications/trifa2/ChatMessage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Outline
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.painter.BitmapPainter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.text.AnnotatedString
Expand Down Expand Up @@ -370,10 +371,19 @@ fun outgoing_filetransfer(message: UIMessage, ui_scale: Float)
// filetransfer finished (either because of CANCEL or OK) ------------
} else // TOX_FILE_CONTROL_RESUME
{
LinearProgressIndicator(
modifier = Modifier.fillMaxWidth(),
progress = (message.currentfilepos.toFloat() / message.filesize.toFloat())
)
Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically)
{
LinearProgressIndicator(
progress = {
(message.currentfilepos.toFloat() / message.filesize.toFloat())
},
strokeCap = StrokeCap.Round,
drawStopIndicator = {},
modifier = Modifier.weight(10.0f).height(8.dp),
)
Text(modifier = Modifier.width(70.dp).padding(start = 15.dp),
text = "" + ((message.currentfilepos.toFloat() / message.filesize.toFloat()) * 100.0f).toLong() + "%")
}
Column(modifier = Modifier.fillMaxWidth()) {
Spacer(Modifier.size(10.dp).align(Alignment.Start))
IconButton(
Expand All @@ -397,10 +407,20 @@ fun incoming_filetransfer(message: UIMessage, ui_scale: Float)
{
if (is_filetransfer_in_progress(message))
{
LinearProgressIndicator(
modifier = Modifier.fillMaxWidth(),
progress = (message.currentfilepos.toFloat() / message.filesize.toFloat())
)
Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically)
{
LinearProgressIndicator(
progress = {
(message.currentfilepos.toFloat() / message.filesize.toFloat())
},
strokeCap = StrokeCap.Round,
drawStopIndicator = {},
modifier = Modifier.weight(10.0f).height(8.dp),
)
Text(modifier = Modifier.width(70.dp).padding(start = 15.dp),
text = "" + ((message.currentfilepos.toFloat() / message.filesize.toFloat()) * 100.0f).toLong() + "%")
}

Column(modifier = Modifier.fillMaxWidth()) {
Spacer(Modifier.size(10.dp).align(Alignment.Start))
IconButton(
Expand Down

0 comments on commit fed403e

Please sign in to comment.