@@ -13,7 +13,8 @@ import androidx.compose.ui.platform.LocalContext
1313import androidx.compose.ui.tooling.preview.Preview
1414import androidx.compose.ui.unit.dp
1515import org.schabi.newpipe.R
16- import org.schabi.newpipe.extractor.channel.ChannelInfo
16+ import org.schabi.newpipe.extractor.Image
17+ import org.schabi.newpipe.extractor.Image.ResolutionLevel
1718import org.schabi.newpipe.ui.components.metadata.ImageMetadataItem
1819import org.schabi.newpipe.ui.components.metadata.MetadataItem
1920import org.schabi.newpipe.ui.components.metadata.TagsSection
@@ -22,35 +23,35 @@ import org.schabi.newpipe.util.Localization
2223import org.schabi.newpipe.util.NO_SERVICE_ID
2324
2425@Composable
25- fun AboutChannelSection (channelInfo : ChannelInfo ) {
26+ fun AboutChannelSection (channelInfo : ParcelableChannelInfo ) {
2627 // This tab currently holds little information, so a lazy column isn't needed here.
2728 Column (
2829 modifier = Modifier .padding(12 .dp),
2930 verticalArrangement = Arrangement .spacedBy(4 .dp)
3031 ) {
31- val description = channelInfo.description
32- if (! description.isNullOrEmpty()) {
32+ val (serviceId, description, count, avatars, banners, tags) = channelInfo
33+
34+ if (description.isNotEmpty()) {
3335 Text (text = description)
3436 }
3537
36- val count = channelInfo.subscriberCount
3738 if (count != - 1L ) {
3839 MetadataItem (
3940 title = R .string.metadata_subscribers,
4041 value = Localization .shortCount(LocalContext .current, count)
4142 )
4243 }
4344
44- if (channelInfo. avatars.isNotEmpty()) {
45- ImageMetadataItem (R .string.metadata_avatars, channelInfo. avatars)
45+ if (avatars.isNotEmpty()) {
46+ ImageMetadataItem (R .string.metadata_avatars, avatars)
4647 }
4748
48- if (channelInfo. banners.isNotEmpty()) {
49- ImageMetadataItem (R .string.metadata_banners, channelInfo. banners)
49+ if (banners.isNotEmpty()) {
50+ ImageMetadataItem (R .string.metadata_banners, banners)
5051 }
5152
52- if (channelInfo. tags.isNotEmpty()) {
53- TagsSection (channelInfo. serviceId, channelInfo. tags)
53+ if (tags.isNotEmpty()) {
54+ TagsSection (serviceId, tags)
5455 }
5556 }
5657}
@@ -59,9 +60,18 @@ fun AboutChannelSection(channelInfo: ChannelInfo) {
5960@Preview(name = " Dark mode" , uiMode = Configuration .UI_MODE_NIGHT_YES )
6061@Composable
6162private fun AboutChannelSectionPreview () {
62- val info = ChannelInfo (NO_SERVICE_ID , " " , " " , " " , " " )
63- info.description = " This is an example description"
64- info.subscriberCount = 10
63+ val images = listOf (
64+ Image (" https://example.com/image_low.png" , 16 , 16 , ResolutionLevel .LOW ),
65+ Image (" https://example.com/image_mid.png" , 32 , 32 , ResolutionLevel .MEDIUM )
66+ )
67+ val info = ParcelableChannelInfo (
68+ serviceId = NO_SERVICE_ID ,
69+ description = " This is an example description" ,
70+ subscriberCount = 10 ,
71+ avatars = images,
72+ banners = images,
73+ tags = listOf (" Tag 1" , " Tag 2" )
74+ )
6575
6676 AppTheme {
6777 Surface (color = MaterialTheme .colorScheme.background) {
0 commit comments