commit 432bbfc27f6422df639b38a299c52aa47ddf6de4
parent faa3415125190256095ce783fe8b65753936127e
Author: Iván Ávalos <avalos@disroot.org>
Date: Tue, 3 Feb 2026 18:54:04 +0100
[wallet] render new performance stats count
Diffstat:
2 files changed, 43 insertions(+), 20 deletions(-)
diff --git a/wallet/src/main/java/net/taler/wallet/stats/PerformanceFragment.kt b/wallet/src/main/java/net/taler/wallet/stats/PerformanceFragment.kt
@@ -21,6 +21,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
@@ -30,11 +31,13 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Refresh
+import androidx.compose.material3.Badge
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.ProvideTextStyle
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
@@ -45,6 +48,7 @@ import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
@@ -196,19 +200,32 @@ fun PerformanceStatItem(
},
headlineContent = {
- when(stat) {
- is PerformanceStat.HttpFetch -> Text(
- text = stat.url,
- style = MaterialTheme.typography.bodySmall,
- )
- is PerformanceStat.DbQuery -> Text(stat.name)
- is PerformanceStat.Crypto -> Text(stat.operation)
- is PerformanceStat.WalletRequest -> Text(stat.operation)
- is PerformanceStat.WalletTask -> Text(
- text = stat.taskId,
- style = MaterialTheme.typography.bodySmall,
- fontFamily = FontFamily.Monospace,
- )
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ verticalAlignment = Alignment.CenterVertically,
+
+ ) {
+ Box(Modifier.weight(1f, fill = false)) {
+ when (stat) {
+ is PerformanceStat.HttpFetch -> Text(
+ text = stat.url,
+ style = MaterialTheme.typography.bodySmall,
+ )
+
+ is PerformanceStat.DbQuery -> Text(stat.name)
+ is PerformanceStat.Crypto -> Text(stat.operation)
+ is PerformanceStat.WalletRequest -> Text(stat.operation)
+ is PerformanceStat.WalletTask -> Text(
+ text = stat.taskId,
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = FontFamily.Monospace,
+ )
+ }
+ }
+
+ Badge(Modifier.padding(start = 10.dp)) {
+ Text(stat.count.toString())
+ }
}
},
@@ -224,7 +241,7 @@ fun PerformanceStatItem(
},
trailingContent = {
- Text(stringResource(R.string.millisecond, stat.durationMs))
+ Text(stringResource(R.string.millisecond, stat.maxDurationMs))
},
)
}
\ No newline at end of file
diff --git a/wallet/src/main/java/net/taler/wallet/stats/PerformanceStats.kt b/wallet/src/main/java/net/taler/wallet/stats/PerformanceStats.kt
@@ -21,13 +21,15 @@ import kotlinx.serialization.Serializable
@Serializable
sealed class PerformanceStat {
- abstract val durationMs: Int
+ abstract val maxDurationMs: Int
+ abstract val count: Int
@Serializable
@SerialName("http-fetch")
data class HttpFetch(
val url: String,
- override val durationMs: Int,
+ override val maxDurationMs: Int,
+ override val count: Int,
): PerformanceStat()
@Serializable
@@ -35,28 +37,32 @@ sealed class PerformanceStat {
data class DbQuery(
val name: String,
val location: String,
- override val durationMs: Int,
+ override val maxDurationMs: Int,
+ override val count: Int,
): PerformanceStat()
@Serializable
@SerialName("crypto")
data class Crypto(
val operation: String,
- override val durationMs: Int,
+ override val maxDurationMs: Int,
+ override val count: Int,
): PerformanceStat()
@Serializable
@SerialName("wallet-request")
data class WalletRequest(
val operation: String,
- override val durationMs: Int,
+ override val maxDurationMs: Int,
+ override val count: Int,
): PerformanceStat()
@Serializable
@SerialName("wallet-task")
data class WalletTask(
val taskId: String,
- override val durationMs: Int,
+ override val maxDurationMs: Int,
+ override val count: Int,
): PerformanceStat()
}