Reuse LazyColumnThemedScrollbar
This commit is contained in:
parent
cd96927358
commit
a69c48a63f
|
@ -15,16 +15,15 @@ import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
|
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import my.nanihadesuka.compose.LazyColumnScrollbar
|
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
import org.schabi.newpipe.extractor.Image
|
import org.schabi.newpipe.extractor.Image
|
||||||
import org.schabi.newpipe.extractor.Image.ResolutionLevel
|
import org.schabi.newpipe.extractor.Image.ResolutionLevel
|
||||||
import org.schabi.newpipe.extractor.stream.StreamExtractor
|
import org.schabi.newpipe.extractor.stream.StreamExtractor
|
||||||
|
import org.schabi.newpipe.ui.components.common.LazyColumnThemedScrollbar
|
||||||
import org.schabi.newpipe.ui.components.metadata.MetadataItem
|
import org.schabi.newpipe.ui.components.metadata.MetadataItem
|
||||||
import org.schabi.newpipe.ui.components.metadata.TagsSection
|
import org.schabi.newpipe.ui.components.metadata.TagsSection
|
||||||
import org.schabi.newpipe.ui.components.metadata.imageMetadataItem
|
import org.schabi.newpipe.ui.components.metadata.imageMetadataItem
|
||||||
import org.schabi.newpipe.ui.theme.AppTheme
|
import org.schabi.newpipe.ui.theme.AppTheme
|
||||||
import org.schabi.newpipe.ui.theme.NewPipeScrollbarSettings
|
|
||||||
import org.schabi.newpipe.util.Localization
|
import org.schabi.newpipe.util.Localization
|
||||||
import org.schabi.newpipe.util.NO_SERVICE_ID
|
import org.schabi.newpipe.util.NO_SERVICE_ID
|
||||||
|
|
||||||
|
@ -33,7 +32,7 @@ fun AboutChannelSection(channelInfo: ParcelableChannelInfo) {
|
||||||
val (serviceId, description, count, avatars, banners, tags) = channelInfo
|
val (serviceId, description, count, avatars, banners, tags) = channelInfo
|
||||||
val lazyListState = rememberLazyListState()
|
val lazyListState = rememberLazyListState()
|
||||||
|
|
||||||
LazyColumnScrollbar(state = lazyListState, settings = NewPipeScrollbarSettings) {
|
LazyColumnThemedScrollbar(state = lazyListState) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(12.dp)
|
.padding(12.dp)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import androidx.compose.foundation.lazy.LazyListState
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import my.nanihadesuka.compose.LazyColumnScrollbar
|
||||||
import my.nanihadesuka.compose.ScrollbarSettings
|
import my.nanihadesuka.compose.ScrollbarSettings
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -20,7 +21,7 @@ fun LazyColumnThemedScrollbar(
|
||||||
indicatorContent: (@Composable (index: Int, isThumbSelected: Boolean) -> Unit)? = null,
|
indicatorContent: (@Composable (index: Int, isThumbSelected: Boolean) -> Unit)? = null,
|
||||||
content: @Composable () -> Unit
|
content: @Composable () -> Unit
|
||||||
) {
|
) {
|
||||||
my.nanihadesuka.compose.LazyColumnScrollbar(
|
LazyColumnScrollbar(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
settings = settings,
|
settings = settings,
|
||||||
|
|
|
@ -43,19 +43,18 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import my.nanihadesuka.compose.LazyColumnScrollbar
|
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
import org.schabi.newpipe.extractor.localization.DateWrapper
|
import org.schabi.newpipe.extractor.localization.DateWrapper
|
||||||
import org.schabi.newpipe.extractor.stream.Description
|
import org.schabi.newpipe.extractor.stream.Description
|
||||||
import org.schabi.newpipe.extractor.stream.StreamExtractor
|
import org.schabi.newpipe.extractor.stream.StreamExtractor
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfo
|
import org.schabi.newpipe.extractor.stream.StreamInfo
|
||||||
import org.schabi.newpipe.extractor.stream.StreamType
|
import org.schabi.newpipe.extractor.stream.StreamType
|
||||||
|
import org.schabi.newpipe.ui.components.common.LazyColumnThemedScrollbar
|
||||||
import org.schabi.newpipe.ui.components.common.parseDescription
|
import org.schabi.newpipe.ui.components.common.parseDescription
|
||||||
import org.schabi.newpipe.ui.components.metadata.MetadataItem
|
import org.schabi.newpipe.ui.components.metadata.MetadataItem
|
||||||
import org.schabi.newpipe.ui.components.metadata.TagsSection
|
import org.schabi.newpipe.ui.components.metadata.TagsSection
|
||||||
import org.schabi.newpipe.ui.components.metadata.imageMetadataItem
|
import org.schabi.newpipe.ui.components.metadata.imageMetadataItem
|
||||||
import org.schabi.newpipe.ui.theme.AppTheme
|
import org.schabi.newpipe.ui.theme.AppTheme
|
||||||
import org.schabi.newpipe.ui.theme.NewPipeScrollbarSettings
|
|
||||||
import org.schabi.newpipe.util.Localization
|
import org.schabi.newpipe.util.Localization
|
||||||
import org.schabi.newpipe.util.NO_SERVICE_ID
|
import org.schabi.newpipe.util.NO_SERVICE_ID
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
|
@ -67,7 +66,7 @@ fun StreamDescriptionSection(streamInfo: StreamInfo) {
|
||||||
val hasDescription = streamInfo.description != Description.EMPTY_DESCRIPTION
|
val hasDescription = streamInfo.description != Description.EMPTY_DESCRIPTION
|
||||||
val lazyListState = rememberLazyListState()
|
val lazyListState = rememberLazyListState()
|
||||||
|
|
||||||
LazyColumnScrollbar(state = lazyListState, settings = NewPipeScrollbarSettings) {
|
LazyColumnThemedScrollbar(state = lazyListState) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(start = 12.dp, end = 12.dp)
|
.padding(start = 12.dp, end = 12.dp)
|
||||||
|
|
|
@ -5,8 +5,6 @@ import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.darkColorScheme
|
import androidx.compose.material3.darkColorScheme
|
||||||
import androidx.compose.material3.lightColorScheme
|
import androidx.compose.material3.lightColorScheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import my.nanihadesuka.compose.ScrollbarSettings
|
|
||||||
|
|
||||||
private val LightColors = lightColorScheme(
|
private val LightColors = lightColorScheme(
|
||||||
primary = md_theme_light_primary,
|
primary = md_theme_light_primary,
|
||||||
|
@ -72,11 +70,6 @@ private val DarkColors = darkColorScheme(
|
||||||
scrim = md_theme_dark_scrim,
|
scrim = md_theme_dark_scrim,
|
||||||
)
|
)
|
||||||
|
|
||||||
val NewPipeScrollbarSettings = ScrollbarSettings(
|
|
||||||
thumbSelectedColor = md_theme_dark_primary,
|
|
||||||
thumbUnselectedColor = Color.Red
|
|
||||||
)
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppTheme(useDarkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
|
fun AppTheme(useDarkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
|
||||||
MaterialTheme(
|
MaterialTheme(
|
||||||
|
|
Loading…
Reference in New Issue