Albirew/tachiyomi
Archivé
1
0
Bifurcation 0

Count the downloads under each header instead of count the number of headers (#7990)

Cette révision appartient à :
Andreas 2022-09-11 19:11:50 +02:00 révisé par GitHub
Parent 3dea10bcb9
révision 0215b66098
Aucune clé n'a été trouvée pour cette signature dans la base de données
ID de la clé GPG: 4AEE18F83AFDEB23

Voir le fichier

@ -25,6 +25,7 @@ import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.rememberTopAppBarState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@ -106,6 +107,9 @@ class DownloadController :
override fun ComposeContent() {
val context = LocalContext.current
val downloadList by presenter.state.collectAsState()
val downloadCount by remember {
derivedStateOf { downloadList.sumOf { it.subItems.size } }
}
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState())
var fabExpanded by remember { mutableStateOf(true) }
@ -142,10 +146,10 @@ class DownloadController :
modifier = Modifier.weight(1f, false),
overflow = TextOverflow.Ellipsis,
)
if (downloadList.isNotEmpty()) {
if (downloadCount > 0) {
val pillAlpha = if (isSystemInDarkTheme()) 0.12f else 0.08f
Pill(
text = "${downloadList.size}",
text = "$downloadCount",
modifier = Modifier.padding(start = 4.dp),
color = MaterialTheme.colorScheme.onBackground
.copy(alpha = pillAlpha),