1
0
Fork 0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2025-10-03 09:49:21 +02:00

Merge pull request #12609 from Stypox/image-vector-app-icon

This commit is contained in:
Stypox 2025-09-06 18:01:10 +02:00 committed by GitHub
commit b6bd87a4dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 108 additions and 96 deletions

View file

@ -1,12 +1,14 @@
package org.schabi.newpipe.ui.components.about package org.schabi.newpipe.ui.components.about
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
@ -16,7 +18,6 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextButton import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.NonRestartableComposable import androidx.compose.runtime.NonRestartableComposable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
@ -26,13 +27,12 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat.getDrawable
import coil3.compose.AsyncImage
import my.nanihadesuka.compose.ColumnScrollbar import my.nanihadesuka.compose.ColumnScrollbar
import org.schabi.newpipe.BuildConfig import org.schabi.newpipe.BuildConfig
import org.schabi.newpipe.R import org.schabi.newpipe.R
import org.schabi.newpipe.ui.components.common.defaultThemedScrollbarSettings import org.schabi.newpipe.ui.components.common.defaultThemedScrollbarSettings
import org.schabi.newpipe.util.external_communication.ShareUtils import org.schabi.newpipe.util.external_communication.ShareUtils
import org.schabi.newpipe.util.image.NewPipeSquircleIcon
private val ABOUT_ITEMS = listOf( private val ABOUT_ITEMS = listOf(
AboutData(R.string.faq_title, R.string.faq_description, R.string.faq, R.string.faq_url), AboutData(R.string.faq_title, R.string.faq_description, R.string.faq, R.string.faq_url),
@ -83,12 +83,10 @@ fun AboutTab() {
.wrapContentSize(Alignment.Center), .wrapContentSize(Alignment.Center),
horizontalAlignment = Alignment.CenterHorizontally horizontalAlignment = Alignment.CenterHorizontally
) { ) {
// note: the preview Image(
val context = LocalContext.current imageVector = NewPipeSquircleIcon,
val launcherDrawable = remember { getDrawable(context, R.mipmap.ic_launcher) }
AsyncImage(
model = launcherDrawable,
contentDescription = stringResource(R.string.app_name), contentDescription = stringResource(R.string.app_name),
modifier = Modifier.size(64.dp),
) )
Spacer(Modifier.height(4.dp)) Spacer(Modifier.height(4.dp))
Text( Text(

View file

@ -0,0 +1,99 @@
package org.schabi.newpipe.util.image
import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
/**
* Generated with https://github.com/rafaeltonholo/svg-to-compose/
* based on assets/newpipe_squircle.svg.
*/
val NewPipeSquircleIcon: ImageVector
get() {
val current = _newPipeIcon
if (current != null) return current
return ImageVector.Builder(
name = "org.schabi.newpipe.ui.theme.AppTheme.NewPipeSquircleIcon",
defaultWidth = 100.0.dp,
defaultHeight = 100.0.dp,
viewportWidth = 100.0f,
viewportHeight = 100.0f,
).apply {
// M0 50 C0 15 15 0 50 0 s50 15 50 50 -15 50 -50 50 S0 85 0 50
path(
fill = SolidColor(Color(0xFFCD201F)),
) {
// M 0 50
moveTo(x = 0.0f, y = 50.0f)
// C 0 15 15 0 50 0
curveTo(
x1 = 0.0f,
y1 = 15.0f,
x2 = 15.0f,
y2 = 0.0f,
x3 = 50.0f,
y3 = 0.0f,
)
// s 50 15 50 50
reflectiveCurveToRelative(
dx1 = 50.0f,
dy1 = 15.0f,
dx2 = 50.0f,
dy2 = 50.0f,
)
// s -15 50 -50 50
reflectiveCurveToRelative(
dx1 = -15.0f,
dy1 = 50.0f,
dx2 = -50.0f,
dy2 = 50.0f,
)
// S 0 85 0 50
reflectiveCurveTo(
x1 = 0.0f,
y1 = 85.0f,
x2 = 0.0f,
y2 = 50.0f,
)
}
// M31.7 19.2 v61.7 l9.7 -5.73 V36 l23.8 14 -17.6 10.35 V71.5 L84 50
path(
fill = SolidColor(Color(0xFFFFFFFF)),
) {
// M 31.7 19.2
moveTo(x = 31.7f, y = 19.2f)
// v 61.7
verticalLineToRelative(dy = 61.7f)
// l 9.7 -5.73
lineToRelative(dx = 9.7f, dy = -5.73f)
// V 36
verticalLineTo(y = 36.0f)
// l 23.8 14
lineToRelative(dx = 23.8f, dy = 14.0f)
// l -17.6 10.35
lineToRelative(dx = -17.6f, dy = 10.35f)
// V 71.5
verticalLineTo(y = 71.5f)
// L 84 50
lineTo(x = 84.0f, y = 50.0f)
}
}.build().also { _newPipeIcon = it }
}
@Preview
@Composable
private fun IconPreview() {
Image(
imageVector = NewPipeSquircleIcon,
contentDescription = null,
)
}
@Suppress("ObjectPropertyName")
private var _newPipeIcon: ImageVector? = null

View file

@ -1,21 +1 @@
<?xml version="1.0" encoding="utf-8"?> <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><circle cx="50" cy="50" r="50" style="fill:#cd201f"/><path d="M31.7 19.2v61.7l9.7-5.73V36l23.8 14-17.6 10.35V71.5L84 50" style="fill:#fff"/></svg>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
<style type="text/css">
.st0{fill:#CD201F;}
.st1{fill:#FFFFFF;}
</style>
<g id="Alapkör">
<circle id="XMLID_23_" class="st0" cx="50" cy="50" r="50"/>
</g>
<g id="Elemek">
<path id="XMLID_19_" class="st1" d="M47,28.2c-9-5.3-15.3-9-15.3-9v61.7c0,0,30.4-18,52.3-30.9C72.1,43,57.7,34.5,47,28.2z"/>
</g>
<g id="Fedő">
<path id="XMLID_5_" class="st0" d="M48.4,40.1c-4.1-2.4-7-4.1-7-4.1V64c0,0,13.9-8.2,23.8-14C59.8,46.8,53.3,42.9,48.4,40.1z"/>
<rect id="XMLID_4_" x="41.4" y="55.6" class="st0" width="6.2" height="21"/>
</g>
<g id="Vonalak">
</g>
</svg>

Before

Width:  |  Height:  |  Size: 850 B

After

Width:  |  Height:  |  Size: 229 B

Before After
Before After

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><path d="M0 50C0 15 15 0 50 0s50 15 50 50-15 50-50 50S0 85 0 50" style="fill:#cd201f"/><path d="M31.7 19.2v61.7l9.7-5.73V36l23.8 14-17.6 10.35V71.5L84 50" style="fill:#fff"/></svg>

After

Width:  |  Height:  |  Size: 263 B

View file

@ -1,67 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><path d="M31.7 19.2v61.7l9.7-5.73V36l23.8 14-17.6 10.35V71.5L84 50" style="fill:#fff"/></svg>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 100 100"
style="enable-background:new 0 0 100 100;"
xml:space="preserve"
id="svg12"
sodipodi:docname="NP logo v2.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata
id="metadata18"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs16">
</defs><sodipodi:namedview
pagecolor="#9f9f9f"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="740"
id="namedview14"
showgrid="false"
inkscape:zoom="1.668772"
inkscape:cx="63.900143"
inkscape:cy="31.160181"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg12" />
<style
type="text/css"
id="style2">
.st0{fill:#CD201F;}
.st1{fill:#FFFFFF;}
</style>
<path
style="fill:#ffffff;stroke-width:1.2782383"
d="m 23.90906,10.210574 v 78.8688 c 0,0 7.70042,-4.556206 12.400409,-7.337388 V 67.476647 56.738946 31.685975 c 0,0 3.706891,2.172506 8.947669,5.240278 6.263367,3.579067 14.570418,8.564696 21.472905,12.655059 -9.358315,5.482649 -16.799873,9.875994 -22.496496,13.23426 V 77.053449 C 57.973932,68.927101 75.175728,58.76222 90.76192,49.581312 75.550885,40.633643 57.144253,29.76762 43.467104,21.714718 31.962959,14.940056 23.90906,10.210574 23.90906,10.210574 Z"
id="XMLID_19_"
inkscape:connector-curvature="0" />
<g
id="Vonalak">
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 176 B

Before After
Before After