From 62d4044d6cc4fea92aa5325353d96cfc181fbf8b Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Fri, 30 Aug 2024 08:58:57 +0530 Subject: [PATCH] Make lazy column scrollbars red --- .../schabi/newpipe/ui/components/items/ItemList.kt | 11 ++++++++++- .../ui/components/video/comment/CommentSection.kt | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/ui/components/items/ItemList.kt b/app/src/main/java/org/schabi/newpipe/ui/components/items/ItemList.kt index 506687d12..4f58e3e32 100644 --- a/app/src/main/java/org/schabi/newpipe/ui/components/items/ItemList.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/items/ItemList.kt @@ -10,6 +10,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.rememberNestedScrollInteropConnection @@ -18,6 +19,7 @@ import androidx.fragment.app.FragmentActivity import androidx.preference.PreferenceManager import androidx.window.core.layout.WindowWidthSizeClass import my.nanihadesuka.compose.LazyColumnScrollbar +import my.nanihadesuka.compose.ScrollbarSettings import org.schabi.newpipe.R import org.schabi.newpipe.extractor.InfoItem import org.schabi.newpipe.extractor.playlist.PlaylistInfoItem @@ -25,6 +27,7 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItem import org.schabi.newpipe.info_list.ItemViewMode import org.schabi.newpipe.ui.components.items.playlist.PlaylistListItem import org.schabi.newpipe.ui.components.items.stream.StreamListItem +import org.schabi.newpipe.ui.theme.md_theme_dark_primary import org.schabi.newpipe.util.DependentPreferenceHelper import org.schabi.newpipe.util.NavigationHelper @@ -72,7 +75,13 @@ fun ItemList( } else { val state = rememberLazyListState() - LazyColumnScrollbar(state = state) { + LazyColumnScrollbar( + state = state, + settings = ScrollbarSettings.Default.copy( + thumbSelectedColor = md_theme_dark_primary, + thumbUnselectedColor = Color.Red + ) + ) { LazyColumn(modifier = nestedScrollModifier, state = state) { listHeader() diff --git a/app/src/main/java/org/schabi/newpipe/ui/components/video/comment/CommentSection.kt b/app/src/main/java/org/schabi/newpipe/ui/components/video/comment/CommentSection.kt index d2e0ea122..bdd72cea5 100644 --- a/app/src/main/java/org/schabi/newpipe/ui/components/video/comment/CommentSection.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/video/comment/CommentSection.kt @@ -11,6 +11,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.rememberNestedScrollInteropConnection import androidx.compose.ui.res.pluralStringResource @@ -25,6 +26,7 @@ import androidx.paging.compose.collectAsLazyPagingItems import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf import my.nanihadesuka.compose.LazyColumnScrollbar +import my.nanihadesuka.compose.ScrollbarSettings import org.schabi.newpipe.R import org.schabi.newpipe.extractor.Page import org.schabi.newpipe.extractor.comments.CommentsInfoItem @@ -32,6 +34,7 @@ import org.schabi.newpipe.extractor.stream.Description import org.schabi.newpipe.ui.components.common.LoadingIndicator import org.schabi.newpipe.ui.components.common.NoItemsMessage import org.schabi.newpipe.ui.theme.AppTheme +import org.schabi.newpipe.ui.theme.md_theme_dark_primary import org.schabi.newpipe.viewmodels.CommentsViewModel import org.schabi.newpipe.viewmodels.util.Resource @@ -77,7 +80,13 @@ fun CommentSection( val nestedScrollInterop = rememberNestedScrollInteropConnection() val state = rememberLazyListState() - LazyColumnScrollbar(state = state) { + LazyColumnScrollbar( + state = state, + settings = ScrollbarSettings.Default.copy( + thumbSelectedColor = md_theme_dark_primary, + thumbUnselectedColor = Color.Red + ) + ) { LazyColumn( modifier = Modifier.nestedScroll(nestedScrollInterop), state = state