1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-11-22 10:15:16 +01:00

Reuse LazyColumnThemedScrollbar

This commit is contained in:
Isira Seneviratne 2024-11-22 05:11:19 +05:30
parent cd96927358
commit a69c48a63f
4 changed files with 6 additions and 14 deletions

View File

@ -15,16 +15,15 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import my.nanihadesuka.compose.LazyColumnScrollbar
import org.schabi.newpipe.R
import org.schabi.newpipe.extractor.Image
import org.schabi.newpipe.extractor.Image.ResolutionLevel
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.TagsSection
import org.schabi.newpipe.ui.components.metadata.imageMetadataItem
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.NO_SERVICE_ID
@ -33,7 +32,7 @@ fun AboutChannelSection(channelInfo: ParcelableChannelInfo) {
val (serviceId, description, count, avatars, banners, tags) = channelInfo
val lazyListState = rememberLazyListState()
LazyColumnScrollbar(state = lazyListState, settings = NewPipeScrollbarSettings) {
LazyColumnThemedScrollbar(state = lazyListState) {
LazyColumn(
modifier = Modifier
.padding(12.dp)

View File

@ -4,6 +4,7 @@ import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import my.nanihadesuka.compose.LazyColumnScrollbar
import my.nanihadesuka.compose.ScrollbarSettings
@Composable
@ -20,7 +21,7 @@ fun LazyColumnThemedScrollbar(
indicatorContent: (@Composable (index: Int, isThumbSelected: Boolean) -> Unit)? = null,
content: @Composable () -> Unit
) {
my.nanihadesuka.compose.LazyColumnScrollbar(
LazyColumnScrollbar(
state = state,
modifier = modifier,
settings = settings,

View File

@ -43,19 +43,18 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import my.nanihadesuka.compose.LazyColumnScrollbar
import org.schabi.newpipe.R
import org.schabi.newpipe.extractor.localization.DateWrapper
import org.schabi.newpipe.extractor.stream.Description
import org.schabi.newpipe.extractor.stream.StreamExtractor
import org.schabi.newpipe.extractor.stream.StreamInfo
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.metadata.MetadataItem
import org.schabi.newpipe.ui.components.metadata.TagsSection
import org.schabi.newpipe.ui.components.metadata.imageMetadataItem
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.NO_SERVICE_ID
import java.time.OffsetDateTime
@ -67,7 +66,7 @@ fun StreamDescriptionSection(streamInfo: StreamInfo) {
val hasDescription = streamInfo.description != Description.EMPTY_DESCRIPTION
val lazyListState = rememberLazyListState()
LazyColumnScrollbar(state = lazyListState, settings = NewPipeScrollbarSettings) {
LazyColumnThemedScrollbar(state = lazyListState) {
LazyColumn(
modifier = Modifier
.padding(start = 12.dp, end = 12.dp)

View File

@ -5,8 +5,6 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import my.nanihadesuka.compose.ScrollbarSettings
private val LightColors = lightColorScheme(
primary = md_theme_light_primary,
@ -72,11 +70,6 @@ private val DarkColors = darkColorScheme(
scrim = md_theme_dark_scrim,
)
val NewPipeScrollbarSettings = ScrollbarSettings(
thumbSelectedColor = md_theme_dark_primary,
thumbUnselectedColor = Color.Red
)
@Composable
fun AppTheme(useDarkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
MaterialTheme(