diff --git a/apps/darkroom-android/android/AndroidManifest.xml b/apps/darkroom-android/android/AndroidManifest.xml index 5c38357..97a9819 100644 --- a/apps/darkroom-android/android/AndroidManifest.xml +++ b/apps/darkroom-android/android/AndroidManifest.xml @@ -30,8 +30,21 @@ android:version="0x00401000" android:required="true" /> + diff --git a/apps/darkroom-android/android/res/mipmap-anydpi-v26/ic_launcher.xml b/apps/darkroom-android/android/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..345888d --- /dev/null +++ b/apps/darkroom-android/android/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/apps/darkroom-android/android/res/mipmap-hdpi/ic_launcher.png b/apps/darkroom-android/android/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..01b29d8 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-hdpi/ic_launcher.png differ diff --git a/apps/darkroom-android/android/res/mipmap-hdpi/ic_launcher_background.png b/apps/darkroom-android/android/res/mipmap-hdpi/ic_launcher_background.png new file mode 100644 index 0000000..e489b2e Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-hdpi/ic_launcher_background.png differ diff --git a/apps/darkroom-android/android/res/mipmap-hdpi/ic_launcher_foreground.png b/apps/darkroom-android/android/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..e1ea40e Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/apps/darkroom-android/android/res/mipmap-hdpi/ic_launcher_monochrome.png b/apps/darkroom-android/android/res/mipmap-hdpi/ic_launcher_monochrome.png new file mode 100644 index 0000000..e1ea40e Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-hdpi/ic_launcher_monochrome.png differ diff --git a/apps/darkroom-android/android/res/mipmap-mdpi/ic_launcher.png b/apps/darkroom-android/android/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..5ab6bd4 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-mdpi/ic_launcher.png differ diff --git a/apps/darkroom-android/android/res/mipmap-mdpi/ic_launcher_background.png b/apps/darkroom-android/android/res/mipmap-mdpi/ic_launcher_background.png new file mode 100644 index 0000000..27c91c7 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-mdpi/ic_launcher_background.png differ diff --git a/apps/darkroom-android/android/res/mipmap-mdpi/ic_launcher_foreground.png b/apps/darkroom-android/android/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..1b786ad Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/apps/darkroom-android/android/res/mipmap-mdpi/ic_launcher_monochrome.png b/apps/darkroom-android/android/res/mipmap-mdpi/ic_launcher_monochrome.png new file mode 100644 index 0000000..1b786ad Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-mdpi/ic_launcher_monochrome.png differ diff --git a/apps/darkroom-android/android/res/mipmap-xhdpi/ic_launcher.png b/apps/darkroom-android/android/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..8269dee Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/apps/darkroom-android/android/res/mipmap-xhdpi/ic_launcher_background.png b/apps/darkroom-android/android/res/mipmap-xhdpi/ic_launcher_background.png new file mode 100644 index 0000000..ee9ff70 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-xhdpi/ic_launcher_background.png differ diff --git a/apps/darkroom-android/android/res/mipmap-xhdpi/ic_launcher_foreground.png b/apps/darkroom-android/android/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..3b53b86 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/apps/darkroom-android/android/res/mipmap-xhdpi/ic_launcher_monochrome.png b/apps/darkroom-android/android/res/mipmap-xhdpi/ic_launcher_monochrome.png new file mode 100644 index 0000000..3b53b86 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-xhdpi/ic_launcher_monochrome.png differ diff --git a/apps/darkroom-android/android/res/mipmap-xxhdpi/ic_launcher.png b/apps/darkroom-android/android/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..841e031 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/apps/darkroom-android/android/res/mipmap-xxhdpi/ic_launcher_background.png b/apps/darkroom-android/android/res/mipmap-xxhdpi/ic_launcher_background.png new file mode 100644 index 0000000..667dbeb Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-xxhdpi/ic_launcher_background.png differ diff --git a/apps/darkroom-android/android/res/mipmap-xxhdpi/ic_launcher_foreground.png b/apps/darkroom-android/android/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..fea0974 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/apps/darkroom-android/android/res/mipmap-xxhdpi/ic_launcher_monochrome.png b/apps/darkroom-android/android/res/mipmap-xxhdpi/ic_launcher_monochrome.png new file mode 100644 index 0000000..fea0974 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-xxhdpi/ic_launcher_monochrome.png differ diff --git a/apps/darkroom-android/android/res/mipmap-xxxhdpi/ic_launcher.png b/apps/darkroom-android/android/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..c7cc097 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/apps/darkroom-android/android/res/mipmap-xxxhdpi/ic_launcher_background.png b/apps/darkroom-android/android/res/mipmap-xxxhdpi/ic_launcher_background.png new file mode 100644 index 0000000..ad588e7 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-xxxhdpi/ic_launcher_background.png differ diff --git a/apps/darkroom-android/android/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/apps/darkroom-android/android/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..97ea960 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/apps/darkroom-android/android/res/mipmap-xxxhdpi/ic_launcher_monochrome.png b/apps/darkroom-android/android/res/mipmap-xxxhdpi/ic_launcher_monochrome.png new file mode 100644 index 0000000..97ea960 Binary files /dev/null and b/apps/darkroom-android/android/res/mipmap-xxxhdpi/ic_launcher_monochrome.png differ diff --git a/docker/android/package.sh b/docker/android/package.sh index 9ad34ed..a90a69c 100755 --- a/docker/android/package.sh +++ b/docker/android/package.sh @@ -82,11 +82,22 @@ echo "==> packaging APK" -dname "CN=Android Debug,O=Android,C=US" >/dev/null 2>&1 fi + # The launcher icon is the only resource the app has, but resources go + # through aapt2 in two steps regardless: compile turns the source tree into + # an intermediate archive of flat files, link folds that into the APK and + # builds the resources.arsc table that @mipmap/ic_launcher in the manifest + # resolves against. Skipping compile and handing link the directory does + # not work — link only reads compiled input. + "${BT}/aapt2" compile \ + --dir /work/apps/darkroom-android/android/res \ + -o "${OUT}/res.zip" + # aapt2 link needs the compile SDK to resolve android: attributes, and # --min-sdk-version is what ends up in the manifest the device reads. "${BT}/aapt2" link \ -I "${SDK}/platforms/android-36/android.jar" \ --manifest /work/apps/darkroom-android/android/AndroidManifest.xml \ + -R "${OUT}/res.zip" \ --min-sdk-version 28 \ --target-sdk-version 36 \ -o "${OUT}/base.apk" \ diff --git a/ui/dr-ui/build.rs b/ui/dr-ui/build.rs index 33cd207..8d6d2d7 100644 --- a/ui/dr-ui/build.rs +++ b/ui/dr-ui/build.rs @@ -63,8 +63,18 @@ fn main() { // to be able to find it from an installed binary too. println!("cargo:rustc-env=DR_STYLE_YAML={}", source.display()); + // `EmbedFiles` rather than the default. Slint's default for a hosted + // target is to compile an `@image-url` down to the absolute path it had + // on the build machine and open it at runtime, which is fine while the + // binary never leaves the tree it was built in and wrong the moment it + // does — and it is *already* wrong for Android, where the build happens + // inside a container under /work and the device has no such directory. + // The failure is silent either way: a missing image loads as empty. + // Embedding costs the size of ui/app-icon.png, the only asset this + // reaches, since every UI glyph is a Path rather than a file. let config = slint_build::CompilerConfiguration::new() - .with_include_paths(vec![out_dir.clone(), manifest_dir.join("ui")]); + .with_include_paths(vec![out_dir.clone(), manifest_dir.join("ui")]) + .embed_resources(slint_build::EmbedResourcesKind::EmbedFiles); slint_build::compile_with_config(entry(&out_dir, live), config).expect("compiling app.slint"); } diff --git a/ui/dr-ui/ui/app-icon.png b/ui/dr-ui/ui/app-icon.png new file mode 100644 index 0000000..11e4427 Binary files /dev/null and b/ui/dr-ui/ui/app-icon.png differ diff --git a/ui/dr-ui/ui/app.slint b/ui/dr-ui/ui/app.slint index ae3277e..7e29151 100644 --- a/ui/dr-ui/ui/app.slint +++ b/ui/dr-ui/ui/app.slint @@ -203,6 +203,20 @@ component InfoPanel inherits Rectangle { export component AppWindow inherits Window { title: "DarkRoom"; + // The one raster asset in the UI, and the exception that the header of + // icons.slint does not cover: everything drawn *inside* the window is a + // Path because a font might not have the glyph, but the window icon is + // never drawn by us. It is handed to the window manager, which wants + // pixels. Pre-shaped with rounded corners and transparent outside them, + // because desktop window managers composite it as-is rather than masking + // it the way Android does — the Android launcher icon is a separate, + // maskable set under apps/darkroom-android/android/res. + // + // Where it actually shows up is narrower than it looks: X11 and Windows + // read it, and Wayland ignores it outright in favour of matching app_id + // against an installed .desktop file, which this repo does not install. + // Android ignores it too — there is no title bar to put it in. + icon: @image-url("app-icon.png"); background: Theme.ground; preferred-width: 1100px; preferred-height: 720px;