Android notification icons with color - android

According to the android iconography documentation here
and also here the icons in the status bar are supposed to be entirely white with transparent background. However, even the built in icons don't all follow this pattern it seems. The signal quality (for wifi and cell), battery indicator, and some others have the holo blue background on some icons on newer devices. Is this color built into the icon itself?
I am looking to implement a status bar icon with my app that will indicate the status of a connection to an external (bluetooth) device. I was planning on doing my company logo (which is a fairly simple, mostly circular shape) filled in with a color to indicate the status of the connection (connected - green, not connected - red). But since I'm not supposed to use a color these seems much more complicated. Is it really that bad to use a non white icon, and if it's so bad why does google do it?

It's convention, like creating accessors for your private fields, but it's not strict that you follow it. That being said, it is a good idea to follow the color scheme of the OS, simply because that way everything looks uniform. Therefore, I would suggest that rather than green and red, you choose holo blue and grey. It is completely your choice as the developer.

Related

Theme based Google play icons

I found that some apps icons on google play are changing their background colour based on whether dark theme is enabled or not like in the photos below.
Any ideas how to implement this?
Light mode icon
Dark mode icon
This is based on a transparent background you can define making your app icon.
Probably you remember you need to set a foreground (often the symbol, here the pocket) and also a background. If you use a transparent background, it will get a greyish black in darkmode and a white in light mode ("whitemode").
It's an optical illusion.
You could check it if you would have the app and set a custom screen wallpaper on your phone, for example with particles. Those would shine through the app icon background.
Probably your idea is posible in the future, I haven't heard about it yet. Cheers!

Overscan creates unwanted border in some apps

I ran
Process process Runtime.getRuntime().exec("wm overscan 0,80,0,0");
But in some apps like whatsapp or my launcher it creates an additional border that I don't want. Is there anything I can do against it? In the attaches screenshot it's black.
Also, it would be great if I found a way to change the overscan color, I don't really want to use the status bar color but a black instead.

App custom notification light color

I am programming my own app and I have some issues with my notifications.
Is it possible to have custom notification light color in android?
Because when I try to set the color to #FF64B5F6 I didn't gte this color.
Or can I only set the color to these Color.RED, Color.MAGENTA?
And when I can set custom colors, is this the right way?
Java:
NotificationCompat.Builder(this.context).setLights(ContextCompat.getColor(this.context, R.color.c_account), 500, 500)
xml:
<color name="c_account">#FF512DA8</color>
Hope you guys can help me.
Is it possible to have custom notification light color in android?
Well, you can try. It may not work.
First, some devices do not have an LED.
Of those that do, some devices do not use the LED for showing notifications.
Of those that do, some devices do not support different colors.
Of those that do, some devices will not support arbitrary colors (though ideally they map your requested color to one that they do support).
So, you are welcome to request a specific color. Just bear in mind that it is quite likely that you will not get the color that you want, and that there is no guarantee that you will get any sort of LED effect.

Icon color on different themes

Different Android devices have different themes.
That means, that background colors, like in dialogs, may differ among Android versions and among manufacturers.
This may result into icons getting "invisible":
The problem with stock Android themes could be solved relatively easy, by providing different colored icons in target specific folders, e.g. white icons in a folder drawable-v14, and black ones in drawable-v10.
But that does not solve the issue that comes with customized themes from manufacturers, may it be TouchWiz, Blur or Sense.
It is simply not possible to cover every device by this method.
Another way would be, to draw a small black border around white icons, and vice versa.
But if the background would be gray, like in ICS, it wouldn't look good, either.
So, the question is: How to provide custom icons, that will work well on every theme, without touching the theme itself?
Accounting for all vendor choices (and mistakes) would be a pain.
I see a couple of options:
Explicitly select a stock theme and hope for the best
Select a custom theme derived from a stock theme, where you control the background color
Dynamically evaluate the background color for the chosen theme, and set the icon based by a tipping point (e.g. dark icons if background is light enough). Not sure if this would be practical, but at least it should be somewhat universal.
I recently went with the hard-coded colors in a derivative theme to fix a bug in the Nook dialog color selections for a dialog. More extensive testing would probably show me another platform that I just made worse with that.
Hopefully someone has a better answer than those, because none of those seem completely clean and universal. Reading your post again, it looks like none of those options meet your criteria of not touching the theme, either.

Detecting the background color of the option menu

I have realized that there are at least two background colors on Option menu of Android. On the HTC Hero, the background is white and on Samsung Galaxy S II, the background is black.
This became a problem when I set the icons for the background menus. Is there some way to detect the background color of the Option menus in Android?
Possible solutions:
Don't use icons.
Design icons according to the guidelines - http://developer.android.com/guide/practices/ui_guidelines/icon_design_menu.html. There are three different guidelines for up to 2.2 (white background), 2.3 (black background) and 3.0+, so it's a lot of work...
As Profete162 suggested, use #android:drawable/ic_menu_*
For Android 4.0+, you can also set the light / dark Holo theme, which is guaranteed (at least in theory) to remain unchanged across different phone manufacturers - so it'll look the same in HTC Sense, Samsung TouchWiz etc.
That's indeed a very annoying issue.
On my implementation, I always try to use standards icons from android.R.drawable.IC_menu_*, so I am sure these icons are part of the framework and users are always positively surprised to see their generic icons in my app!
That gives a really good continuity in the user experience on the device, but that doesn't answer your question, but at least provide a workaround.
Here are for instance all android 2.2 icons: http://androiddrawableexplorer.appspot.com/
You can trust me, using these icons will always fit your colors.
First of all to answer your title question:
You can reference and read the background of the options menu by reading the attributes of the current theme. The attribute for this is panelFullBackground. E.g. set it as the background of a textview in XML¹:
<TextView android:background="?android:attr/panelFullBackground"
... />
Note that the background seems to be a solid color, but it's not - it's actually a bitmap. If you look closely you can see a grey border at the top (android 2.3+), or a drop shadow (<= android 2.2), so its'a bit difficult. Luckily there is a different attribute called panelColorBackground which matches the background color of the drawable as close as possible. So if you want just the normal background color, use this instead.
¹ This can surely also be read from code, but I don't know how from the top of my head at the moment, maybe I'll look it up and edit it in later.
Regarding icons
So you have the color as stated above, but you still have to process it to know if it's a dark or a bright color. You can do that, but that's not the usual way to deal with these icons and probably a good bit of work until you cover all the possible cases - not to mention that you have to create icons for each variant.
Normally you should adopt the platform menu icon style. This works across all devices and looks familiar to your users (custom icons that dont follow this often look "wrong" - e.g. astro file manager does this I believe).
You can do that by hand (see the guidelines), but the way better alternative is the Android Asset Studio.
It comes in two flavors:
As a webapp
Integrated in the latest version of the ADT plugin for eclipse
(under File->New->Other->Android Icon Set)
The workflow for both is pretty similar, select the point "Menu Icon" and follow the wizard. It will promt you to enter a simple, black and white bitmap of your desired icon that just outlines it's shape. After you specified one, the asset studio will generate everything for you. Play a bit around with the "clipart" option, that has a few example bitmaps ready to see how it works. When finished, the webapp gives you a simple zip which can be extracted into your project directory, the eclipse version adds it directly to the project that you select in the wizard.
The background color can be anything, because its implemented in Framework by manufacturer. You can't read it, in fact you will never need to read it.
Just create your custom menu layout in res/menu folder, set style and use it.

Categories

Resources