Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate video description and about channel fragments to Jetpack Compose #11489

Open
wants to merge 21 commits into
base: refactor
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
99996d9
Rename .java to .kt
Isira-Seneviratne Aug 27, 2024
de6285b
Migrate description fragment to Jetpack Compose
Isira-Seneviratne Aug 27, 2024
2653787
Migrate about channel fragment to Jetpack Compose
Isira-Seneviratne Sep 1, 2024
507b3b4
Show image tags even if image loading is disabled
Isira-Seneviratne Sep 1, 2024
45aa445
Fix crash when minimizing the channel about tab
Isira-Seneviratne Sep 1, 2024
a094abd
Use constant
Isira-Seneviratne Sep 1, 2024
bbbb7f5
Use textAlign in TagsSection
Isira-Seneviratne Sep 1, 2024
387a4d5
Rm unused layouts
Isira-Seneviratne Sep 1, 2024
bc87575
Allow scrolling of about channel section
Isira-Seneviratne Sep 2, 2024
c4efd2f
Update dependencies
Isira-Seneviratne Sep 2, 2024
31d164d
Update dependencies
Isira-Seneviratne Sep 5, 2024
8f9faf3
Address some review comments
Isira-Seneviratne Sep 6, 2024
0d12cfc
Remove AndroidX Browser, make scrollbars red
Isira-Seneviratne Sep 6, 2024
1f4298b
Avoid issues if context is a ContextWrapper
Isira-Seneviratne Sep 11, 2024
cd96927
Merge branch 'refactor' into Video-description-compose
Isira-Seneviratne Nov 21, 2024
a69c48a
Reuse LazyColumnThemedScrollbar
Isira-Seneviratne Nov 21, 2024
d000840
Merge branch 'refactor' into Video-description-compose
Isira-Seneviratne Nov 28, 2024
03d65a0
Merge branch 'refactor' into Video-description-compose
Isira-Seneviratne Dec 21, 2024
a0e5ae4
Use font styling
Isira-Seneviratne Dec 21, 2024
820888d
Merge remote-tracking branch 'newpipe/refactor' into Video-descriptio…
Isira-Seneviratne Jan 27, 2025
f992132
Merge branch 'refactor' into Video-description-compose
Isira-Seneviratne Feb 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove AndroidX Browser, make scrollbars red
Isira-Seneviratne committed Sep 6, 2024
commit 0d12cfc9833a890a02c574f97e70834d3348214e
3 changes: 0 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -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}"
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
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
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) {
NavigationHelper.openSearch(
context, ServiceList.YouTube.serviceId, "#${uri.lastPathSegment}"
)
} else {
// Open link in custom browser tab.
CustomTabsIntent.Builder().build().launchUrl(context, uri)
uriHandler.openUri(url)
}
}
}
Original file line number Diff line number Diff line change
@@ -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)
7 changes: 7 additions & 0 deletions app/src/main/java/org/schabi/newpipe/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
@@ -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(