StoDevX / AAO-React-Native

The St. Olaf community, now in pocket size.
GNU Affero General Public License v3.0
42 stars 16 forks source link

Support Android O's "Adaptive Icon" feature #889

Closed hawkrives closed 5 years ago

hawkrives commented 7 years ago

Docs: https://developer.android.com/preview/features/adaptive-icons.html.

Android O introduces adaptive launcher icons, which can display a variety of shapes across different device models. For example, a launcher icon can display using a circular shape on one OEM device, and display a squircle on another device. Each device OEM provides a mask, which the system then uses to render all icons with the same shape. The new launcher icons are also used in shortcuts, the Settings app, sharing dialogs, and the overview screen.

   

See the Creating Adaptive Icons section for more information on making them.


My take: this looks even simpler than the current icon.

We provide the glyph and a background, then let the system render them into one bitmap.

rye commented 6 years ago

This would be nice to have. I know there exists some RN packages that let us do dynamic icons for iOS, but this would be nice to have on Android.


To me, it makes sense to store an SVG in this repository and then to render to .png or .jpg at whatever resolution and compression level we desire, presumably in an npm script that can be called in CI when we are finally building the thing.

This would also allow for something cool like a custom beta icon or a custom nightly icon, too.

hawkrives commented 6 years ago

@rye If you can get an svg of the icon, I'd love to not store the ~36 copies of the icon that we currently do.

If we want to generate them for beta, we'd need to add some more logic to differentiate between "here's an alpha/beta/rc" and "here's a release" (probably just by looking at the package.json version) so that we don't add a badge to the release bundles.

hawkrives commented 6 years ago

I've made a vector of the background of the main icon, but I don't particularly want to recreate the foreground.

@rye Could you ask around at SGA to see if anyone has the original assets?

rye commented 5 years ago

Re-triaging into v2.8 since we redesigned the main icon and it needs to get borders from the launcher. Android currently is missing the foreground and background things, which are required. Since I committed an SVG, I'm going to look at scripting some way to extract just the fg and the bg—these are, after all, in separate groups, so I should be able to slice just the fg and the bg and export them as their respective things.

Here's a key thing from the documentation:

You can control the look of your adaptive launcher icon by defining 2 layers, consisting of a background and a foreground. You must provide icon layers as drawables without masks or background shadows around the outline of the icon.

(emphasis mine)

I think because they're stored in the tree of mipmap things, and those are somehow not considered "drawables," we can't use adaptive icons yet. (Presumably they want to do transforms at render-time, and doing so with raster graphics is gross.)

So the checklist I can think of is:

hawkrives commented 5 years ago

@rye There's a thing in Android Studio that can convert an SVG into an Android "vector drawable", which can then be fed into the Android Studio icon editor - might help.

rye commented 5 years ago

I have now set up two new exports in the Sketch project for the foreground ("Old Main" visual) and the background. (yellow to black gradient background)

I will run these through the converter, since it doesn't appear we can directly reference an SVG.

rye commented 5 years ago

Work in progress over at #4059.