Skip to content

Commit 0d12cfc

Browse files
Remove AndroidX Browser, make scrollbars red
1 parent 8f9faf3 commit 0d12cfc

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

app/build.gradle

-3
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,6 @@ dependencies {
298298
// Coroutines interop
299299
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-rx3:1.8.1'
300300

301-
// Custom browser tab
302-
implementation 'androidx.browser:browser:1.8.0'
303-
304301
/** Debugging **/
305302
// Memory leak detection
306303
debugImplementation "com.squareup.leakcanary:leakcanary-object-watcher-android:${leakCanaryVersion}"

app/src/main/java/org/schabi/newpipe/ui/components/channel/AboutChannelSection.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import org.schabi.newpipe.ui.components.metadata.MetadataItem
2424
import org.schabi.newpipe.ui.components.metadata.TagsSection
2525
import org.schabi.newpipe.ui.components.metadata.imageMetadataItem
2626
import org.schabi.newpipe.ui.theme.AppTheme
27+
import org.schabi.newpipe.ui.theme.NewPipeScrollbarSettings
2728
import org.schabi.newpipe.util.Localization
2829
import org.schabi.newpipe.util.NO_SERVICE_ID
2930

@@ -32,7 +33,7 @@ fun AboutChannelSection(channelInfo: ParcelableChannelInfo) {
3233
val (serviceId, description, count, avatars, banners, tags) = channelInfo
3334
val lazyListState = rememberLazyListState()
3435

35-
LazyColumnScrollbar(state = lazyListState) {
36+
LazyColumnScrollbar(state = lazyListState, settings = NewPipeScrollbarSettings) {
3637
LazyColumn(
3738
modifier = Modifier
3839
.padding(12.dp)
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
package org.schabi.newpipe.ui.components.common.link
22

33
import android.content.Context
4-
import androidx.browser.customtabs.CustomTabsIntent
4+
import androidx.compose.ui.platform.AndroidUriHandler
55
import androidx.compose.ui.text.LinkAnnotation
66
import androidx.compose.ui.text.LinkInteractionListener
77
import androidx.core.net.toUri
88
import org.schabi.newpipe.extractor.ServiceList
99
import org.schabi.newpipe.util.NavigationHelper
1010

1111
class YouTubeLinkHandler(private val context: Context) : LinkInteractionListener {
12+
private val uriHandler = AndroidUriHandler(context)
13+
1214
override fun onClick(link: LinkAnnotation) {
13-
val uri = (link as LinkAnnotation.Url).url.toUri()
15+
val url = (link as LinkAnnotation.Url).url
16+
val uri = url.toUri()
1417

1518
// TODO: Handle other links in NewPipe as well.
1619
if ("hashtag" in uri.pathSegments) {
1720
NavigationHelper.openSearch(
1821
context, ServiceList.YouTube.serviceId, "#${uri.lastPathSegment}"
1922
)
2023
} else {
21-
// Open link in custom browser tab.
22-
CustomTabsIntent.Builder().build().launchUrl(context, uri)
24+
uriHandler.openUri(url)
2325
}
2426
}
2527
}

app/src/main/java/org/schabi/newpipe/ui/components/video/StreamDescriptionSection.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import org.schabi.newpipe.ui.components.metadata.MetadataItem
5555
import org.schabi.newpipe.ui.components.metadata.TagsSection
5656
import org.schabi.newpipe.ui.components.metadata.imageMetadataItem
5757
import org.schabi.newpipe.ui.theme.AppTheme
58+
import org.schabi.newpipe.ui.theme.NewPipeScrollbarSettings
5859
import org.schabi.newpipe.util.Localization
5960
import org.schabi.newpipe.util.NO_SERVICE_ID
6061
import java.time.OffsetDateTime
@@ -66,7 +67,7 @@ fun StreamDescriptionSection(streamInfo: StreamInfo) {
6667
val hasDescription = streamInfo.description != Description.EMPTY_DESCRIPTION
6768
val lazyListState = rememberLazyListState()
6869

69-
LazyColumnScrollbar(state = lazyListState) {
70+
LazyColumnScrollbar(state = lazyListState, settings = NewPipeScrollbarSettings) {
7071
LazyColumn(
7172
modifier = Modifier
7273
.padding(start = 12.dp, end = 12.dp)

app/src/main/java/org/schabi/newpipe/ui/theme/Theme.kt

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import androidx.compose.material3.MaterialTheme
55
import androidx.compose.material3.darkColorScheme
66
import androidx.compose.material3.lightColorScheme
77
import androidx.compose.runtime.Composable
8+
import androidx.compose.ui.graphics.Color
9+
import my.nanihadesuka.compose.ScrollbarSettings
810

911
private val LightColors = lightColorScheme(
1012
primary = md_theme_light_primary,
@@ -70,6 +72,11 @@ private val DarkColors = darkColorScheme(
7072
scrim = md_theme_dark_scrim,
7173
)
7274

75+
val NewPipeScrollbarSettings = ScrollbarSettings(
76+
thumbSelectedColor = md_theme_dark_primary,
77+
thumbUnselectedColor = Color.Red
78+
)
79+
7380
@Composable
7481
fun AppTheme(useDarkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
7582
MaterialTheme(

0 commit comments

Comments
 (0)