From a92a28517ec4e3cd4d13ec47d6db1dc9ff622e4c Mon Sep 17 00:00:00 2001 From: Stypox Date: Mon, 11 Nov 2024 14:25:12 +0100 Subject: [PATCH] Use Icons.Default.* instead of vector assets --- app/build.gradle | 1 + .../items/playlist/PlaylistThumbnail.kt | 11 ++++---- .../ui/components/video/comment/Comment.kt | 21 ++++++++++------ .../video/comment/CommentRepliesHeader.kt | 25 +++++++++++-------- 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1cd2ede51..24e3d32cf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -301,6 +301,7 @@ dependencies { implementation 'androidx.compose.ui:ui-tooling-preview' implementation 'androidx.lifecycle:lifecycle-viewmodel-compose' implementation 'androidx.compose.ui:ui-text' // Needed for parsing HTML to AnnotatedString + implementation 'androidx.compose.material:material-icons-extended' // Jetpack Compose related dependencies implementation 'androidx.paging:paging-compose:3.3.2' diff --git a/app/src/main/java/org/schabi/newpipe/ui/components/items/playlist/PlaylistThumbnail.kt b/app/src/main/java/org/schabi/newpipe/ui/components/items/playlist/PlaylistThumbnail.kt index 3fc139119..b1d4d200c 100644 --- a/app/src/main/java/org/schabi/newpipe/ui/components/items/playlist/PlaylistThumbnail.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/items/playlist/PlaylistThumbnail.kt @@ -1,18 +1,19 @@ package org.schabi.newpipe.ui.components.items.playlist -import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.PlaylistPlay +import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource @@ -46,10 +47,10 @@ fun PlaylistThumbnail( .padding(2.dp), verticalAlignment = Alignment.CenterVertically ) { - Image( - painter = painterResource(R.drawable.ic_playlist_play), + Icon( + imageVector = Icons.AutoMirrored.Default.PlaylistPlay, contentDescription = null, - colorFilter = ColorFilter.tint(Color.White), + tint = Color.White, modifier = Modifier.size(18.dp) ) diff --git a/app/src/main/java/org/schabi/newpipe/ui/components/video/comment/Comment.kt b/app/src/main/java/org/schabi/newpipe/ui/components/video/comment/Comment.kt index d10749267..ca6114a88 100644 --- a/app/src/main/java/org/schabi/newpipe/ui/components/video/comment/Comment.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/video/comment/Comment.kt @@ -5,7 +5,6 @@ import android.os.Build import android.widget.Toast import androidx.compose.animation.animateContentSize import androidx.compose.foundation.ExperimentalFoundationApi -import androidx.compose.foundation.Image import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Arrangement @@ -15,6 +14,11 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Favorite +import androidx.compose.material.icons.filled.PushPin +import androidx.compose.material.icons.filled.ThumbUp +import androidx.compose.material3.Icon import androidx.compose.material3.LocalMinimumInteractiveComponentSize import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface @@ -94,11 +98,11 @@ fun Comment(comment: CommentsInfoItem, onCommentAuthorOpened: () -> Unit) { Column { Row(verticalAlignment = Alignment.CenterVertically) { if (comment.isPinned) { - Image( - painter = painterResource(R.drawable.ic_pin), + Icon( + imageVector = Icons.Default.PushPin, contentDescription = stringResource(R.string.detail_pinned_comment_view_description), modifier = Modifier - .padding(start = 1.dp, end = 4.dp) + .padding(end = 3.dp) .size(20.dp) ) } @@ -138,8 +142,8 @@ fun Comment(comment: CommentsInfoItem, onCommentAuthorOpened: () -> Unit) { ) { // do not show anything if the like count is unknown if (comment.likeCount >= 0) { - Image( - painter = painterResource(R.drawable.ic_thumb_up), + Icon( + imageVector = Icons.Default.ThumbUp, contentDescription = stringResource(R.string.detail_likes_img_view_description), modifier = Modifier .padding(end = 4.dp) @@ -154,9 +158,10 @@ fun Comment(comment: CommentsInfoItem, onCommentAuthorOpened: () -> Unit) { } if (comment.isHeartedByUploader) { - Image( - painter = painterResource(R.drawable.ic_heart), + Icon( + imageVector = Icons.Default.Favorite, contentDescription = stringResource(R.string.detail_heart_img_view_description), + tint = MaterialTheme.colorScheme.primary, modifier = Modifier.size(20.dp), ) } diff --git a/app/src/main/java/org/schabi/newpipe/ui/components/video/comment/CommentRepliesHeader.kt b/app/src/main/java/org/schabi/newpipe/ui/components/video/comment/CommentRepliesHeader.kt index c1ddf61cb..95542092e 100644 --- a/app/src/main/java/org/schabi/newpipe/ui/components/video/comment/CommentRepliesHeader.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/video/comment/CommentRepliesHeader.kt @@ -1,7 +1,6 @@ package org.schabi.newpipe.ui.components.video.comment import android.content.res.Configuration -import androidx.compose.foundation.Image import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -10,6 +9,11 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Favorite +import androidx.compose.material.icons.filled.PushPin +import androidx.compose.material.icons.filled.ThumbUp +import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text @@ -92,9 +96,9 @@ fun CommentRepliesHeader(comment: CommentsInfoItem, onCommentAuthorOpened: () -> ) { // do not show anything if the like count is unknown if (comment.likeCount >= 0) { - Image( - painter = painterResource(R.drawable.ic_thumb_up), - contentDescription = stringResource(R.string.detail_likes_img_view_description) + Icon( + imageVector = Icons.Default.ThumbUp, + contentDescription = stringResource(R.string.detail_likes_img_view_description), ) Text( text = Localization.likeCount(context, comment.likeCount), @@ -103,16 +107,17 @@ fun CommentRepliesHeader(comment: CommentsInfoItem, onCommentAuthorOpened: () -> } if (comment.isHeartedByUploader) { - Image( - painter = painterResource(R.drawable.ic_heart), - contentDescription = stringResource(R.string.detail_heart_img_view_description) + Icon( + imageVector = Icons.Default.Favorite, + contentDescription = stringResource(R.string.detail_heart_img_view_description), + tint = MaterialTheme.colorScheme.primary, ) } if (comment.isPinned) { - Image( - painter = painterResource(R.drawable.ic_pin), - contentDescription = stringResource(R.string.detail_pinned_comment_view_description) + Icon( + imageVector = Icons.Default.PushPin, + contentDescription = stringResource(R.string.detail_pinned_comment_view_description), ) } }