Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile/cmd/gomobile: icon support in gomobile #9985

Open
crawshaw opened this issue Feb 24, 2015 · 11 comments
Open

x/mobile/cmd/gomobile: icon support in gomobile #9985

crawshaw opened this issue Feb 24, 2015 · 11 comments
Labels
mobile Android, iOS, and x/mobile
Milestone

Comments

@crawshaw
Copy link
Member

There are some useful defaults we could have for app icons. Place an icon in /assets/icon.png, and it gets used.

But it turns out there are many icons. Android has an arbitrary number of potential sizes, depending on the DPI of the screen. iOS has a series of fixed sizes. Both also have much larger store icons (1024x1024 and 512x512).

http://developer.android.com/design/style/iconography.html
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html

Given the large number of android combinations, automatic scaling might make sense. However users may need the ability to provide multiple icons, as small images often require artistic adjustment to the number of pixels. One possibility is /assets/iconUxV.png.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@hyangah hyangah changed the title mobile: icon support in gomobile x/mobile/cmd/gomobile: icon support in gomobile May 7, 2015
@dskinner
Copy link
Member

dskinner commented Jan 15, 2016

There's so many ways to go about this. As a lowest common denominator, simply having an assets/icon.png would perhaps, unsurprisingly, make the majority of people happy. This could require an asset at 1024x1024 and scale.

As an addition to this, it may be reasonable to allow someone to tweak how scaling is done with a name modifier, e.g. assets/icon_bilinear.png or assets/icon_lanczos3.png. Sometimes a different algorithm is enough to produce suitable results.

With regards to platform specifics, things may get a little crazy when trying to remain platform agnostic. For example, Android defines the mipmap resource directory specifically for defining icons where assets provided may be displayed larger than what is normally provided in a drawable qualifier (mdpi, hdpi, etc) for cases where something like a home screen may display icons larger than what was intended by the system.

With things like this in mind, I don't think it would be unreasonable to allow finite control over defining icon resources to assure the app is presentable for it's intended audience, but this does push against the grain of platform agnostic behavior with gomobile.

With regards to Android, I'm unaware if simply packing the icons in the apk is enough (that'd be great). I suspect that a resources.arsc will need to be generated to identify the drawables for their intended configurations, such as with internal/binres.

@ElPincheTopo
Copy link

Has there been any work done on this? Is it now possible to set the app icon using gomobile?

@dskinner
Copy link
Member

dskinner commented Aug 1, 2016

I'm working on android support as of a couple weeks ago but it's not ready yet.

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/30019 mentions this issue.

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Jul 20, 2017
@udhos
Copy link

udhos commented Aug 16, 2017

Please add anote to wiki https://github.com/golang/go/wiki/Mobile about this restriction.
Currenlty we are unable to set an icon using gomobile.

gopherbot pushed a commit to golang/mobile that referenced this issue Oct 17, 2017
Provides support for resources.arsc generation enabling
the setting of an application icon.

If an asset/icon.png is encountered during build, then
the resources.arsc is generated to identify a single
xxxhdpi resource and the manifest will be updated to
reference resource as app icon.

References golang/go#9985

Change-Id: I9ef59fff45dcd612a41c479b2c679d22c094ab36
Reviewed-on: https://go-review.googlesource.com/30019
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
@ghost
Copy link

ghost commented Oct 30, 2017

What's the status of this addition?

@dskinner
Copy link
Member

dskinner commented Nov 3, 2017

@rucuriousyet this push added the ability to generate resource tables for apks which is then used for the simplest form of icon support, picking up on an assets/icon.png file and packing it into the android apk as an xxxhdpi mipmap. From there, the android system provides scaling for different densities.

It's desirable to support specifying the icon for each density and this pushed removed technical hurdles related.

It's also desirable to support iOS but I don't have the requisite hardware to test an implementation. From what I read a year ago, my impression is iOS support would be comparatively trivial.

@ghost
Copy link

ghost commented Nov 3, 2017

Any idea when this may become part of gomobile?

@ghost
Copy link

ghost commented Nov 3, 2017

Or has it already?

@dskinner
Copy link
Member

dskinner commented Nov 3, 2017

It has. You'll need to install the latest version of cmd/gomobile to use.

@ghost
Copy link

ghost commented Nov 3, 2017 via email

imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Provides support for resources.arsc generation enabling
the setting of an application icon.

If an asset/icon.png is encountered during build, then
the resources.arsc is generated to identify a single
xxxhdpi resource and the manifest will be updated to
reference resource as app icon.

References golang/go#9985

Change-Id: I9ef59fff45dcd612a41c479b2c679d22c094ab36
Reviewed-on: https://go-review.googlesource.com/30019
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Provides support for resources.arsc generation enabling
the setting of an application icon.

If an asset/icon.png is encountered during build, then
the resources.arsc is generated to identify a single
xxxhdpi resource and the manifest will be updated to
reference resource as app icon.

References golang/go#9985

Change-Id: I9ef59fff45dcd612a41c479b2c679d22c094ab36
Reviewed-on: https://go-review.googlesource.com/30019
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

6 participants