From 9d3775f132ee4213bec224f7bd2b2b1689aead77 Mon Sep 17 00:00:00 2001 From: Stypox Date: Sat, 6 Sep 2025 17:06:47 +0200 Subject: [PATCH 1/2] Rewrite logo SVGs to make them line-only Also optimize them with svgo --- assets/NP logo v2.svg | 22 +----------- assets/newpipe_squircle.svg | 1 + assets/pure_logo.svg | 68 +------------------------------------ 3 files changed, 3 insertions(+), 88 deletions(-) create mode 100644 assets/newpipe_squircle.svg diff --git a/assets/NP logo v2.svg b/assets/NP logo v2.svg index 51fdf95de..88bf3d33d 100644 --- a/assets/NP logo v2.svg +++ b/assets/NP logo v2.svg @@ -1,21 +1 @@ - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/assets/newpipe_squircle.svg b/assets/newpipe_squircle.svg new file mode 100644 index 000000000..91358d421 --- /dev/null +++ b/assets/newpipe_squircle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/pure_logo.svg b/assets/pure_logo.svg index 4455b19c6..c4473eb9b 100644 --- a/assets/pure_logo.svg +++ b/assets/pure_logo.svg @@ -1,67 +1 @@ - - - -image/svg+xml - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file From b36201442d6f7c2ffa43c7035b14bb9f96bcb924 Mon Sep 17 00:00:00 2001 From: Stypox Date: Sat, 6 Sep 2025 17:22:43 +0200 Subject: [PATCH 2/2] Use ImageVector to render NewPipe squircle app icon --- .../newpipe/ui/components/about/AboutTab.kt | 14 ++- .../newpipe/util/image/NewPipeSquircleIcon.kt | 99 +++++++++++++++++++ 2 files changed, 105 insertions(+), 8 deletions(-) create mode 100644 app/src/main/java/org/schabi/newpipe/util/image/NewPipeSquircleIcon.kt diff --git a/app/src/main/java/org/schabi/newpipe/ui/components/about/AboutTab.kt b/app/src/main/java/org/schabi/newpipe/ui/components/about/AboutTab.kt index 3bba5dba9..dbb10b9a8 100644 --- a/app/src/main/java/org/schabi/newpipe/ui/components/about/AboutTab.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/about/AboutTab.kt @@ -1,12 +1,14 @@ package org.schabi.newpipe.ui.components.about import androidx.annotation.StringRes +import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.foundation.rememberScrollState @@ -16,7 +18,6 @@ import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.NonRestartableComposable -import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier 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.datasource.CollectionPreviewParameterProvider import androidx.compose.ui.unit.dp -import androidx.core.content.ContextCompat.getDrawable -import coil3.compose.AsyncImage import my.nanihadesuka.compose.ColumnScrollbar import org.schabi.newpipe.BuildConfig import org.schabi.newpipe.R import org.schabi.newpipe.ui.components.common.defaultThemedScrollbarSettings import org.schabi.newpipe.util.external_communication.ShareUtils +import org.schabi.newpipe.util.image.NewPipeSquircleIcon private val ABOUT_ITEMS = listOf( 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), horizontalAlignment = Alignment.CenterHorizontally ) { - // note: the preview - val context = LocalContext.current - val launcherDrawable = remember { getDrawable(context, R.mipmap.ic_launcher) } - AsyncImage( - model = launcherDrawable, + Image( + imageVector = NewPipeSquircleIcon, contentDescription = stringResource(R.string.app_name), + modifier = Modifier.size(64.dp), ) Spacer(Modifier.height(4.dp)) Text( diff --git a/app/src/main/java/org/schabi/newpipe/util/image/NewPipeSquircleIcon.kt b/app/src/main/java/org/schabi/newpipe/util/image/NewPipeSquircleIcon.kt new file mode 100644 index 000000000..a4ff131a1 --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/util/image/NewPipeSquircleIcon.kt @@ -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