Skip to content

Commit

Permalink
Reuse LazyColumnThemedScrollbar
Browse files Browse the repository at this point in the history
  • Loading branch information
Isira-Seneviratne committed Nov 21, 2024
1 parent cd96927 commit a69c48a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/java/org/schabi/newpipe/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit a69c48a

Please sign in to comment.