Adjust tab indicator visual (#9219)
Now behaves like the non-compose indicator by showing the swipe progress too (cherry picked from commit 18e55aa25fe7ea63e66a99d1373fbdb449a358d7) # Conflicts: # app/src/main/java/eu/kanade/presentation/library/components/LibraryTabs.kt # presentation-core/src/main/java/tachiyomi/presentation/core/components/material/Tabs.kt
This commit is contained in:
@@ -56,7 +56,7 @@ fun TabbedDialog(
|
||||
TabRow(
|
||||
modifier = Modifier.weight(1f),
|
||||
selectedTabIndex = pagerState.currentPage,
|
||||
indicator = { TabIndicator(it[pagerState.currentPage]) },
|
||||
indicator = { TabIndicator(it[pagerState.currentPage], pagerState.currentPageOffsetFraction) },
|
||||
divider = {},
|
||||
) {
|
||||
tabTitles.fastForEachIndexed { i, tab ->
|
||||
|
||||
@@ -69,7 +69,7 @@ fun TabbedScreen(
|
||||
) {
|
||||
TabRow(
|
||||
selectedTabIndex = state.currentPage,
|
||||
indicator = { TabIndicator(it[state.currentPage]) },
|
||||
indicator = { TabIndicator(it[state.currentPage], state.currentPageOffsetFraction) },
|
||||
) {
|
||||
tabs.forEachIndexed { index, tab ->
|
||||
Tab(
|
||||
|
||||
@@ -68,7 +68,7 @@ fun LibraryContent(
|
||||
}
|
||||
LibraryTabs(
|
||||
categories = categories,
|
||||
currentPageIndex = pagerState.currentPage,
|
||||
pagerState = pagerState,
|
||||
getNumberOfMangaForCategory = getNumberOfMangaForCategory,
|
||||
) { scope.launch { pagerState.animateScrollToPage(it) } }
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.presentation.category.visualName
|
||||
import tachiyomi.domain.category.model.Category
|
||||
import tachiyomi.presentation.core.components.PagerState
|
||||
import tachiyomi.presentation.core.components.material.Divider
|
||||
import tachiyomi.presentation.core.components.material.TabIndicator
|
||||
import tachiyomi.presentation.core.components.material.TabText
|
||||
@@ -15,19 +16,18 @@ import tachiyomi.presentation.core.components.material.TabText
|
||||
@Composable
|
||||
internal fun LibraryTabs(
|
||||
categories: List<Category>,
|
||||
currentPageIndex: Int,
|
||||
pagerState: PagerState,
|
||||
getNumberOfMangaForCategory: (Category) -> Int?,
|
||||
onTabItemClick: (Int) -> Unit,
|
||||
) {
|
||||
// SY -->
|
||||
@Suppress("NAME_SHADOWING")
|
||||
val currentPageIndex = currentPageIndex.coerceAtMost(categories.lastIndex)
|
||||
val currentPageIndex = pagerState.currentPage.coerceAtMost(categories.lastIndex)
|
||||
// SY <--
|
||||
Column {
|
||||
ScrollableTabRow(
|
||||
selectedTabIndex = currentPageIndex,
|
||||
edgePadding = 0.dp,
|
||||
indicator = { TabIndicator(it[currentPageIndex.coerceAtMost(categories.lastIndex)]) },
|
||||
indicator = { TabIndicator(it[currentPageIndex], pagerState.currentPageOffsetFraction) },
|
||||
// TODO: use default when width is fixed upstream
|
||||
// https://issuetracker.google.com/issues/242879624
|
||||
divider = {},
|
||||
|
||||
Reference in New Issue
Block a user