mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-29 09:39:03 +03:00
Here lies "currentTab was used multiple times"
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
parent
9863bdc631
commit
111db99aff
21 changed files with 118 additions and 77 deletions
|
@ -25,7 +25,7 @@ enum class NavStyle(
|
||||||
MOVE_MANGA_TO_MORE(titleRes = MR.strings.pref_bottom_nav_no_manga, moreTab = MangaLibraryTab),
|
MOVE_MANGA_TO_MORE(titleRes = MR.strings.pref_bottom_nav_no_manga, moreTab = MangaLibraryTab),
|
||||||
MOVE_UPDATES_TO_MORE(titleRes = MR.strings.pref_bottom_nav_no_updates, moreTab = UpdatesTab),
|
MOVE_UPDATES_TO_MORE(titleRes = MR.strings.pref_bottom_nav_no_updates, moreTab = UpdatesTab),
|
||||||
MOVE_HISTORY_TO_MORE(titleRes = MR.strings.pref_bottom_nav_no_history, moreTab = HistoriesTab),
|
MOVE_HISTORY_TO_MORE(titleRes = MR.strings.pref_bottom_nav_no_history, moreTab = HistoriesTab),
|
||||||
MOVE_BROWSE_TO_MORE(titleRes = MR.strings.pref_bottom_nav_no_browse, moreTab = BrowseTab()),
|
MOVE_BROWSE_TO_MORE(titleRes = MR.strings.pref_bottom_nav_no_browse, moreTab = BrowseTab),
|
||||||
;
|
;
|
||||||
|
|
||||||
val moreIcon: ImageVector
|
val moreIcon: ImageVector
|
||||||
|
@ -44,7 +44,7 @@ enum class NavStyle(
|
||||||
MangaLibraryTab,
|
MangaLibraryTab,
|
||||||
UpdatesTab,
|
UpdatesTab,
|
||||||
HistoriesTab,
|
HistoriesTab,
|
||||||
BrowseTab(),
|
BrowseTab,
|
||||||
MoreTab,
|
MoreTab,
|
||||||
).apply { remove(this@NavStyle.moreTab) }
|
).apply { remove(this@NavStyle.moreTab) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,5 +14,5 @@ enum class StartScreen(val titleRes: StringResource, val tab: Tab) {
|
||||||
MANGA(MR.strings.manga, MangaLibraryTab),
|
MANGA(MR.strings.manga, MangaLibraryTab),
|
||||||
UPDATES(MR.strings.label_recent_updates, UpdatesTab),
|
UPDATES(MR.strings.label_recent_updates, UpdatesTab),
|
||||||
HISTORY(MR.strings.label_recent_manga, HistoriesTab),
|
HISTORY(MR.strings.label_recent_manga, HistoriesTab),
|
||||||
BROWSE(MR.strings.browse, BrowseTab()),
|
BROWSE(MR.strings.browse, BrowseTab),
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.calculateStartPadding
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.pager.HorizontalPager
|
import androidx.compose.foundation.pager.HorizontalPager
|
||||||
|
import androidx.compose.foundation.pager.PagerState
|
||||||
import androidx.compose.foundation.pager.rememberPagerState
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.PrimaryTabRow
|
import androidx.compose.material3.PrimaryTabRow
|
||||||
|
@ -36,7 +37,7 @@ fun TabbedScreen(
|
||||||
titleRes: StringResource?,
|
titleRes: StringResource?,
|
||||||
tabs: ImmutableList<TabContent>,
|
tabs: ImmutableList<TabContent>,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
startIndex: Int? = null,
|
state: PagerState = rememberPagerState { tabs.size },
|
||||||
mangaSearchQuery: String? = null,
|
mangaSearchQuery: String? = null,
|
||||||
onChangeMangaSearchQuery: (String?) -> Unit = {},
|
onChangeMangaSearchQuery: (String?) -> Unit = {},
|
||||||
scrollable: Boolean = false,
|
scrollable: Boolean = false,
|
||||||
|
@ -45,15 +46,8 @@ fun TabbedScreen(
|
||||||
|
|
||||||
) {
|
) {
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
val state = rememberPagerState { tabs.size }
|
|
||||||
val snackbarHostState = remember { SnackbarHostState() }
|
val snackbarHostState = remember { SnackbarHostState() }
|
||||||
|
|
||||||
LaunchedEffect(startIndex) {
|
|
||||||
if (startIndex != null) {
|
|
||||||
state.scrollToPage(startIndex)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
if (titleRes != null) {
|
if (titleRes != null) {
|
||||||
|
|
|
@ -295,7 +295,7 @@ object SettingsDataScreen : SearchableSettings {
|
||||||
title = stringResource(MR.strings.label_storage),
|
title = stringResource(MR.strings.label_storage),
|
||||||
icon = Icons.Outlined.Storage,
|
icon = Icons.Outlined.Storage,
|
||||||
onClick = {
|
onClick = {
|
||||||
navigator.push(StorageTab())
|
navigator.push(StorageTab)
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
||||||
count = userAnimeCategoriesCount,
|
count = userAnimeCategoriesCount,
|
||||||
userAnimeCategoriesCount,
|
userAnimeCategoriesCount,
|
||||||
),
|
),
|
||||||
onClick = { navigator.push(CategoriesTab(false)) },
|
onClick = { navigator.push(CategoriesTab) },
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
pref = libraryPreferences.defaultAnimeCategory(),
|
pref = libraryPreferences.defaultAnimeCategory(),
|
||||||
|
@ -117,7 +117,10 @@ object SettingsLibraryScreen : SearchableSettings {
|
||||||
count = userCategoriesCount,
|
count = userCategoriesCount,
|
||||||
userCategoriesCount,
|
userCategoriesCount,
|
||||||
),
|
),
|
||||||
onClick = { navigator.push(CategoriesTab(true)) },
|
onClick = {
|
||||||
|
navigator.push(CategoriesTab)
|
||||||
|
CategoriesTab.showMangaCategory()
|
||||||
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
pref = libraryPreferences.defaultMangaCategory(),
|
pref = libraryPreferences.defaultMangaCategory(),
|
||||||
|
|
|
@ -36,10 +36,8 @@ val LocalBackPress: ProvidableCompositionLocal<(() -> Unit)?> = staticCompositio
|
||||||
|
|
||||||
private val uiPreferences: UiPreferences = Injekt.get()
|
private val uiPreferences: UiPreferences = Injekt.get()
|
||||||
|
|
||||||
abstract class Tab : cafe.adriel.voyager.navigator.tab.Tab {
|
interface Tab : cafe.adriel.voyager.navigator.tab.Tab {
|
||||||
|
suspend fun onReselect(navigator: Navigator) {}
|
||||||
override val key: ScreenKey = uniqueScreenKey
|
|
||||||
open suspend fun onReselect(navigator: Navigator) {}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun currentNavigationStyle(): NavStyle = uiPreferences.navStyle().collectAsState().value
|
fun currentNavigationStyle(): NavStyle = uiPreferences.navStyle().collectAsState().value
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.browse
|
||||||
import androidx.compose.animation.graphics.res.animatedVectorResource
|
import androidx.compose.animation.graphics.res.animatedVectorResource
|
||||||
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
|
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
|
||||||
import androidx.compose.animation.graphics.vector.AnimatedImageVector
|
import androidx.compose.animation.graphics.vector.AnimatedImageVector
|
||||||
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
|
@ -26,12 +27,14 @@ import eu.kanade.tachiyomi.ui.browse.manga.migration.sources.migrateMangaSourceT
|
||||||
import eu.kanade.tachiyomi.ui.browse.manga.source.mangaSourcesTab
|
import eu.kanade.tachiyomi.ui.browse.manga.source.mangaSourcesTab
|
||||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
|
import kotlinx.coroutines.channels.BufferOverflow
|
||||||
|
import kotlinx.coroutines.channels.Channel
|
||||||
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.flow.receiveAsFlow
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
data class BrowseTab(
|
data object BrowseTab : Tab {
|
||||||
private val toExtensions: Boolean = false,
|
|
||||||
) : Tab() {
|
|
||||||
|
|
||||||
override val options: TabOptions
|
override val options: TabOptions
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -50,6 +53,12 @@ data class BrowseTab(
|
||||||
navigator.push(GlobalAnimeSearchScreen())
|
navigator.push(GlobalAnimeSearchScreen())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val switchToExtensionTabChannel = Channel<Unit>(1, BufferOverflow.DROP_OLDEST)
|
||||||
|
|
||||||
|
fun showExtension() {
|
||||||
|
switchToExtensionTabChannel.trySend(Unit)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun Content() {
|
override fun Content() {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
@ -61,23 +70,31 @@ data class BrowseTab(
|
||||||
val animeExtensionsScreenModel = rememberScreenModel { AnimeExtensionsScreenModel() }
|
val animeExtensionsScreenModel = rememberScreenModel { AnimeExtensionsScreenModel() }
|
||||||
val animeExtensionsState by animeExtensionsScreenModel.state.collectAsState()
|
val animeExtensionsState by animeExtensionsScreenModel.state.collectAsState()
|
||||||
|
|
||||||
TabbedScreen(
|
val tabs = persistentListOf(
|
||||||
titleRes = MR.strings.browse,
|
|
||||||
tabs = persistentListOf(
|
|
||||||
animeSourcesTab(),
|
animeSourcesTab(),
|
||||||
mangaSourcesTab(),
|
mangaSourcesTab(),
|
||||||
animeExtensionsTab(animeExtensionsScreenModel),
|
animeExtensionsTab(animeExtensionsScreenModel),
|
||||||
mangaExtensionsTab(mangaExtensionsScreenModel),
|
mangaExtensionsTab(mangaExtensionsScreenModel),
|
||||||
migrateAnimeSourceTab(),
|
migrateAnimeSourceTab(),
|
||||||
migrateMangaSourceTab(),
|
migrateMangaSourceTab(),
|
||||||
),
|
)
|
||||||
startIndex = 2.takeIf { toExtensions },
|
|
||||||
|
val state = rememberPagerState { tabs.size }
|
||||||
|
|
||||||
|
TabbedScreen(
|
||||||
|
titleRes = MR.strings.browse,
|
||||||
|
tabs = tabs,
|
||||||
|
state = state,
|
||||||
mangaSearchQuery = mangaExtensionsState.searchQuery,
|
mangaSearchQuery = mangaExtensionsState.searchQuery,
|
||||||
onChangeMangaSearchQuery = mangaExtensionsScreenModel::search,
|
onChangeMangaSearchQuery = mangaExtensionsScreenModel::search,
|
||||||
animeSearchQuery = animeExtensionsState.searchQuery,
|
animeSearchQuery = animeExtensionsState.searchQuery,
|
||||||
onChangeAnimeSearchQuery = animeExtensionsScreenModel::search,
|
onChangeAnimeSearchQuery = animeExtensionsScreenModel::search,
|
||||||
scrollable = true,
|
scrollable = true,
|
||||||
)
|
)
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
switchToExtensionTabChannel.receiveAsFlow()
|
||||||
|
.collectLatest { state.scrollToPage(1) }
|
||||||
|
}
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
(context as? MainActivity)?.ready = true
|
(context as? MainActivity)?.ready = true
|
||||||
|
|
|
@ -291,7 +291,7 @@ data class BrowseAnimeSourceScreen(
|
||||||
ChangeCategoryDialog(
|
ChangeCategoryDialog(
|
||||||
initialSelection = dialog.initialSelection,
|
initialSelection = dialog.initialSelection,
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
onEditCategories = { navigator.push(CategoriesTab(false)) },
|
onEditCategories = { navigator.push(CategoriesTab) },
|
||||||
onConfirm = { include, _ ->
|
onConfirm = { include, _ ->
|
||||||
screenModel.changeAnimeFavorite(dialog.anime)
|
screenModel.changeAnimeFavorite(dialog.anime)
|
||||||
screenModel.moveAnimeToCategories(dialog.anime, include)
|
screenModel.moveAnimeToCategories(dialog.anime, include)
|
||||||
|
|
|
@ -291,7 +291,10 @@ data class BrowseMangaSourceScreen(
|
||||||
ChangeCategoryDialog(
|
ChangeCategoryDialog(
|
||||||
initialSelection = dialog.initialSelection,
|
initialSelection = dialog.initialSelection,
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
onEditCategories = { navigator.push(CategoriesTab(true)) },
|
onEditCategories = {
|
||||||
|
navigator.push(CategoriesTab)
|
||||||
|
CategoriesTab.showMangaCategory()
|
||||||
|
},
|
||||||
onConfirm = { include, _ ->
|
onConfirm = { include, _ ->
|
||||||
screenModel.changeMangaFavorite(dialog.manga)
|
screenModel.changeMangaFavorite(dialog.manga)
|
||||||
screenModel.moveMangaToCategories(dialog.manga, include)
|
screenModel.moveMangaToCategories(dialog.manga, include)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.category
|
||||||
import androidx.compose.animation.graphics.res.animatedVectorResource
|
import androidx.compose.animation.graphics.res.animatedVectorResource
|
||||||
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
|
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
|
||||||
import androidx.compose.animation.graphics.vector.AnimatedImageVector
|
import androidx.compose.animation.graphics.vector.AnimatedImageVector
|
||||||
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
@ -21,13 +22,14 @@ import eu.kanade.tachiyomi.ui.category.manga.mangaCategoryTab
|
||||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
|
import kotlinx.coroutines.channels.BufferOverflow
|
||||||
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.flow.receiveAsFlow
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
data class CategoriesTab(
|
data object CategoriesTab : Tab {
|
||||||
private val isManga: Boolean = false,
|
|
||||||
) : Tab() {
|
|
||||||
|
|
||||||
override val options: TabOptions
|
override val options: TabOptions
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -41,6 +43,12 @@ data class CategoriesTab(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val switchToMangaCategoryTabChannel = Channel<Unit>(1, BufferOverflow.DROP_OLDEST)
|
||||||
|
|
||||||
|
fun showMangaCategory() {
|
||||||
|
switchToMangaCategoryTabChannel.trySend(Unit)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun Content() {
|
override fun Content() {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
@ -48,15 +56,23 @@ data class CategoriesTab(
|
||||||
val animeCategoryScreenModel = rememberScreenModel { AnimeCategoryScreenModel() }
|
val animeCategoryScreenModel = rememberScreenModel { AnimeCategoryScreenModel() }
|
||||||
val mangaCategoryScreenModel = rememberScreenModel { MangaCategoryScreenModel() }
|
val mangaCategoryScreenModel = rememberScreenModel { MangaCategoryScreenModel() }
|
||||||
|
|
||||||
TabbedScreen(
|
val tabs = persistentListOf(
|
||||||
titleRes = MR.strings.general_categories,
|
|
||||||
tabs = persistentListOf(
|
|
||||||
animeCategoryTab(),
|
animeCategoryTab(),
|
||||||
mangaCategoryTab(),
|
mangaCategoryTab(),
|
||||||
),
|
|
||||||
startIndex = 1.takeIf { isManga },
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val state = rememberPagerState { tabs.size }
|
||||||
|
|
||||||
|
TabbedScreen(
|
||||||
|
titleRes = MR.strings.general_categories,
|
||||||
|
tabs = tabs,
|
||||||
|
state = state,
|
||||||
|
)
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
switchToMangaCategoryTabChannel.receiveAsFlow()
|
||||||
|
.collectLatest { state.scrollToPage(1) }
|
||||||
|
}
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
(context as? MainActivity)?.ready = true
|
(context as? MainActivity)?.ready = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,9 +74,7 @@ import tachiyomi.presentation.core.components.material.Scaffold
|
||||||
import tachiyomi.presentation.core.components.material.TabText
|
import tachiyomi.presentation.core.components.material.TabText
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
data class DownloadsTab(
|
data object DownloadsTab : Tab {
|
||||||
private val isManga: Boolean = false,
|
|
||||||
) : Tab() {
|
|
||||||
|
|
||||||
override val options: TabOptions
|
override val options: TabOptions
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
@ -208,7 +208,7 @@ class AnimeScreen(
|
||||||
ChangeCategoryDialog(
|
ChangeCategoryDialog(
|
||||||
initialSelection = dialog.initialSelection,
|
initialSelection = dialog.initialSelection,
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
onEditCategories = { navigator.push(CategoriesTab(false)) },
|
onEditCategories = { navigator.push(CategoriesTab) },
|
||||||
onConfirm = { include, _ ->
|
onConfirm = { include, _ ->
|
||||||
screenModel.moveAnimeToCategoriesAndAddToLibrary(dialog.anime, include)
|
screenModel.moveAnimeToCategoriesAndAddToLibrary(dialog.anime, include)
|
||||||
},
|
},
|
||||||
|
|
|
@ -189,7 +189,10 @@ class MangaScreen(
|
||||||
ChangeCategoryDialog(
|
ChangeCategoryDialog(
|
||||||
initialSelection = dialog.initialSelection,
|
initialSelection = dialog.initialSelection,
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
onEditCategories = { navigator.push(CategoriesTab(true)) },
|
onEditCategories = {
|
||||||
|
navigator.push(CategoriesTab)
|
||||||
|
CategoriesTab.showMangaCategory()
|
||||||
|
},
|
||||||
onConfirm = { include, _ ->
|
onConfirm = { include, _ ->
|
||||||
screenModel.moveMangaToCategoriesAndAddToLibrary(dialog.manga, include)
|
screenModel.moveMangaToCategoriesAndAddToLibrary(dialog.manga, include)
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,7 +26,7 @@ import kotlinx.collections.immutable.persistentListOf
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
object HistoriesTab : Tab() {
|
data object HistoriesTab : Tab {
|
||||||
|
|
||||||
override val options: TabOptions
|
override val options: TabOptions
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
@ -173,7 +173,12 @@ object HomeScreen : Screen() {
|
||||||
is Tab.Library -> MangaLibraryTab
|
is Tab.Library -> MangaLibraryTab
|
||||||
is Tab.Updates -> UpdatesTab
|
is Tab.Updates -> UpdatesTab
|
||||||
is Tab.History -> HistoriesTab
|
is Tab.History -> HistoriesTab
|
||||||
is Tab.Browse -> BrowseTab(it.toExtensions)
|
is Tab.Browse -> {
|
||||||
|
if (it.toExtensions) {
|
||||||
|
BrowseTab.showExtension()
|
||||||
|
}
|
||||||
|
BrowseTab
|
||||||
|
}
|
||||||
is Tab.More -> MoreTab
|
is Tab.More -> MoreTab
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +189,7 @@ object HomeScreen : Screen() {
|
||||||
navigator.push(MangaScreen(it.mangaIdToOpen))
|
navigator.push(MangaScreen(it.mangaIdToOpen))
|
||||||
}
|
}
|
||||||
if (it is Tab.More && it.toDownloads) {
|
if (it is Tab.More && it.toDownloads) {
|
||||||
navigator.push(DownloadsTab())
|
navigator.push(DownloadsTab)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ import tachiyomi.presentation.core.screens.LoadingScreen
|
||||||
import tachiyomi.source.local.entries.anime.isLocal
|
import tachiyomi.source.local.entries.anime.isLocal
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
object AnimeLibraryTab : Tab() {
|
data object AnimeLibraryTab : Tab {
|
||||||
|
|
||||||
@OptIn(ExperimentalAnimationGraphicsApi::class)
|
@OptIn(ExperimentalAnimationGraphicsApi::class)
|
||||||
override val options: TabOptions
|
override val options: TabOptions
|
||||||
|
@ -252,7 +252,7 @@ object AnimeLibraryTab : Tab() {
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
onEditCategories = {
|
onEditCategories = {
|
||||||
screenModel.clearSelection()
|
screenModel.clearSelection()
|
||||||
navigator.push(CategoriesTab(false))
|
navigator.push(CategoriesTab)
|
||||||
},
|
},
|
||||||
onConfirm = { include, exclude ->
|
onConfirm = { include, exclude ->
|
||||||
screenModel.clearSelection()
|
screenModel.clearSelection()
|
||||||
|
|
|
@ -64,7 +64,7 @@ import tachiyomi.presentation.core.screens.EmptyScreenAction
|
||||||
import tachiyomi.presentation.core.screens.LoadingScreen
|
import tachiyomi.presentation.core.screens.LoadingScreen
|
||||||
import tachiyomi.source.local.entries.manga.isLocal
|
import tachiyomi.source.local.entries.manga.isLocal
|
||||||
|
|
||||||
object MangaLibraryTab : Tab() {
|
data object MangaLibraryTab : Tab {
|
||||||
|
|
||||||
@OptIn(ExperimentalAnimationGraphicsApi::class)
|
@OptIn(ExperimentalAnimationGraphicsApi::class)
|
||||||
override val options: TabOptions
|
override val options: TabOptions
|
||||||
|
@ -272,7 +272,8 @@ object MangaLibraryTab : Tab() {
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
onEditCategories = {
|
onEditCategories = {
|
||||||
screenModel.clearSelection()
|
screenModel.clearSelection()
|
||||||
navigator.push(CategoriesTab(true))
|
navigator.push(CategoriesTab)
|
||||||
|
CategoriesTab.showMangaCategory()
|
||||||
},
|
},
|
||||||
onConfirm = { include, exclude ->
|
onConfirm = { include, exclude ->
|
||||||
screenModel.clearSelection()
|
screenModel.clearSelection()
|
||||||
|
|
|
@ -40,7 +40,7 @@ import tachiyomi.presentation.core.i18n.stringResource
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
|
||||||
object MoreTab : Tab() {
|
data object MoreTab : Tab {
|
||||||
|
|
||||||
override val options: TabOptions
|
override val options: TabOptions
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -74,10 +74,10 @@ object MoreTab : Tab() {
|
||||||
isFDroid = context.isInstalledFromFDroid(),
|
isFDroid = context.isInstalledFromFDroid(),
|
||||||
navStyle = navStyle,
|
navStyle = navStyle,
|
||||||
onClickAlt = { navigator.push(navStyle.moreTab) },
|
onClickAlt = { navigator.push(navStyle.moreTab) },
|
||||||
onClickDownloadQueue = { navigator.push(DownloadsTab()) },
|
onClickDownloadQueue = { navigator.push(DownloadsTab) },
|
||||||
onClickCategories = { navigator.push(CategoriesTab()) },
|
onClickCategories = { navigator.push(CategoriesTab) },
|
||||||
onClickStats = { navigator.push(StatsTab()) },
|
onClickStats = { navigator.push(StatsTab) },
|
||||||
onClickStorage = { navigator.push(StorageTab()) },
|
onClickStorage = { navigator.push(StorageTab) },
|
||||||
onClickDataAndStorage = { navigator.push(SettingsScreen(SettingsScreen.Destination.DataAndStorage)) },
|
onClickDataAndStorage = { navigator.push(SettingsScreen(SettingsScreen.Destination.DataAndStorage)) },
|
||||||
onClickSettings = { navigator.push(SettingsScreen()) },
|
onClickSettings = { navigator.push(SettingsScreen()) },
|
||||||
onClickAbout = { navigator.push(SettingsScreen(SettingsScreen.Destination.About)) },
|
onClickAbout = { navigator.push(SettingsScreen(SettingsScreen.Destination.About)) },
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.stats
|
||||||
import androidx.compose.animation.graphics.res.animatedVectorResource
|
import androidx.compose.animation.graphics.res.animatedVectorResource
|
||||||
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
|
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
|
||||||
import androidx.compose.animation.graphics.vector.AnimatedImageVector
|
import androidx.compose.animation.graphics.vector.AnimatedImageVector
|
||||||
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
@ -18,9 +19,7 @@ import kotlinx.collections.immutable.persistentListOf
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
data class StatsTab(
|
data object StatsTab : Tab {
|
||||||
private val isManga: Boolean = false,
|
|
||||||
) : Tab() {
|
|
||||||
|
|
||||||
override val options: TabOptions
|
override val options: TabOptions
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -38,14 +37,16 @@ data class StatsTab(
|
||||||
override fun Content() {
|
override fun Content() {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
TabbedScreen(
|
val tabs = persistentListOf(
|
||||||
titleRes = MR.strings.label_stats,
|
|
||||||
tabs = persistentListOf(
|
|
||||||
animeStatsTab(),
|
animeStatsTab(),
|
||||||
mangaStatsTab(),
|
mangaStatsTab(),
|
||||||
),
|
)
|
||||||
startIndex = 1.takeIf { isManga },
|
val state = rememberPagerState { tabs.size }
|
||||||
|
|
||||||
|
TabbedScreen(
|
||||||
|
titleRes = MR.strings.label_stats,
|
||||||
|
tabs = tabs,
|
||||||
|
state = state,
|
||||||
)
|
)
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.storage
|
||||||
import androidx.compose.animation.graphics.res.animatedVectorResource
|
import androidx.compose.animation.graphics.res.animatedVectorResource
|
||||||
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
|
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
|
||||||
import androidx.compose.animation.graphics.vector.AnimatedImageVector
|
import androidx.compose.animation.graphics.vector.AnimatedImageVector
|
||||||
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
@ -18,9 +19,7 @@ import kotlinx.collections.immutable.persistentListOf
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
data class StorageTab(
|
data object StorageTab : Tab {
|
||||||
private val isManga: Boolean = false,
|
|
||||||
) : Tab() {
|
|
||||||
|
|
||||||
override val options: TabOptions
|
override val options: TabOptions
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -38,13 +37,16 @@ data class StorageTab(
|
||||||
override fun Content() {
|
override fun Content() {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
TabbedScreen(
|
val tabs = persistentListOf(
|
||||||
titleRes = MR.strings.label_storage,
|
|
||||||
tabs = persistentListOf(
|
|
||||||
animeStorageTab(),
|
animeStorageTab(),
|
||||||
mangaStorageTab(),
|
mangaStorageTab(),
|
||||||
),
|
)
|
||||||
startIndex = 1.takeIf { isManga },
|
val state = rememberPagerState { tabs.size }
|
||||||
|
|
||||||
|
TabbedScreen(
|
||||||
|
titleRes = MR.strings.label_storage,
|
||||||
|
tabs = tabs,
|
||||||
|
state = state,
|
||||||
)
|
)
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
|
|
|
@ -21,7 +21,7 @@ import kotlinx.collections.immutable.persistentListOf
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
object UpdatesTab : Tab() {
|
data object UpdatesTab : Tab {
|
||||||
|
|
||||||
override val options: TabOptions
|
override val options: TabOptions
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -41,7 +41,7 @@ object UpdatesTab : Tab() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
override suspend fun onReselect(navigator: Navigator) {
|
override suspend fun onReselect(navigator: Navigator) {
|
||||||
navigator.push(DownloadsTab())
|
navigator.push(DownloadsTab)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
Loading…
Reference in a new issue