mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-01-24 16:07:04 +00:00
Remove AndroidX Browser, make scrollbars red
This commit is contained in:
parent
8f9faf3e53
commit
0d12cfc983
@ -298,9 +298,6 @@ dependencies {
|
|||||||
// Coroutines interop
|
// Coroutines interop
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-rx3:1.8.1'
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-rx3:1.8.1'
|
||||||
|
|
||||||
// Custom browser tab
|
|
||||||
implementation 'androidx.browser:browser:1.8.0'
|
|
||||||
|
|
||||||
/** Debugging **/
|
/** Debugging **/
|
||||||
// Memory leak detection
|
// Memory leak detection
|
||||||
debugImplementation "com.squareup.leakcanary:leakcanary-object-watcher-android:${leakCanaryVersion}"
|
debugImplementation "com.squareup.leakcanary:leakcanary-object-watcher-android:${leakCanaryVersion}"
|
||||||
|
@ -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.TagsSection
|
||||||
import org.schabi.newpipe.ui.components.metadata.imageMetadataItem
|
import org.schabi.newpipe.ui.components.metadata.imageMetadataItem
|
||||||
import org.schabi.newpipe.ui.theme.AppTheme
|
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.Localization
|
||||||
import org.schabi.newpipe.util.NO_SERVICE_ID
|
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 (serviceId, description, count, avatars, banners, tags) = channelInfo
|
||||||
val lazyListState = rememberLazyListState()
|
val lazyListState = rememberLazyListState()
|
||||||
|
|
||||||
LazyColumnScrollbar(state = lazyListState) {
|
LazyColumnScrollbar(state = lazyListState, settings = NewPipeScrollbarSettings) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(12.dp)
|
.padding(12.dp)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package org.schabi.newpipe.ui.components.common.link
|
package org.schabi.newpipe.ui.components.common.link
|
||||||
|
|
||||||
import android.content.Context
|
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.LinkAnnotation
|
||||||
import androidx.compose.ui.text.LinkInteractionListener
|
import androidx.compose.ui.text.LinkInteractionListener
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
@ -9,8 +9,11 @@ import org.schabi.newpipe.extractor.ServiceList
|
|||||||
import org.schabi.newpipe.util.NavigationHelper
|
import org.schabi.newpipe.util.NavigationHelper
|
||||||
|
|
||||||
class YouTubeLinkHandler(private val context: Context) : LinkInteractionListener {
|
class YouTubeLinkHandler(private val context: Context) : LinkInteractionListener {
|
||||||
|
private val uriHandler = AndroidUriHandler(context)
|
||||||
|
|
||||||
override fun onClick(link: LinkAnnotation) {
|
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.
|
// TODO: Handle other links in NewPipe as well.
|
||||||
if ("hashtag" in uri.pathSegments) {
|
if ("hashtag" in uri.pathSegments) {
|
||||||
@ -18,8 +21,7 @@ class YouTubeLinkHandler(private val context: Context) : LinkInteractionListener
|
|||||||
context, ServiceList.YouTube.serviceId, "#${uri.lastPathSegment}"
|
context, ServiceList.YouTube.serviceId, "#${uri.lastPathSegment}"
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// Open link in custom browser tab.
|
uriHandler.openUri(url)
|
||||||
CustomTabsIntent.Builder().build().launchUrl(context, uri)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.TagsSection
|
||||||
import org.schabi.newpipe.ui.components.metadata.imageMetadataItem
|
import org.schabi.newpipe.ui.components.metadata.imageMetadataItem
|
||||||
import org.schabi.newpipe.ui.theme.AppTheme
|
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.Localization
|
||||||
import org.schabi.newpipe.util.NO_SERVICE_ID
|
import org.schabi.newpipe.util.NO_SERVICE_ID
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
@ -66,7 +67,7 @@ fun StreamDescriptionSection(streamInfo: StreamInfo) {
|
|||||||
val hasDescription = streamInfo.description != Description.EMPTY_DESCRIPTION
|
val hasDescription = streamInfo.description != Description.EMPTY_DESCRIPTION
|
||||||
val lazyListState = rememberLazyListState()
|
val lazyListState = rememberLazyListState()
|
||||||
|
|
||||||
LazyColumnScrollbar(state = lazyListState) {
|
LazyColumnScrollbar(state = lazyListState, settings = NewPipeScrollbarSettings) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(start = 12.dp, end = 12.dp)
|
.padding(start = 12.dp, end = 12.dp)
|
||||||
|
@ -5,6 +5,8 @@ import androidx.compose.material3.MaterialTheme
|
|||||||
import androidx.compose.material3.darkColorScheme
|
import androidx.compose.material3.darkColorScheme
|
||||||
import androidx.compose.material3.lightColorScheme
|
import androidx.compose.material3.lightColorScheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import my.nanihadesuka.compose.ScrollbarSettings
|
||||||
|
|
||||||
private val LightColors = lightColorScheme(
|
private val LightColors = lightColorScheme(
|
||||||
primary = md_theme_light_primary,
|
primary = md_theme_light_primary,
|
||||||
@ -70,6 +72,11 @@ private val DarkColors = darkColorScheme(
|
|||||||
scrim = md_theme_dark_scrim,
|
scrim = md_theme_dark_scrim,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val NewPipeScrollbarSettings = ScrollbarSettings(
|
||||||
|
thumbSelectedColor = md_theme_dark_primary,
|
||||||
|
thumbUnselectedColor = Color.Red
|
||||||
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppTheme(useDarkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
|
fun AppTheme(useDarkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
|
||||||
MaterialTheme(
|
MaterialTheme(
|
||||||
|
Loading…
Reference in New Issue
Block a user