Text on tabs Overflow Ellipsis (#10095)
* Update TabbedDialog to TabbedScreen * clean (cherry picked from commit b3d7c9247530c0522033b4a9130d252bcbf50163) # Conflicts: # presentation-core/src/main/java/tachiyomi/presentation/core/components/material/Tabs.kt
This commit is contained in:
parent
3dd8aeafe5
commit
aa2afd1402
@ -16,7 +16,6 @@ import androidx.compose.material3.IconButton
|
|||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Tab
|
import androidx.compose.material3.Tab
|
||||||
import androidx.compose.material3.TabRow
|
import androidx.compose.material3.TabRow
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
@ -32,6 +31,7 @@ import eu.kanade.tachiyomi.R
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import tachiyomi.presentation.core.components.HorizontalPager
|
import tachiyomi.presentation.core.components.HorizontalPager
|
||||||
import tachiyomi.presentation.core.components.material.TabIndicator
|
import tachiyomi.presentation.core.components.material.TabIndicator
|
||||||
|
import tachiyomi.presentation.core.components.material.TabText
|
||||||
|
|
||||||
object TabbedDialogPaddings {
|
object TabbedDialogPaddings {
|
||||||
val Horizontal = 24.dp
|
val Horizontal = 24.dp
|
||||||
@ -61,21 +61,12 @@ fun TabbedDialog(
|
|||||||
indicator = { TabIndicator(it[pagerState.currentPage], pagerState.currentPageOffsetFraction) },
|
indicator = { TabIndicator(it[pagerState.currentPage], pagerState.currentPageOffsetFraction) },
|
||||||
divider = {},
|
divider = {},
|
||||||
) {
|
) {
|
||||||
tabTitles.fastForEachIndexed { i, tab ->
|
tabTitles.fastForEachIndexed { index, tab ->
|
||||||
val selected = pagerState.currentPage == i
|
|
||||||
Tab(
|
Tab(
|
||||||
selected = selected,
|
selected = pagerState.currentPage == index,
|
||||||
onClick = { scope.launch { pagerState.animateScrollToPage(i) } },
|
onClick = { scope.launch { pagerState.animateScrollToPage(index) } },
|
||||||
text = {
|
text = { TabText(text = tab) },
|
||||||
Text(
|
unselectedContentColor = MaterialTheme.colorScheme.onSurface,
|
||||||
text = tab,
|
|
||||||
color = if (selected) {
|
|
||||||
MaterialTheme.colorScheme.primary
|
|
||||||
} else {
|
|
||||||
MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
},
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,10 +65,8 @@ fun TabText(text: String, badgeCount: Int? = null) {
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = text,
|
text = text,
|
||||||
// SY -->
|
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
// SY <--
|
|
||||||
)
|
)
|
||||||
if (badgeCount != null) {
|
if (badgeCount != null) {
|
||||||
Pill(
|
Pill(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user