Adjust stats overview icons

Closes #9865
Still sort of weird, but the icons are now always aligned.
This commit is contained in:
arkon 2023-11-26 18:45:16 -05:00
parent bf524595e2
commit 9ce0bc6b5f
2 changed files with 17 additions and 7 deletions

View file

@ -1,8 +1,10 @@
package eu.kanade.presentation.more.stats package eu.kanade.presentation.more.stats
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
@ -12,6 +14,7 @@ import androidx.compose.material.icons.outlined.Schedule
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import eu.kanade.presentation.more.stats.components.StatsItem import eu.kanade.presentation.more.stats.components.StatsItem
import eu.kanade.presentation.more.stats.components.StatsOverviewItem import eu.kanade.presentation.more.stats.components.StatsOverviewItem
@ -63,22 +66,24 @@ private fun OverviewSection(
.toDurationString(context, fallback = none) .toDurationString(context, fallback = none)
} }
StatsSection(MR.strings.label_overview_section) { StatsSection(MR.strings.label_overview_section) {
Row { Row(
modifier = Modifier.height(IntrinsicSize.Min),
) {
StatsOverviewItem( StatsOverviewItem(
title = data.libraryMangaCount.toString(), title = data.libraryMangaCount.toString(),
subtitle = stringResource(MR.strings.in_library), subtitle = stringResource(MR.strings.in_library),
icon = Icons.Outlined.CollectionsBookmark, icon = Icons.Outlined.CollectionsBookmark,
) )
StatsOverviewItem(
title = data.completedMangaCount.toString(),
subtitle = stringResource(MR.strings.label_completed_titles),
icon = Icons.Outlined.LocalLibrary,
)
StatsOverviewItem( StatsOverviewItem(
title = readDurationString, title = readDurationString,
subtitle = stringResource(MR.strings.label_read_duration), subtitle = stringResource(MR.strings.label_read_duration),
icon = Icons.Outlined.Schedule, icon = Icons.Outlined.Schedule,
) )
StatsOverviewItem(
title = data.completedMangaCount.toString(),
subtitle = stringResource(MR.strings.label_completed_titles),
icon = Icons.Outlined.LocalLibrary,
)
} }
} }
} }

View file

@ -3,6 +3,8 @@ package eu.kanade.presentation.more.stats.components
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
@ -53,7 +55,9 @@ private fun RowScope.BaseStatsItem(
icon: ImageVector? = null, icon: ImageVector? = null,
) { ) {
Column( Column(
modifier = Modifier.weight(1f), modifier = Modifier
.weight(1f)
.fillMaxHeight(),
verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small),
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
) { ) {
@ -74,6 +78,7 @@ private fun RowScope.BaseStatsItem(
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
) )
if (icon != null) { if (icon != null) {
Spacer(modifier = Modifier.weight(1f))
Icon( Icon(
imageVector = icon, imageVector = icon,
contentDescription = null, contentDescription = null,