Skip to content

Commit a92a285

Browse files
committed
Use Icons.Default.* instead of vector assets
1 parent 800961c commit a92a285

4 files changed

Lines changed: 35 additions & 23 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ dependencies {
301301
implementation 'androidx.compose.ui:ui-tooling-preview'
302302
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose'
303303
implementation 'androidx.compose.ui:ui-text' // Needed for parsing HTML to AnnotatedString
304+
implementation 'androidx.compose.material:material-icons-extended'
304305

305306
// Jetpack Compose related dependencies
306307
implementation 'androidx.paging:paging-compose:3.3.2'

app/src/main/java/org/schabi/newpipe/ui/components/items/playlist/PlaylistThumbnail.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
package org.schabi.newpipe.ui.components.items.playlist
22

3-
import androidx.compose.foundation.Image
43
import androidx.compose.foundation.background
54
import androidx.compose.foundation.layout.Box
65
import androidx.compose.foundation.layout.Row
76
import androidx.compose.foundation.layout.padding
87
import androidx.compose.foundation.layout.size
8+
import androidx.compose.material.icons.Icons
9+
import androidx.compose.material.icons.automirrored.filled.PlaylistPlay
10+
import androidx.compose.material3.Icon
911
import androidx.compose.material3.MaterialTheme
1012
import androidx.compose.material3.Text
1113
import androidx.compose.runtime.Composable
1214
import androidx.compose.ui.Alignment
1315
import androidx.compose.ui.Modifier
1416
import androidx.compose.ui.graphics.Color
15-
import androidx.compose.ui.graphics.ColorFilter
1617
import androidx.compose.ui.layout.ContentScale
1718
import androidx.compose.ui.platform.LocalContext
1819
import androidx.compose.ui.res.painterResource
@@ -46,10 +47,10 @@ fun PlaylistThumbnail(
4647
.padding(2.dp),
4748
verticalAlignment = Alignment.CenterVertically
4849
) {
49-
Image(
50-
painter = painterResource(R.drawable.ic_playlist_play),
50+
Icon(
51+
imageVector = Icons.AutoMirrored.Default.PlaylistPlay,
5152
contentDescription = null,
52-
colorFilter = ColorFilter.tint(Color.White),
53+
tint = Color.White,
5354
modifier = Modifier.size(18.dp)
5455
)
5556

app/src/main/java/org/schabi/newpipe/ui/components/video/comment/Comment.kt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import android.os.Build
55
import android.widget.Toast
66
import androidx.compose.animation.animateContentSize
77
import androidx.compose.foundation.ExperimentalFoundationApi
8-
import androidx.compose.foundation.Image
98
import androidx.compose.foundation.clickable
109
import androidx.compose.foundation.combinedClickable
1110
import androidx.compose.foundation.layout.Arrangement
@@ -15,6 +14,11 @@ import androidx.compose.foundation.layout.fillMaxWidth
1514
import androidx.compose.foundation.layout.padding
1615
import androidx.compose.foundation.layout.size
1716
import androidx.compose.foundation.shape.CircleShape
17+
import androidx.compose.material.icons.Icons
18+
import androidx.compose.material.icons.filled.Favorite
19+
import androidx.compose.material.icons.filled.PushPin
20+
import androidx.compose.material.icons.filled.ThumbUp
21+
import androidx.compose.material3.Icon
1822
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
1923
import androidx.compose.material3.MaterialTheme
2024
import androidx.compose.material3.Surface
@@ -94,11 +98,11 @@ fun Comment(comment: CommentsInfoItem, onCommentAuthorOpened: () -> Unit) {
9498
Column {
9599
Row(verticalAlignment = Alignment.CenterVertically) {
96100
if (comment.isPinned) {
97-
Image(
98-
painter = painterResource(R.drawable.ic_pin),
101+
Icon(
102+
imageVector = Icons.Default.PushPin,
99103
contentDescription = stringResource(R.string.detail_pinned_comment_view_description),
100104
modifier = Modifier
101-
.padding(start = 1.dp, end = 4.dp)
105+
.padding(end = 3.dp)
102106
.size(20.dp)
103107
)
104108
}
@@ -138,8 +142,8 @@ fun Comment(comment: CommentsInfoItem, onCommentAuthorOpened: () -> Unit) {
138142
) {
139143
// do not show anything if the like count is unknown
140144
if (comment.likeCount >= 0) {
141-
Image(
142-
painter = painterResource(R.drawable.ic_thumb_up),
145+
Icon(
146+
imageVector = Icons.Default.ThumbUp,
143147
contentDescription = stringResource(R.string.detail_likes_img_view_description),
144148
modifier = Modifier
145149
.padding(end = 4.dp)
@@ -154,9 +158,10 @@ fun Comment(comment: CommentsInfoItem, onCommentAuthorOpened: () -> Unit) {
154158
}
155159

156160
if (comment.isHeartedByUploader) {
157-
Image(
158-
painter = painterResource(R.drawable.ic_heart),
161+
Icon(
162+
imageVector = Icons.Default.Favorite,
159163
contentDescription = stringResource(R.string.detail_heart_img_view_description),
164+
tint = MaterialTheme.colorScheme.primary,
160165
modifier = Modifier.size(20.dp),
161166
)
162167
}

app/src/main/java/org/schabi/newpipe/ui/components/video/comment/CommentRepliesHeader.kt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.schabi.newpipe.ui.components.video.comment
22

33
import android.content.res.Configuration
4-
import androidx.compose.foundation.Image
54
import androidx.compose.foundation.clickable
65
import androidx.compose.foundation.layout.Arrangement
76
import androidx.compose.foundation.layout.Column
@@ -10,6 +9,11 @@ import androidx.compose.foundation.layout.fillMaxWidth
109
import androidx.compose.foundation.layout.padding
1110
import androidx.compose.foundation.layout.size
1211
import androidx.compose.foundation.shape.CircleShape
12+
import androidx.compose.material.icons.Icons
13+
import androidx.compose.material.icons.filled.Favorite
14+
import androidx.compose.material.icons.filled.PushPin
15+
import androidx.compose.material.icons.filled.ThumbUp
16+
import androidx.compose.material3.Icon
1317
import androidx.compose.material3.MaterialTheme
1418
import androidx.compose.material3.Surface
1519
import androidx.compose.material3.Text
@@ -92,9 +96,9 @@ fun CommentRepliesHeader(comment: CommentsInfoItem, onCommentAuthorOpened: () ->
9296
) {
9397
// do not show anything if the like count is unknown
9498
if (comment.likeCount >= 0) {
95-
Image(
96-
painter = painterResource(R.drawable.ic_thumb_up),
97-
contentDescription = stringResource(R.string.detail_likes_img_view_description)
99+
Icon(
100+
imageVector = Icons.Default.ThumbUp,
101+
contentDescription = stringResource(R.string.detail_likes_img_view_description),
98102
)
99103
Text(
100104
text = Localization.likeCount(context, comment.likeCount),
@@ -103,16 +107,17 @@ fun CommentRepliesHeader(comment: CommentsInfoItem, onCommentAuthorOpened: () ->
103107
}
104108

105109
if (comment.isHeartedByUploader) {
106-
Image(
107-
painter = painterResource(R.drawable.ic_heart),
108-
contentDescription = stringResource(R.string.detail_heart_img_view_description)
110+
Icon(
111+
imageVector = Icons.Default.Favorite,
112+
contentDescription = stringResource(R.string.detail_heart_img_view_description),
113+
tint = MaterialTheme.colorScheme.primary,
109114
)
110115
}
111116

112117
if (comment.isPinned) {
113-
Image(
114-
painter = painterResource(R.drawable.ic_pin),
115-
contentDescription = stringResource(R.string.detail_pinned_comment_view_description)
118+
Icon(
119+
imageVector = Icons.Default.PushPin,
120+
contentDescription = stringResource(R.string.detail_pinned_comment_view_description),
116121
)
117122
}
118123
}

0 commit comments

Comments
 (0)