From 6b1da71baf1f84335989519c0be8e226e2978a53 Mon Sep 17 00:00:00 2001 From: Martin Ball Date: Thu, 26 Nov 2026 15:48:59 +0000 Subject: [PATCH] #1993: Android launcher and notification icons from MailCraft's own icon The Android app had no launcher icon (Android drew its default) and its notifications carried an envelope drawn in code. The launcher icon is now MailCraft's icon (assets/app-icon/source/mailcraft.svg) as an adaptive icon: the blue tile behind, the sheets and the calendar page with the envelope in front within the 66 dp safe circle, and the page alone in one colour for Android 13's themed icons. New mail and reminders show the page as a white status-bar silhouette. The source's shapes are written by hand as Android vectors; each file has its ATTRIBUTION.md row. Human-reviewed, AI-assisted, nobody's mailbox harmed. --- ATTRIBUTION.md | 5 + .../app/src/main/AndroidManifest.xml | 1 + .../work/mailcraft/android/MailNotices.kt | 40 +--- .../mailcraft/android/ReminderReceiver.kt | 6 +- .../res/drawable/ic_launcher_background.xml | 36 +++ .../res/drawable/ic_launcher_foreground.xml | 210 ++++++++++++++++++ .../res/drawable/ic_launcher_monochrome.xml | 38 ++++ .../src/main/res/drawable/ic_notification.xml | 38 ++++ .../main/res/mipmap-anydpi/ic_launcher.xml | 13 ++ assets/app-icon/README.md | 5 +- docs/log.d/ROADMAP/progress/1993.md | 1 + .../release-notes.d/fixes/1993.android.md | 1 + 12 files changed, 351 insertions(+), 43 deletions(-) create mode 100644 apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_foreground.xml create mode 100644 apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_monochrome.xml create mode 100644 apps/mailcraft-android/app/src/main/res/drawable/ic_notification.xml create mode 100644 apps/mailcraft-android/app/src/main/res/mipmap-anydpi/ic_launcher.xml create mode 100644 docs/log.d/ROADMAP/progress/1993.md create mode 100644 packaging/release-notes.d/fixes/1993.android.md diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index a4b6967633..281daf5d18 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -40,6 +40,11 @@ Generated-in-code art is original and has no file to list: the UI icon set (`cra | `docs/images/site/people-light.png` | MailCraft contributors | screenshot of MailCraft itself showing its sample mailbox (invented people and text), made with `crates/ui-egui/examples/ui_shot.rs` | MIT OR Apache-2.0 | mailcraft.work: the People view with a contact open, light theme | | `docs/images/site/people-dark.png` | MailCraft contributors | screenshot of MailCraft itself showing its sample mailbox (invented people and text), made with `crates/ui-egui/examples/ui_shot.rs` | MIT OR Apache-2.0 | mailcraft.work: the People view with a contact open, dark theme | | `assets/app-icon/README.md` | MailCraft contributors | written for this project | MIT OR Apache-2.0 | What the app icon is and how it is made | +| `apps/mailcraft-android/app/src/main/res/mipmap-anydpi/ic_launcher.xml` | MailCraft contributors (design: Martin Ball) | written for this project | MIT OR Apache-2.0 | App icon (Android): the adaptive launcher icon, naming its three layers | +| `apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_background.xml` | MailCraft contributors (design: Martin Ball) | drawn for MailCraft (`assets/app-icon/source/mailcraft.svg`), its tile written by hand as an Android vector | MIT OR Apache-2.0 | App icon (Android): the launcher icon's back layer, the blue tile | +| `apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_foreground.xml` | MailCraft contributors (design: Martin Ball) | drawn for MailCraft (`assets/app-icon/source/mailcraft.svg`), its shapes written by hand as an Android vector | MIT OR Apache-2.0 | App icon (Android): the launcher icon's front layer, the sheets and the calendar page with the envelope | +| `apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_monochrome.xml` | MailCraft contributors (design: Martin Ball) | drawn for MailCraft (`assets/app-icon/source/mailcraft.svg`), its calendar page written by hand as a one-colour Android vector | MIT OR Apache-2.0 | App icon (Android): the launcher icon's one-colour layer, for themed icons | +| `apps/mailcraft-android/app/src/main/res/drawable/ic_notification.xml` | MailCraft contributors (design: Martin Ball) | drawn for MailCraft (`assets/app-icon/source/mailcraft.svg`), its calendar page written by hand as a one-colour Android vector | MIT OR Apache-2.0 | Notification icon (Android): the calendar page with the envelope, in white | | `assets/app-icon/mailcraft-1024.png` | MailCraft contributors (design: Martin Ball) | drawn for MailCraft (`assets/app-icon/source/mailcraft.svg`), rendered by `cargo xtask icon` | MIT OR Apache-2.0 | App icon | | `assets/app-icon/mailcraft-macos-512.png` | MailCraft contributors (design: Martin Ball) | drawn for MailCraft (`assets/app-icon/source/mailcraft.svg`), rendered by `cargo xtask icon` | MIT OR Apache-2.0 | App icon, with the margin macOS icons keep | | `assets/app-icon/mailcraft.icns` | MailCraft contributors (design: Martin Ball) | drawn for MailCraft (`assets/app-icon/source/mailcraft.svg`), rendered by `cargo xtask icon` | MIT OR Apache-2.0 | App icon (macOS) | diff --git a/apps/mailcraft-android/app/src/main/AndroidManifest.xml b/apps/mailcraft-android/app/src/main/AndroidManifest.xml index 32898df627..2d5944c831 100644 --- a/apps/mailcraft-android/app/src/main/AndroidManifest.xml +++ b/apps/mailcraft-android/app/src/main/AndroidManifest.xml @@ -33,6 +33,7 @@ android:fullBackupContent="@xml/backup_rules" android:networkSecurityConfig="@xml/network_security_config" android:usesCleartextTraffic="false" + android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:localeConfig="@xml/locales_config" diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/MailNotices.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/MailNotices.kt index d88601b818..e93b53762c 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/MailNotices.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/MailNotices.kt @@ -9,10 +9,6 @@ import android.content.ComponentName import android.content.Context import android.content.Intent import android.content.pm.PackageManager -import android.graphics.Bitmap -import android.graphics.Canvas -import android.graphics.Color -import android.graphics.Paint import android.os.Build import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts @@ -23,8 +19,6 @@ import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import androidx.core.content.ContextCompat import androidx.core.content.edit -import androidx.core.graphics.createBitmap -import androidx.core.graphics.drawable.IconCompat import uniffi.mailcraft_mobile.Event import uniffi.mailcraft_mobile.NotificationRecord import uniffi.mailcraft_mobile.NotificationTopic @@ -128,7 +122,6 @@ internal class MailNotifier( if (!mailNotificationsAllowed(context, channel)) return // The "New mail only" privacy switch is about mail; a reminder says what the core says. val record = if (reminder) sent else privateRecord(sent, onlyNewMail(), t("New mail")) - val icon = IconCompat.createWithBitmap(envelope()) val open = PendingIntent.getActivity( context, 0, @@ -136,11 +129,11 @@ internal class MailNotifier( PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT, ) val hidden = NotificationCompat.Builder(context, channel) - .setSmallIcon(icon) + .setSmallIcon(R.drawable.ic_notification) .setContentTitle(if (reminder) t("Reminders") else t("New mail")) .build() val notification = NotificationCompat.Builder(context, channel) - .setSmallIcon(icon) + .setSmallIcon(R.drawable.ic_notification) .setContentTitle(record.title) .setContentText(record.body) .setCategory(if (reminder) NotificationCompat.CATEGORY_REMINDER else NotificationCompat.CATEGORY_EMAIL) @@ -171,32 +164,3 @@ internal fun postsNotification(topic: NotificationTopic, remindersOn: Boolean): */ internal fun privateRecord(record: NotificationRecord, onlyNewMail: Boolean, newMail: String): NotificationRecord = if (onlyNewMail) record.copy(title = newMail, body = "") else record - -/** The status-bar icon, an envelope drawn here in white on nothing (the system tints it). */ -internal fun envelope(): Bitmap { - val size = ICON_PX - val bitmap = createBitmap(size, size) - val canvas = Canvas(bitmap) - val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply { - color = Color.WHITE - style = Paint.Style.STROKE - strokeWidth = size * STROKE - strokeJoin = Paint.Join.ROUND - strokeCap = Paint.Cap.ROUND - } - val left = size * MARGIN - val right = size - left - val top = size * TOP - val bottom = size - top - canvas.drawRoundRect(left, top, right, bottom, size * CORNER, size * CORNER, paint) - canvas.drawLine(left, top, size / 2f, size * FOLD, paint) - canvas.drawLine(size / 2f, size * FOLD, right, top, paint) - return bitmap -} - -private const val ICON_PX = 96 -private const val STROKE = 0.08f -private const val MARGIN = 0.12f -private const val TOP = 0.24f -private const val CORNER = 0.08f -private const val FOLD = 0.55f diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReminderReceiver.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReminderReceiver.kt index 9b4ca88cc1..9eb2cc6a53 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReminderReceiver.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReminderReceiver.kt @@ -10,7 +10,6 @@ import android.content.Intent import android.text.format.DateUtils import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat -import androidx.core.graphics.drawable.IconCompat import androidx.work.CoroutineWorker import androidx.work.ExistingWorkPolicy import androidx.work.OneTimeWorkRequestBuilder @@ -83,7 +82,6 @@ internal fun showReminder(context: Context, payload: ReminderPayload) { payload.startsMillis, if (payload.allDay) DateUtils.FORMAT_SHOW_DATE else DateUtils.FORMAT_SHOW_TIME or DateUtils.FORMAT_SHOW_DATE, ) - val icon = IconCompat.createWithBitmap(envelope()) val id = notificationId(payload.key.toULong()) fun action(intent: Intent) = PendingIntent.getBroadcast( @@ -100,11 +98,11 @@ internal fun showReminder(context: Context, payload: ReminderPayload) { ) val snoozeIntent = putPayload(reminderIntent(context, ACTION_SNOOZE, payload.key), payload) val hidden = NotificationCompat.Builder(context, CHANNEL_REMINDERS) - .setSmallIcon(icon) + .setSmallIcon(R.drawable.ic_notification) .setContentTitle(payload.words.hidden) .build() val notification = NotificationCompat.Builder(context, CHANNEL_REMINDERS) - .setSmallIcon(icon) + .setSmallIcon(R.drawable.ic_notification) .setContentTitle(payload.title) .setContentText(reminderText(payload, at)) .setCategory(if (payload.task) NotificationCompat.CATEGORY_REMINDER else NotificationCompat.CATEGORY_EVENT) diff --git a/apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_background.xml b/apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000000..494cbb5789 --- /dev/null +++ b/apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_foreground.xml b/apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000000..c9121f6ed1 --- /dev/null +++ b/apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_monochrome.xml b/apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_monochrome.xml new file mode 100644 index 0000000000..9d0a48519e --- /dev/null +++ b/apps/mailcraft-android/app/src/main/res/drawable/ic_launcher_monochrome.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + diff --git a/apps/mailcraft-android/app/src/main/res/drawable/ic_notification.xml b/apps/mailcraft-android/app/src/main/res/drawable/ic_notification.xml new file mode 100644 index 0000000000..c96165a2e6 --- /dev/null +++ b/apps/mailcraft-android/app/src/main/res/drawable/ic_notification.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + diff --git a/apps/mailcraft-android/app/src/main/res/mipmap-anydpi/ic_launcher.xml b/apps/mailcraft-android/app/src/main/res/mipmap-anydpi/ic_launcher.xml new file mode 100644 index 0000000000..7193ff7be0 --- /dev/null +++ b/apps/mailcraft-android/app/src/main/res/mipmap-anydpi/ic_launcher.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/assets/app-icon/README.md b/assets/app-icon/README.md index fd4efea670..ae86683191 100644 --- a/assets/app-icon/README.md +++ b/assets/app-icon/README.md @@ -18,6 +18,7 @@ contributors, under the project's licence (MIT OR Apache-2.0). | `mailcraft.ico` | Windows: 16 to 256 px | | `mailcraft.icns`, `mailcraft-macos-512.png` | macOS, on Apple's 824/1024 grid | | `mailcraft-1024.png` | The icon at 1024 px | +| `apps/mailcraft-android/app/src/main/res/` (`mipmap-anydpi/ic_launcher.xml`, `drawable/ic_launcher_*.xml`, `drawable/ic_notification.xml`) | Android: the adaptive launcher icon (the tile behind, the sheets and the page in front within the 66 dp safe circle, the page alone in one colour for themed icons) and the status-bar icon (the page in white), the source's shapes written by hand as Android vectors | ## Geometry @@ -37,4 +38,6 @@ cargo xtask icon ``` It renders the SVG with `resvg`, a pure-Rust renderer that only xtask depends on, and writes every -file above. Commit what changed; each file has its row in `ATTRIBUTION.md`. +file above. Commit what changed; each file has its row in `ATTRIBUTION.md`. The Android vectors are +not written by it: a change to the drawing is copied into them by hand (their path data is the +source's own, in its coordinates, placed by a group's scale and offset). diff --git a/docs/log.d/ROADMAP/progress/1993.md b/docs/log.d/ROADMAP/progress/1993.md new file mode 100644 index 0000000000..f4b428d62d --- /dev/null +++ b/docs/log.d/ROADMAP/progress/1993.md @@ -0,0 +1 @@ +| 2026-11-26 | Android: MailCraft's own launcher icon (adaptive, themed) and status-bar icon for notifications (#1993) | diff --git a/packaging/release-notes.d/fixes/1993.android.md b/packaging/release-notes.d/fixes/1993.android.md new file mode 100644 index 0000000000..c748b97250 --- /dev/null +++ b/packaging/release-notes.d/fixes/1993.android.md @@ -0,0 +1 @@ +- The Android app has its own icon: the MailCraft icon on the home screen and in the app list (adaptive, with a one-colour version for themed icons), and a one-colour version of it in the status bar for new mail and reminders ([#1993](https://github.com/GITHUB_REPOSITORY/issues/1993)).