1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-05-05 08:54:09 +00:00

Use Icons.Default.* instead of vector assets

This commit is contained in:
Stypox 2024-11-11 14:25:12 +01:00
parent 800961c3d7
commit a92a28517e
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
4 changed files with 35 additions and 23 deletions

View File

@ -301,6 +301,7 @@ dependencies {
implementation 'androidx.compose.ui:ui-tooling-preview' implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose' implementation 'androidx.lifecycle:lifecycle-viewmodel-compose'
implementation 'androidx.compose.ui:ui-text' // Needed for parsing HTML to AnnotatedString implementation 'androidx.compose.ui:ui-text' // Needed for parsing HTML to AnnotatedString
implementation 'androidx.compose.material:material-icons-extended'
// Jetpack Compose related dependencies // Jetpack Compose related dependencies
implementation 'androidx.paging:paging-compose:3.3.2' implementation 'androidx.paging:paging-compose:3.3.2'

View File

@ -1,18 +1,19 @@
package org.schabi.newpipe.ui.components.items.playlist package org.schabi.newpipe.ui.components.items.playlist
import androidx.compose.foundation.Image
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size 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.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
@ -46,10 +47,10 @@ fun PlaylistThumbnail(
.padding(2.dp), .padding(2.dp),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Image( Icon(
painter = painterResource(R.drawable.ic_playlist_play), imageVector = Icons.AutoMirrored.Default.PlaylistPlay,
contentDescription = null, contentDescription = null,
colorFilter = ColorFilter.tint(Color.White), tint = Color.White,
modifier = Modifier.size(18.dp) modifier = Modifier.size(18.dp)
) )

View File

@ -5,7 +5,6 @@ import android.os.Build
import android.widget.Toast import android.widget.Toast
import androidx.compose.animation.animateContentSize import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Arrangement 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.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape 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.LocalMinimumInteractiveComponentSize
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
@ -94,11 +98,11 @@ fun Comment(comment: CommentsInfoItem, onCommentAuthorOpened: () -> Unit) {
Column { Column {
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
if (comment.isPinned) { if (comment.isPinned) {
Image( Icon(
painter = painterResource(R.drawable.ic_pin), imageVector = Icons.Default.PushPin,
contentDescription = stringResource(R.string.detail_pinned_comment_view_description), contentDescription = stringResource(R.string.detail_pinned_comment_view_description),
modifier = Modifier modifier = Modifier
.padding(start = 1.dp, end = 4.dp) .padding(end = 3.dp)
.size(20.dp) .size(20.dp)
) )
} }
@ -138,8 +142,8 @@ fun Comment(comment: CommentsInfoItem, onCommentAuthorOpened: () -> Unit) {
) { ) {
// do not show anything if the like count is unknown // do not show anything if the like count is unknown
if (comment.likeCount >= 0) { if (comment.likeCount >= 0) {
Image( Icon(
painter = painterResource(R.drawable.ic_thumb_up), imageVector = Icons.Default.ThumbUp,
contentDescription = stringResource(R.string.detail_likes_img_view_description), contentDescription = stringResource(R.string.detail_likes_img_view_description),
modifier = Modifier modifier = Modifier
.padding(end = 4.dp) .padding(end = 4.dp)
@ -154,9 +158,10 @@ fun Comment(comment: CommentsInfoItem, onCommentAuthorOpened: () -> Unit) {
} }
if (comment.isHeartedByUploader) { if (comment.isHeartedByUploader) {
Image( Icon(
painter = painterResource(R.drawable.ic_heart), imageVector = Icons.Default.Favorite,
contentDescription = stringResource(R.string.detail_heart_img_view_description), contentDescription = stringResource(R.string.detail_heart_img_view_description),
tint = MaterialTheme.colorScheme.primary,
modifier = Modifier.size(20.dp), modifier = Modifier.size(20.dp),
) )
} }

View File

@ -1,7 +1,6 @@
package org.schabi.newpipe.ui.components.video.comment package org.schabi.newpipe.ui.components.video.comment
import android.content.res.Configuration import android.content.res.Configuration
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column 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.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape 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.MaterialTheme
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
@ -92,9 +96,9 @@ fun CommentRepliesHeader(comment: CommentsInfoItem, onCommentAuthorOpened: () ->
) { ) {
// do not show anything if the like count is unknown // do not show anything if the like count is unknown
if (comment.likeCount >= 0) { if (comment.likeCount >= 0) {
Image( Icon(
painter = painterResource(R.drawable.ic_thumb_up), imageVector = Icons.Default.ThumbUp,
contentDescription = stringResource(R.string.detail_likes_img_view_description) contentDescription = stringResource(R.string.detail_likes_img_view_description),
) )
Text( Text(
text = Localization.likeCount(context, comment.likeCount), text = Localization.likeCount(context, comment.likeCount),
@ -103,16 +107,17 @@ fun CommentRepliesHeader(comment: CommentsInfoItem, onCommentAuthorOpened: () ->
} }
if (comment.isHeartedByUploader) { if (comment.isHeartedByUploader) {
Image( Icon(
painter = painterResource(R.drawable.ic_heart), imageVector = Icons.Default.Favorite,
contentDescription = stringResource(R.string.detail_heart_img_view_description) contentDescription = stringResource(R.string.detail_heart_img_view_description),
tint = MaterialTheme.colorScheme.primary,
) )
} }
if (comment.isPinned) { if (comment.isPinned) {
Image( Icon(
painter = painterResource(R.drawable.ic_pin), imageVector = Icons.Default.PushPin,
contentDescription = stringResource(R.string.detail_pinned_comment_view_description) contentDescription = stringResource(R.string.detail_pinned_comment_view_description),
) )
} }
} }