Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,24 @@ and commit the regenerated native drawables and license.
Run `./gradlew :app:testDebugUnitTest --tests '*AdaptiveFilesTest'` for adaptive selection,
saved-state, and rendering checks. Rendering captures are written under
`app/build/outputs/design/`; these use Robolectric native graphics, not a device.

## Brand icons

The Feiya mark combines an F with two swept wings, using plum, off-white, and lime.
`res/drawable/ic_launcher_foreground.xml` is the color vector source; keep its shape
within the adaptive safe circle. `ic_launcher_monochrome.xml` supplies themed icons,
and `ic_notification.xml` uses an opaque white silhouette on transparency at 24 dp.
Both foreground-service notification builders must use the notification drawable.
The splash screen shares the adaptive foreground and background color.

After editing the vectors or `values/ic_launcher_background.xml`, regenerate legacy
launcher density PNGs and the in-app logo:

```sh
python3 -m venv /tmp/feiya-icons-venv
/tmp/feiya-icons-venv/bin/pip install CairoSVG==2.9.1
/tmp/feiya-icons-venv/bin/python scripts/update-brand-icons.py
./gradlew :app:processDebugResources
```

CairoSVG requires the native Cairo library.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class AppService : LifecycleService() {
private fun postForegroundNotify(message: String) {
// Foreground promotion is required even when notification permission is denied.
val notification = NotificationCompat.Builder(this, FOREGROUND_CHANNEL_ID)
.setSmallIcon(R.mipmap.ic_launcher)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle(getString(R.string.app_name))
.setContentText(message)
.setOngoing(true)
Expand All @@ -139,7 +139,7 @@ class AppService : LifecycleService() {
if (managerCompat.areNotificationsEnabled()) {
val notification =
NotificationCompat.Builder(this, DEFAULT_CHANNEL_ID)
.setSmallIcon(R.mipmap.ic_launcher)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle(getString(R.string.app_name))
.setContentText(message)
.build()
Expand Down
Binary file modified app/src/main/res/drawable-nodpi/feiya_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
170 changes: 3 additions & 167 deletions app/src/main/res/drawable/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -1,170 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:width="108dp" android:height="108dp"
android:viewportWidth="108" android:viewportHeight="108">
<path android:fillColor="@color/ic_launcher_background" android:pathData="M0,0H108V108H0Z" />
</vector>
24 changes: 8 additions & 16 deletions app/src/main/res/drawable/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="191"
android:viewportHeight="168.75">
<group android:scaleX="0.46"
android:scaleY="0.4064136"
android:translateX="51.57"
android:translateY="50.08385">
<group android:translateY="133.59375">
<path android:pathData="M68.34375,-45.210938L25.382812,-45.210938L25.382812,0L11.8828125,0L11.8828125,-102.375L75.30469,-102.375L75.30469,-91.265625L25.382812,-91.265625L25.382812,-56.25L68.34375,-56.25Z"
android:fillColor="#631D6B"/>
<path android:pathData="M121.41406,1.40625Q105.94531,1.40625,96.24219,-8.753906Q86.53906,-18.914062,86.53906,-35.929688L86.53906,-38.320312Q86.53906,-49.640625,90.86328,-58.535156Q95.1875,-67.42969,102.95703,-72.45703Q110.72656,-77.484375,119.796875,-77.484375Q134.63281,-77.484375,142.85938,-67.71094Q151.08594,-57.9375,151.08594,-39.726562L151.08594,-34.3125L99.546875,-34.3125Q99.828125,-23.0625,106.12109,-16.136719Q112.41406,-9.2109375,122.11719,-9.2109375Q129.00781,-9.2109375,133.78906,-12.0234375Q138.57031,-14.8359375,142.15625,-19.476562L150.10156,-13.2890625Q140.53906,1.40625,121.41406,1.40625ZM119.796875,-66.796875Q111.921875,-66.796875,106.578125,-61.066406Q101.234375,-55.335938,99.96875,-45L138.07812,-45L138.07812,-45.984375Q137.51562,-55.898438,132.73438,-61.347656Q127.953125,-66.796875,119.796875,-66.796875Z"
android:fillColor="#631D6B"/>
<path android:pathData="M179.97656,0L166.96875,0L166.96875,-76.078125L179.97656,-76.078125ZM165.91406,-96.25781Q165.91406,-99.421875,167.84766,-101.60156Q169.78125,-103.78125,173.57812,-103.78125Q177.375,-103.78125,179.34375,-101.60156Q181.3125,-99.421875,181.3125,-96.25781Q181.3125,-93.09375,179.34375,-90.984375Q177.375,-88.875,173.57812,-88.875Q169.78125,-88.875,167.84766,-90.984375Q165.91406,-93.09375,165.91406,-96.25781Z"
android:fillColor="#631D6B"/>
</group>
</group>
</vector>
android:viewportWidth="108"
android:viewportHeight="108">
<!-- The F and two swept wings stay inside the adaptive icon safe circle. -->
<path android:fillColor="#F5FFF5"
android:pathData="M32,33H78L66,45H44V75H32Z" />
<path android:fillColor="#B8EE97"
android:pathData="M48,50H69L57,62H48Z" />
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_launcher_monochrome.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:fillColor="#FFFFFFFF"
android:pathData="M32,33H78L66,45H44V75H32Z M48,50H69L57,62H48Z" />
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_notification.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF"
android:pathData="M3,3H23L17.8,8.2H8.2V21.3H3Z M10,10.4H19.1L13.9,15.6H10Z" />
</vector>
3 changes: 2 additions & 1 deletion app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
<monochrome android:drawable="@drawable/ic_launcher_monochrome"/>
</adaptive-icon>
3 changes: 2 additions & 1 deletion app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
<monochrome android:drawable="@drawable/ic_launcher_monochrome"/>
</adaptive-icon>
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions app/src/main/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#86D483</color>
</resources>
<color name="ic_launcher_background">#48245C</color>
</resources>
34 changes: 34 additions & 0 deletions scripts/update-brand-icons.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
"""Render Feiya's VectorDrawable brand source. Requires CairoSVG 2.9.1."""
from pathlib import Path
import xml.etree.ElementTree as ET
import cairosvg

ROOT = Path(__file__).resolve().parent.parent
RES = ROOT / 'app/src/main/res'
A = '{http://schemas.android.com/apk/res/android}'
BACKGROUND = ET.parse(RES / 'values/ic_launcher_background.xml').find('color').text


def paths(name):
vector = ET.parse(RES / f'drawable/{name}.xml').getroot()
return ''.join(f'<path fill="{p.attrib[A + "fillColor"]}" d="{p.attrib[A + "pathData"]}"/>'
for p in vector.findall('path'))


def svg(content, size=108):
return f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {size} {size}">{content}</svg>'


mark = paths('ic_launcher_foreground')
for density, pixels in [('mdpi', 48), ('hdpi', 72), ('xhdpi', 96), ('xxhdpi', 144), ('xxxhdpi', 192)]:
for suffix, background in [('', f'<rect width="108" height="108" rx="24" fill="{BACKGROUND}"/>'),
('_round', f'<circle cx="54" cy="54" r="54" fill="{BACKGROUND}"/>')]:
# Legacy launchers do not apply the adaptive layer inset.
art = svg(background + f'<g transform="translate(-13.5 -13.5) scale(1.25)">{mark}</g>')
cairosvg.svg2png(bytestring=art.encode(), write_to=str(RES / f'mipmap-{density}/ic_launcher{suffix}.png'),
output_width=pixels, output_height=pixels)

logo = svg(f'<rect width="108" height="108" rx="24" fill="{BACKGROUND}"/>' + mark)
cairosvg.svg2png(bytestring=logo.encode(), write_to=str(RES / 'drawable-nodpi/feiya_logo.png'),
output_width=512, output_height=512)
Loading