From 50599bc65d6afa03495c6938a32bb928071aca63 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 15 Aug 2019 10:15:03 +0200 Subject: [PATCH] cmd/gio: support app icons If there is an appicon.png file in the main package the gio tool will use it for Android and iOS apps in buildmode exe. Signed-off-by: Elias Naur --- cmd/gio/androidbuild.go | 18 +++++++- cmd/gio/gio.go | 51 +++++++++++++++++++++ cmd/gio/iosbuild.go | 98 ++++++++++++++++++++++++++++++++++++----- cmd/go.mod | 5 ++- cmd/go.sum | 3 ++ 5 files changed, 162 insertions(+), 13 deletions(-) diff --git a/cmd/gio/androidbuild.go b/cmd/gio/androidbuild.go index a40f82c3..31f4d673 100644 --- a/cmd/gio/androidbuild.go +++ b/cmd/gio/androidbuild.go @@ -242,6 +242,20 @@ func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo) (err error) { return err } } + icon := filepath.Join(bi.dir, "appicon.png") + iconSnip := "" + if _, err := os.Stat(icon); err == nil { + err := buildIcons(resDir, icon, []iconVariant{ + {filepath.Join("mipmap-hdpi", "ic_launcher.png"), 72}, + {filepath.Join("mipmap-xhdpi", "ic_launcher.png"), 96}, + {filepath.Join("mipmap-xxhdpi", "ic_launcher.png"), 144}, + {filepath.Join("mipmap-xxxhdpi", "ic_launcher.png"), 192}, + }) + if err != nil { + return err + } + iconSnip = `android:icon="@mipmap/ic_launcher"` + } themes := `