mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
MoreScreen: Remove title (#8158)
* MoreScreen: Remove title Also removes the state banners as it's redundant * Add back banners
This commit is contained in:
parent
5f8252447f
commit
cf6407c4d4
3 changed files with 116 additions and 117 deletions
|
@ -1,7 +1,7 @@
|
||||||
package eu.kanade.presentation.components
|
package eu.kanade.presentation.components
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.ColumnScope
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
@ -14,15 +14,18 @@ import androidx.compose.ui.unit.dp
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ColumnScope.AppStateBanners(
|
fun AppStateBanners(
|
||||||
downloadedOnlyMode: Boolean,
|
downloadedOnlyMode: Boolean,
|
||||||
incognitoMode: Boolean,
|
incognitoMode: Boolean,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
if (downloadedOnlyMode) {
|
Column(modifier = modifier) {
|
||||||
DownloadedOnlyModeBanner()
|
if (downloadedOnlyMode) {
|
||||||
}
|
DownloadedOnlyModeBanner()
|
||||||
if (incognitoMode) {
|
}
|
||||||
IncognitoModeBanner()
|
if (incognitoMode) {
|
||||||
|
IncognitoModeBanner()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
@ -16,19 +16,18 @@ import eu.kanade.tachiyomi.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LogoHeader() {
|
fun LogoHeader() {
|
||||||
Column {
|
Column(
|
||||||
Surface(
|
modifier = Modifier.fillMaxWidth(),
|
||||||
modifier = Modifier.fillMaxWidth(),
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(R.drawable.ic_tachi),
|
painter = painterResource(R.drawable.ic_tachi),
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colorScheme.onSurface,
|
tint = MaterialTheme.colorScheme.onSurface,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(32.dp)
|
.padding(vertical = 56.dp)
|
||||||
.size(56.dp),
|
.size(64.dp),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
Divider()
|
Divider()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.kanade.presentation.more
|
package eu.kanade.presentation.more
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.statusBarsPadding
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.CloudOff
|
import androidx.compose.material.icons.outlined.CloudOff
|
||||||
import androidx.compose.material.icons.outlined.GetApp
|
import androidx.compose.material.icons.outlined.GetApp
|
||||||
|
@ -11,18 +12,17 @@ import androidx.compose.material.icons.outlined.SettingsBackupRestore
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.vector.rememberVectorPainter
|
import androidx.compose.ui.graphics.vector.rememberVectorPainter
|
||||||
import androidx.compose.ui.platform.LocalUriHandler
|
import androidx.compose.ui.platform.LocalUriHandler
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import eu.kanade.presentation.components.AppBar
|
import eu.kanade.presentation.components.AppStateBanners
|
||||||
import eu.kanade.presentation.components.Divider
|
import eu.kanade.presentation.components.Divider
|
||||||
import eu.kanade.presentation.components.PreferenceRow
|
import eu.kanade.presentation.components.PreferenceRow
|
||||||
import eu.kanade.presentation.components.Scaffold
|
|
||||||
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
||||||
import eu.kanade.presentation.components.SwitchPreference
|
import eu.kanade.presentation.components.SwitchPreference
|
||||||
import eu.kanade.presentation.util.bottomNavPaddingValues
|
import eu.kanade.presentation.util.bottomNavPaddingValues
|
||||||
import eu.kanade.presentation.util.plus
|
|
||||||
import eu.kanade.presentation.util.quantityStringResource
|
import eu.kanade.presentation.util.quantityStringResource
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.ui.more.DownloadQueueState
|
import eu.kanade.tachiyomi.ui.more.DownloadQueueState
|
||||||
|
@ -41,108 +41,105 @@ fun MoreScreen(
|
||||||
val uriHandler = LocalUriHandler.current
|
val uriHandler = LocalUriHandler.current
|
||||||
val downloadQueueState by presenter.downloadQueueState.collectAsState()
|
val downloadQueueState by presenter.downloadQueueState.collectAsState()
|
||||||
|
|
||||||
Scaffold(
|
ScrollbarLazyColumn(
|
||||||
topBar = { scrollBehavior ->
|
modifier = Modifier.statusBarsPadding(),
|
||||||
AppBar(
|
contentPadding = bottomNavPaddingValues,
|
||||||
title = stringResource(R.string.label_more),
|
) {
|
||||||
|
item {
|
||||||
|
LogoHeader()
|
||||||
|
}
|
||||||
|
|
||||||
|
item {
|
||||||
|
AppStateBanners(
|
||||||
downloadedOnlyMode = presenter.downloadedOnly.value,
|
downloadedOnlyMode = presenter.downloadedOnly.value,
|
||||||
incognitoMode = presenter.incognitoMode.value,
|
incognitoMode = presenter.incognitoMode.value,
|
||||||
scrollBehavior = scrollBehavior,
|
|
||||||
)
|
)
|
||||||
},
|
}
|
||||||
) { contentPadding ->
|
|
||||||
ScrollbarLazyColumn(
|
|
||||||
contentPadding = contentPadding + bottomNavPaddingValues,
|
|
||||||
) {
|
|
||||||
item {
|
|
||||||
LogoHeader()
|
|
||||||
}
|
|
||||||
|
|
||||||
item {
|
item {
|
||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
preference = presenter.downloadedOnly,
|
preference = presenter.downloadedOnly,
|
||||||
title = stringResource(R.string.label_downloaded_only),
|
title = stringResource(R.string.label_downloaded_only),
|
||||||
subtitle = stringResource(R.string.downloaded_only_summary),
|
subtitle = stringResource(R.string.downloaded_only_summary),
|
||||||
painter = rememberVectorPainter(Icons.Outlined.CloudOff),
|
painter = rememberVectorPainter(Icons.Outlined.CloudOff),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
item {
|
item {
|
||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
preference = presenter.incognitoMode,
|
preference = presenter.incognitoMode,
|
||||||
title = stringResource(R.string.pref_incognito_mode),
|
title = stringResource(R.string.pref_incognito_mode),
|
||||||
subtitle = stringResource(R.string.pref_incognito_mode_summary),
|
subtitle = stringResource(R.string.pref_incognito_mode_summary),
|
||||||
painter = painterResource(R.drawable.ic_glasses_24dp),
|
painter = painterResource(R.drawable.ic_glasses_24dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
item { Divider() }
|
item { Divider() }
|
||||||
|
|
||||||
item {
|
item {
|
||||||
PreferenceRow(
|
PreferenceRow(
|
||||||
title = stringResource(R.string.label_download_queue),
|
title = stringResource(R.string.label_download_queue),
|
||||||
subtitle = when (downloadQueueState) {
|
subtitle = when (downloadQueueState) {
|
||||||
DownloadQueueState.Stopped -> null
|
DownloadQueueState.Stopped -> null
|
||||||
is DownloadQueueState.Paused -> {
|
is DownloadQueueState.Paused -> {
|
||||||
val pending = (downloadQueueState as DownloadQueueState.Paused).pending
|
val pending = (downloadQueueState as DownloadQueueState.Paused).pending
|
||||||
if (pending == 0) {
|
if (pending == 0) {
|
||||||
stringResource(R.string.paused)
|
stringResource(R.string.paused)
|
||||||
} else {
|
} else {
|
||||||
"${stringResource(R.string.paused)} • ${
|
"${stringResource(R.string.paused)} • ${
|
||||||
quantityStringResource(
|
quantityStringResource(
|
||||||
R.plurals.download_queue_summary,
|
R.plurals.download_queue_summary,
|
||||||
pending,
|
pending,
|
||||||
pending,
|
pending,
|
||||||
)
|
)
|
||||||
}"
|
}"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
is DownloadQueueState.Downloading -> {
|
}
|
||||||
val pending = (downloadQueueState as DownloadQueueState.Downloading).pending
|
is DownloadQueueState.Downloading -> {
|
||||||
quantityStringResource(R.plurals.download_queue_summary, pending, pending)
|
val pending = (downloadQueueState as DownloadQueueState.Downloading).pending
|
||||||
}
|
quantityStringResource(R.plurals.download_queue_summary, pending, pending)
|
||||||
},
|
}
|
||||||
painter = rememberVectorPainter(Icons.Outlined.GetApp),
|
},
|
||||||
onClick = onClickDownloadQueue,
|
painter = rememberVectorPainter(Icons.Outlined.GetApp),
|
||||||
)
|
onClick = onClickDownloadQueue,
|
||||||
}
|
)
|
||||||
item {
|
}
|
||||||
PreferenceRow(
|
item {
|
||||||
title = stringResource(R.string.categories),
|
PreferenceRow(
|
||||||
painter = rememberVectorPainter(Icons.Outlined.Label),
|
title = stringResource(R.string.categories),
|
||||||
onClick = onClickCategories,
|
painter = rememberVectorPainter(Icons.Outlined.Label),
|
||||||
)
|
onClick = onClickCategories,
|
||||||
}
|
)
|
||||||
item {
|
}
|
||||||
PreferenceRow(
|
item {
|
||||||
title = stringResource(R.string.label_backup),
|
PreferenceRow(
|
||||||
painter = rememberVectorPainter(Icons.Outlined.SettingsBackupRestore),
|
title = stringResource(R.string.label_backup),
|
||||||
onClick = onClickBackupAndRestore,
|
painter = rememberVectorPainter(Icons.Outlined.SettingsBackupRestore),
|
||||||
)
|
onClick = onClickBackupAndRestore,
|
||||||
}
|
)
|
||||||
|
}
|
||||||
|
|
||||||
item { Divider() }
|
item { Divider() }
|
||||||
|
|
||||||
item {
|
item {
|
||||||
PreferenceRow(
|
PreferenceRow(
|
||||||
title = stringResource(R.string.label_settings),
|
title = stringResource(R.string.label_settings),
|
||||||
painter = rememberVectorPainter(Icons.Outlined.Settings),
|
painter = rememberVectorPainter(Icons.Outlined.Settings),
|
||||||
onClick = onClickSettings,
|
onClick = onClickSettings,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
item {
|
item {
|
||||||
PreferenceRow(
|
PreferenceRow(
|
||||||
title = stringResource(R.string.pref_category_about),
|
title = stringResource(R.string.pref_category_about),
|
||||||
painter = rememberVectorPainter(Icons.Outlined.Info),
|
painter = rememberVectorPainter(Icons.Outlined.Info),
|
||||||
onClick = onClickAbout,
|
onClick = onClickAbout,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
item {
|
item {
|
||||||
PreferenceRow(
|
PreferenceRow(
|
||||||
title = stringResource(R.string.label_help),
|
title = stringResource(R.string.label_help),
|
||||||
painter = rememberVectorPainter(Icons.Outlined.HelpOutline),
|
painter = rememberVectorPainter(Icons.Outlined.HelpOutline),
|
||||||
onClick = { uriHandler.openUri(MoreController.URL_HELP) },
|
onClick = { uriHandler.openUri(MoreController.URL_HELP) },
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue