mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Show image tags even if image loading is disabled
This commit is contained in:
		| @@ -16,10 +16,10 @@ import org.schabi.newpipe.R | |||||||
| import org.schabi.newpipe.extractor.channel.ChannelInfo | import org.schabi.newpipe.extractor.channel.ChannelInfo | ||||||
| import org.schabi.newpipe.ui.components.metadata.ImageMetadataItem | import org.schabi.newpipe.ui.components.metadata.ImageMetadataItem | ||||||
| import org.schabi.newpipe.ui.components.metadata.MetadataItem | import org.schabi.newpipe.ui.components.metadata.MetadataItem | ||||||
|  | import org.schabi.newpipe.ui.components.metadata.TagsSection | ||||||
| import org.schabi.newpipe.ui.theme.AppTheme | import org.schabi.newpipe.ui.theme.AppTheme | ||||||
| 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 org.schabi.newpipe.util.image.ImageStrategy |  | ||||||
|  |  | ||||||
| @Composable | @Composable | ||||||
| fun AboutChannelSection(channelInfo: ChannelInfo) { | fun AboutChannelSection(channelInfo: ChannelInfo) { | ||||||
| @@ -41,12 +41,12 @@ fun AboutChannelSection(channelInfo: ChannelInfo) { | |||||||
|             ) |             ) | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         ImageStrategy.choosePreferredImage(channelInfo.avatars)?.let { |         if (channelInfo.avatars.isNotEmpty()) { | ||||||
|             ImageMetadataItem(R.string.metadata_avatars, channelInfo.avatars, it) |             ImageMetadataItem(R.string.metadata_avatars, channelInfo.avatars) | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         ImageStrategy.choosePreferredImage(channelInfo.banners)?.let { |         if (channelInfo.banners.isNotEmpty()) { | ||||||
|             ImageMetadataItem(R.string.metadata_banners, channelInfo.banners, it) |             ImageMetadataItem(R.string.metadata_banners, channelInfo.banners) | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (channelInfo.tags.isNotEmpty()) { |         if (channelInfo.tags.isNotEmpty()) { | ||||||
|   | |||||||
| @@ -26,22 +26,16 @@ import org.schabi.newpipe.util.image.ImageStrategy | |||||||
| import org.schabi.newpipe.util.image.PreferredImageQuality | import org.schabi.newpipe.util.image.PreferredImageQuality | ||||||
|  |  | ||||||
| @Composable | @Composable | ||||||
| fun ImageMetadataItem( | fun ImageMetadataItem(@StringRes title: Int, images: List<Image>) { | ||||||
|     @StringRes title: Int, |  | ||||||
|     images: List<Image>, |  | ||||||
|     preferredUrl: String? = ImageStrategy.choosePreferredImage(images) |  | ||||||
| ) { |  | ||||||
|     val context = LocalContext.current |     val context = LocalContext.current | ||||||
|     val imageLinks = remember { convertImagesToLinks(context, images, preferredUrl) } |     val imageLinks = remember(images) { convertImagesToLinks(context, images) } | ||||||
|  |  | ||||||
|     MetadataItem(title = title, value = imageLinks) |     MetadataItem(title = title, value = imageLinks) | ||||||
| } | } | ||||||
|  |  | ||||||
| private fun convertImagesToLinks( | private fun convertImagesToLinks(context: Context, images: List<Image>): AnnotatedString { | ||||||
|     context: Context, |     val preferredUrl = ImageStrategy.choosePreferredImage(images) | ||||||
|     images: List<Image>, |  | ||||||
|     preferredUrl: String? |  | ||||||
| ): AnnotatedString { |  | ||||||
|     fun imageSizeToText(size: Int): String { |     fun imageSizeToText(size: Int): String { | ||||||
|         return if (size == Image.HEIGHT_UNKNOWN) context.getString(R.string.question_mark) |         return if (size == Image.HEIGHT_UNKNOWN) context.getString(R.string.question_mark) | ||||||
|         else size.toString() |         else size.toString() | ||||||
|   | |||||||
| @@ -58,7 +58,6 @@ import org.schabi.newpipe.ui.components.metadata.TagsSection | |||||||
| import org.schabi.newpipe.ui.theme.AppTheme | import org.schabi.newpipe.ui.theme.AppTheme | ||||||
| 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 org.schabi.newpipe.util.image.ImageStrategy |  | ||||||
| import java.time.OffsetDateTime | import java.time.OffsetDateTime | ||||||
|  |  | ||||||
| @OptIn(ExperimentalMaterial3Api::class) | @OptIn(ExperimentalMaterial3Api::class) | ||||||
| @@ -161,12 +160,10 @@ fun VideoDescriptionSection(streamInfo: StreamInfo) { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (streamInfo.ageLimit != StreamExtractor.NO_AGE_LIMIT) { |             val ageLimit = streamInfo.ageLimit | ||||||
|  |             if (ageLimit != StreamExtractor.NO_AGE_LIMIT) { | ||||||
|                 item { |                 item { | ||||||
|                     MetadataItem( |                     MetadataItem(title = R.string.metadata_age_limit, value = ageLimit.toString()) | ||||||
|                         title = R.string.metadata_age_limit, |  | ||||||
|                         value = streamInfo.ageLimit.toString() |  | ||||||
|                     ) |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
| @@ -214,9 +211,9 @@ private fun LazyListScope.metadataItem(@StringRes title: Int, value: String) { | |||||||
| } | } | ||||||
|  |  | ||||||
| private fun LazyListScope.imageMetadataItem(@StringRes title: Int, images: List<Image>) { | private fun LazyListScope.imageMetadataItem(@StringRes title: Int, images: List<Image>) { | ||||||
|     ImageStrategy.choosePreferredImage(images)?.let { |     if (images.isNotEmpty()) { | ||||||
|         item { |         item { | ||||||
|             ImageMetadataItem(title, images, it) |             ImageMetadataItem(title, images) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Isira Seneviratne
					Isira Seneviratne