Skip to content

Commit b6bd87a

Browse files
authored
Merge pull request #12609 from Stypox/image-vector-app-icon
2 parents b2d89a4 + b362014 commit b6bd87a

5 files changed

Lines changed: 108 additions & 96 deletions

File tree

app/src/main/java/org/schabi/newpipe/ui/components/about/AboutTab.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package org.schabi.newpipe.ui.components.about
22

33
import androidx.annotation.StringRes
4+
import androidx.compose.foundation.Image
45
import androidx.compose.foundation.layout.Arrangement
56
import androidx.compose.foundation.layout.Column
67
import androidx.compose.foundation.layout.Spacer
78
import androidx.compose.foundation.layout.fillMaxWidth
89
import androidx.compose.foundation.layout.height
910
import androidx.compose.foundation.layout.padding
11+
import androidx.compose.foundation.layout.size
1012
import androidx.compose.foundation.layout.wrapContentSize
1113
import androidx.compose.foundation.layout.wrapContentWidth
1214
import androidx.compose.foundation.rememberScrollState
@@ -16,7 +18,6 @@ import androidx.compose.material3.Text
1618
import androidx.compose.material3.TextButton
1719
import androidx.compose.runtime.Composable
1820
import androidx.compose.runtime.NonRestartableComposable
19-
import androidx.compose.runtime.remember
2021
import androidx.compose.ui.Alignment
2122
import androidx.compose.ui.Modifier
2223
import androidx.compose.ui.platform.LocalContext
@@ -26,13 +27,12 @@ import androidx.compose.ui.tooling.preview.Preview
2627
import androidx.compose.ui.tooling.preview.PreviewParameter
2728
import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider
2829
import androidx.compose.ui.unit.dp
29-
import androidx.core.content.ContextCompat.getDrawable
30-
import coil3.compose.AsyncImage
3130
import my.nanihadesuka.compose.ColumnScrollbar
3231
import org.schabi.newpipe.BuildConfig
3332
import org.schabi.newpipe.R
3433
import org.schabi.newpipe.ui.components.common.defaultThemedScrollbarSettings
3534
import org.schabi.newpipe.util.external_communication.ShareUtils
35+
import org.schabi.newpipe.util.image.NewPipeSquircleIcon
3636

3737
private val ABOUT_ITEMS = listOf(
3838
AboutData(R.string.faq_title, R.string.faq_description, R.string.faq, R.string.faq_url),
@@ -83,12 +83,10 @@ fun AboutTab() {
8383
.wrapContentSize(Alignment.Center),
8484
horizontalAlignment = Alignment.CenterHorizontally
8585
) {
86-
// note: the preview
87-
val context = LocalContext.current
88-
val launcherDrawable = remember { getDrawable(context, R.mipmap.ic_launcher) }
89-
AsyncImage(
90-
model = launcherDrawable,
86+
Image(
87+
imageVector = NewPipeSquircleIcon,
9188
contentDescription = stringResource(R.string.app_name),
89+
modifier = Modifier.size(64.dp),
9290
)
9391
Spacer(Modifier.height(4.dp))
9492
Text(
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package org.schabi.newpipe.util.image
2+
3+
import androidx.compose.foundation.Image
4+
import androidx.compose.runtime.Composable
5+
import androidx.compose.ui.graphics.Color
6+
import androidx.compose.ui.graphics.SolidColor
7+
import androidx.compose.ui.graphics.vector.ImageVector
8+
import androidx.compose.ui.graphics.vector.path
9+
import androidx.compose.ui.tooling.preview.Preview
10+
import androidx.compose.ui.unit.dp
11+
12+
/**
13+
* Generated with https://github.com/rafaeltonholo/svg-to-compose/
14+
* based on assets/newpipe_squircle.svg.
15+
*/
16+
val NewPipeSquircleIcon: ImageVector
17+
get() {
18+
val current = _newPipeIcon
19+
if (current != null) return current
20+
21+
return ImageVector.Builder(
22+
name = "org.schabi.newpipe.ui.theme.AppTheme.NewPipeSquircleIcon",
23+
defaultWidth = 100.0.dp,
24+
defaultHeight = 100.0.dp,
25+
viewportWidth = 100.0f,
26+
viewportHeight = 100.0f,
27+
).apply {
28+
// M0 50 C0 15 15 0 50 0 s50 15 50 50 -15 50 -50 50 S0 85 0 50
29+
path(
30+
fill = SolidColor(Color(0xFFCD201F)),
31+
) {
32+
// M 0 50
33+
moveTo(x = 0.0f, y = 50.0f)
34+
// C 0 15 15 0 50 0
35+
curveTo(
36+
x1 = 0.0f,
37+
y1 = 15.0f,
38+
x2 = 15.0f,
39+
y2 = 0.0f,
40+
x3 = 50.0f,
41+
y3 = 0.0f,
42+
)
43+
// s 50 15 50 50
44+
reflectiveCurveToRelative(
45+
dx1 = 50.0f,
46+
dy1 = 15.0f,
47+
dx2 = 50.0f,
48+
dy2 = 50.0f,
49+
)
50+
// s -15 50 -50 50
51+
reflectiveCurveToRelative(
52+
dx1 = -15.0f,
53+
dy1 = 50.0f,
54+
dx2 = -50.0f,
55+
dy2 = 50.0f,
56+
)
57+
// S 0 85 0 50
58+
reflectiveCurveTo(
59+
x1 = 0.0f,
60+
y1 = 85.0f,
61+
x2 = 0.0f,
62+
y2 = 50.0f,
63+
)
64+
}
65+
// M31.7 19.2 v61.7 l9.7 -5.73 V36 l23.8 14 -17.6 10.35 V71.5 L84 50
66+
path(
67+
fill = SolidColor(Color(0xFFFFFFFF)),
68+
) {
69+
// M 31.7 19.2
70+
moveTo(x = 31.7f, y = 19.2f)
71+
// v 61.7
72+
verticalLineToRelative(dy = 61.7f)
73+
// l 9.7 -5.73
74+
lineToRelative(dx = 9.7f, dy = -5.73f)
75+
// V 36
76+
verticalLineTo(y = 36.0f)
77+
// l 23.8 14
78+
lineToRelative(dx = 23.8f, dy = 14.0f)
79+
// l -17.6 10.35
80+
lineToRelative(dx = -17.6f, dy = 10.35f)
81+
// V 71.5
82+
verticalLineTo(y = 71.5f)
83+
// L 84 50
84+
lineTo(x = 84.0f, y = 50.0f)
85+
}
86+
}.build().also { _newPipeIcon = it }
87+
}
88+
89+
@Preview
90+
@Composable
91+
private fun IconPreview() {
92+
Image(
93+
imageVector = NewPipeSquircleIcon,
94+
contentDescription = null,
95+
)
96+
}
97+
98+
@Suppress("ObjectPropertyName")
99+
private var _newPipeIcon: ImageVector? = null

assets/NP logo v2.svg

Lines changed: 1 addition & 21 deletions
Loading

assets/newpipe_squircle.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/pure_logo.svg

Lines changed: 1 addition & 67 deletions
Loading

0 commit comments

Comments
 (0)