1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-01-09 17:00:32 +00:00

Remove AndroidX Browser, make scrollbars red

This commit is contained in:
Isira Seneviratne 2024-09-07 05:12:35 +05:30
parent 8f9faf3e53
commit 0d12cfc983
5 changed files with 17 additions and 9 deletions

View File

@ -298,9 +298,6 @@ dependencies {
// Coroutines interop
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-rx3:1.8.1'
// Custom browser tab
implementation 'androidx.browser:browser:1.8.0'
/** Debugging **/
// Memory leak detection
debugImplementation "com.squareup.leakcanary:leakcanary-object-watcher-android:${leakCanaryVersion}"

View File

@ -24,6 +24,7 @@ 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
@ -32,7 +33,7 @@ fun AboutChannelSection(channelInfo: ParcelableChannelInfo) {
val (serviceId, description, count, avatars, banners, tags) = channelInfo
val lazyListState = rememberLazyListState()
LazyColumnScrollbar(state = lazyListState) {
LazyColumnScrollbar(state = lazyListState, settings = NewPipeScrollbarSettings) {
LazyColumn(
modifier = Modifier
.padding(12.dp)

View File

@ -1,7 +1,7 @@
package org.schabi.newpipe.ui.components.common.link
import android.content.Context
import androidx.browser.customtabs.CustomTabsIntent
import androidx.compose.ui.platform.AndroidUriHandler
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.LinkInteractionListener
import androidx.core.net.toUri
@ -9,8 +9,11 @@ import org.schabi.newpipe.extractor.ServiceList
import org.schabi.newpipe.util.NavigationHelper
class YouTubeLinkHandler(private val context: Context) : LinkInteractionListener {
private val uriHandler = AndroidUriHandler(context)
override fun onClick(link: LinkAnnotation) {
val uri = (link as LinkAnnotation.Url).url.toUri()
val url = (link as LinkAnnotation.Url).url
val uri = url.toUri()
// TODO: Handle other links in NewPipe as well.
if ("hashtag" in uri.pathSegments) {
@ -18,8 +21,7 @@ class YouTubeLinkHandler(private val context: Context) : LinkInteractionListener
context, ServiceList.YouTube.serviceId, "#${uri.lastPathSegment}"
)
} else {
// Open link in custom browser tab.
CustomTabsIntent.Builder().build().launchUrl(context, uri)
uriHandler.openUri(url)
}
}
}

View File

@ -55,6 +55,7 @@ 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
@ -66,7 +67,7 @@ fun StreamDescriptionSection(streamInfo: StreamInfo) {
val hasDescription = streamInfo.description != Description.EMPTY_DESCRIPTION
val lazyListState = rememberLazyListState()
LazyColumnScrollbar(state = lazyListState) {
LazyColumnScrollbar(state = lazyListState, settings = NewPipeScrollbarSettings) {
LazyColumn(
modifier = Modifier
.padding(start = 12.dp, end = 12.dp)

View File

@ -5,6 +5,8 @@ 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,
@ -70,6 +72,11 @@ 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(