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

View file

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

View file

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

View file

@ -1,13 +1,21 @@
package eu.kanade.tachiyomi.ui.browse package eu.kanade.tachiyomi.ui.browse
import android.os.Bundle 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.base.presenter.BasePresenter
import eu.kanade.tachiyomi.ui.browse.extension.ExtensionsPresenter import eu.kanade.tachiyomi.ui.browse.extension.ExtensionsPresenter
import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrationSourcesPresenter import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrationSourcesPresenter
import eu.kanade.tachiyomi.ui.browse.source.SourcesPresenter import eu.kanade.tachiyomi.ui.browse.source.SourcesPresenter
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get 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 sourcesPresenter = SourcesPresenter(presenterScope)
val extensionsPresenter = ExtensionsPresenter(presenterScope) val extensionsPresenter = ExtensionsPresenter(presenterScope)