move to SettingsDataScreen

This commit is contained in:
semenvav 2023-11-02 00:35:50 +02:00
parent 46d2e025b7
commit a87d3a23d4
3 changed files with 8 additions and 11 deletions

View File

@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.layout.windowInsetsPadding
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.FileDownloadDone
import androidx.compose.material.icons.outlined.GetApp import androidx.compose.material.icons.outlined.GetApp
import androidx.compose.material.icons.outlined.HelpOutline import androidx.compose.material.icons.outlined.HelpOutline
import androidx.compose.material.icons.outlined.Info import androidx.compose.material.icons.outlined.Info
@ -49,7 +48,6 @@ fun MoreScreen(
onClickDataAndStorage: () -> Unit, onClickDataAndStorage: () -> Unit,
onClickSettings: () -> Unit, onClickSettings: () -> Unit,
onClickAbout: () -> Unit, onClickAbout: () -> Unit,
onClickDownloadState: () -> Unit,
) { ) {
val uriHandler = LocalUriHandler.current val uriHandler = LocalUriHandler.current
@ -141,13 +139,6 @@ fun MoreScreen(
onPreferenceClick = onClickStats, onPreferenceClick = onClickStats,
) )
} }
item {
TextPreferenceWidget(
title = stringResource(R.string.label_download_stats),
icon = Icons.Outlined.FileDownloadDone,
onPreferenceClick = onClickDownloadState,
)
}
item { item {
TextPreferenceWidget( TextPreferenceWidget(
title = stringResource(R.string.label_data_storage), title = stringResource(R.string.label_data_storage),

View File

@ -34,6 +34,9 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.more.download.DownloadStatsScreen
import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.more.settings.Preference
import eu.kanade.presentation.more.settings.widget.BasePreferenceWidget import eu.kanade.presentation.more.settings.widget.BasePreferenceWidget
import eu.kanade.presentation.more.settings.widget.PrefsHorizontalPadding import eu.kanade.presentation.more.settings.widget.PrefsHorizontalPadding
@ -377,6 +380,7 @@ object SettingsDataScreen : SearchableSettings {
val scope = rememberCoroutineScope() val scope = rememberCoroutineScope()
val context = LocalContext.current val context = LocalContext.current
val libraryPreferences = remember { Injekt.get<LibraryPreferences>() } val libraryPreferences = remember { Injekt.get<LibraryPreferences>() }
val navigator = LocalNavigator.currentOrThrow
val chapterCache = remember { Injekt.get<ChapterCache>() } val chapterCache = remember { Injekt.get<ChapterCache>() }
var cacheReadableSizeSema by remember { mutableIntStateOf(0) } var cacheReadableSizeSema by remember { mutableIntStateOf(0) }
@ -409,6 +413,10 @@ object SettingsDataScreen : SearchableSettings {
pref = libraryPreferences.autoClearChapterCache(), pref = libraryPreferences.autoClearChapterCache(),
title = stringResource(R.string.pref_auto_clear_chapter_cache), title = stringResource(R.string.pref_auto_clear_chapter_cache),
), ),
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.label_download_stats),
onClick = { navigator.push(DownloadStatsScreen()) }
)
), ),
) )
} }

View File

@ -20,7 +20,6 @@ import cafe.adriel.voyager.navigator.tab.TabOptions
import eu.kanade.core.preference.asState import eu.kanade.core.preference.asState
import eu.kanade.domain.base.BasePreferences import eu.kanade.domain.base.BasePreferences
import eu.kanade.presentation.more.MoreScreen import eu.kanade.presentation.more.MoreScreen
import eu.kanade.presentation.more.download.DownloadStatsScreen
import eu.kanade.presentation.util.Tab import eu.kanade.presentation.util.Tab
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadManager
@ -75,7 +74,6 @@ object MoreTab : Tab {
onClickDataAndStorage = { navigator.push(SettingsScreen.toDataAndStorageScreen()) }, onClickDataAndStorage = { navigator.push(SettingsScreen.toDataAndStorageScreen()) },
onClickSettings = { navigator.push(SettingsScreen.toMainScreen()) }, onClickSettings = { navigator.push(SettingsScreen.toMainScreen()) },
onClickAbout = { navigator.push(SettingsScreen.toAboutScreen()) }, onClickAbout = { navigator.push(SettingsScreen.toAboutScreen()) },
onClickDownloadState = { navigator.push(DownloadStatsScreen()) },
) )
} }
} }