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

Comments

@crawshaw
Copy link
Contributor

commented Feb 24, 2015

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link

commented Aug 1, 2016

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

@dskinner

This comment has been minimized.

Copy link
Member

commented Aug 1, 2016

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

@gopherbot

This comment has been minimized.

Copy link

commented Sep 30, 2016

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

@gopherbot gopherbot added the mobile label Jul 20, 2017

@udhos

This comment has been minimized.

Copy link

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
cmd/gomobile: icon support for android
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 <hyangah@gmail.com>
@rucuriousyet

This comment has been minimized.

Copy link

commented Oct 30, 2017

What's the status of this addition?

@dskinner

This comment has been minimized.

Copy link
Member

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.

@rucuriousyet

This comment has been minimized.

Copy link

commented Nov 3, 2017

Any idea when this may become part of gomobile?

@rucuriousyet

This comment has been minimized.

Copy link

commented Nov 3, 2017

Or has it already?

@dskinner

This comment has been minimized.

Copy link
Member

commented Nov 3, 2017

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

@rucuriousyet

This comment has been minimized.

Copy link

commented Nov 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.