Fix missing downloaded only/incognito banners in Browse

This commit is contained in:
arkon 2022-09-03 10:32:13 -04:00
parent 3fa68ed217
commit bbf5c86b46
4 changed files with 20 additions and 4 deletions

View file

@ -21,6 +21,8 @@ fun TabbedScreen(
@StringRes titleRes: Int,
tabs: List<TabContent>,
startIndex: Int? = null,
incognitoMode: Boolean,
downloadedOnlyMode: Boolean,
) {
val scope = rememberCoroutineScope()
val state = rememberPagerState()
@ -57,6 +59,13 @@ fun TabbedScreen(
}
}
if (downloadedOnlyMode) {
DownloadedOnlyModeBanner()
}
if (incognitoMode) {
IncognitoModeBanner()
}
HorizontalPager(
count = tabs.size,
modifier = Modifier.fillMaxSize(),

View file

@ -1,6 +1,5 @@
package eu.kanade.presentation.library.components
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.ScrollableTabRow
import androidx.compose.material3.Tab
@ -31,8 +30,6 @@ fun LibraryTabs(
) {
val scope = rememberCoroutineScope()
val pillAlpha = if (isSystemInDarkTheme()) 0.12f else 0.08f
Column {
ScrollableTabRow(
selectedTabIndex = state.currentPage,

View file

@ -39,6 +39,8 @@ class BrowseController : FullComposeController<BrowsePresenter>, RootController
migrateSourcesTab(router, presenter.migrationSourcesPresenter),
),
startIndex = 1.takeIf { toExtensions },
incognitoMode = presenter.isIncognitoMode,
downloadedOnlyMode = presenter.isDownloadOnly,
)
LaunchedEffect(Unit) {

View file

@ -1,13 +1,21 @@
package eu.kanade.tachiyomi.ui.browse
import android.os.Bundle
import androidx.compose.runtime.getValue
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
import eu.kanade.tachiyomi.ui.browse.extension.ExtensionsPresenter
import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrationSourcesPresenter
import eu.kanade.tachiyomi.ui.browse.source.SourcesPresenter
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
class BrowsePresenter : BasePresenter<BrowseController>() {
class BrowsePresenter(
preferences: PreferencesHelper = Injekt.get(),
) : BasePresenter<BrowseController>() {
val isDownloadOnly: Boolean by preferences.downloadedOnly().asState()
val isIncognitoMode: Boolean by preferences.incognitoMode().asState()
val sourcesPresenter = SourcesPresenter(presenterScope)
val extensionsPresenter = ExtensionsPresenter(presenterScope)