[android-developers] What colour to use for custom contentView in notification for 2.2 and 2.3

2011-01-26 Thread H
So I've got a custom view being used as a RemoteViews in a notification.

Looking in the 2.2. resource, I can see 
\layout\status_bar_latest_event_content.xml where it explicitly sets the 
colour of the title and text to ff00. Which works nicely under 2.2 
stock. The text is black.

But under 2.3, the notification bar is darker and black text is not visible. 
Looking in the same file under 2.3 I find it is now using a 
style 
android:textAppearance=@style/TextAppearance.StatusBar.EventContent.Title. 
This is using ?textColorPrimaryInverse which is white but the same value 
under 2.2 is also white.

The TextAppearance.StatusBar style hierarchy doesn't exist for 2.2 or below.

So should I check for the sdk version and if running 2.3+ then get the value 
of the style attribute and manually override the color for the custom 
view..? Seems a bit of a faff to have to do that? And how do I compile it to 
refer to that new attribute when I'm targetting 2.2? Any way to get it to 
work purely in xml with no additional java faff..?

But I'm also wondering about all that theming going on for custom roms - how 
do they handle this..? For a 2.2. phone, the text colour of black is 
hardcoded into that layout. So does that mean that no theme for a 2.2. 
device can change the colour of the notification bar background to black 
otherwise all the notifications will be unreadable? Am I missing something 
here?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] What colour to use for custom contentView in notification for 2.2 and 2.3

2011-01-26 Thread Kostya Vasilyev

H,

You can try putting a 2.3 specific layout into res/layout-v9. You'd 
then be able to use the new style, provided you build with 2.3, and 
still remain compatible with earlier versions.


-- Kostya

26.01.2011 15:42, H пишет:

So I've got a custom view being used as a RemoteViews in a notification.

Looking in the 2.2. resource, I can see 
\layout\status_bar_latest_event_content.xml where it explicitly sets 
the colour of the title and text to ff00. Which works nicely 
under 2.2 stock. The text is black.


But under 2.3, the notification bar is darker and black text is not 
visible. Looking in the same file under 2.3 I find it is now using a 
style 
android:textAppearance=@style/TextAppearance.StatusBar.EventContent.Title. 
This is using ?textColorPrimaryInverse which is white but the same 
value under 2.2 is also white.


The TextAppearance.StatusBar style hierarchy doesn't exist for 2.2 or 
below.


So should I check for the sdk version and if running 2.3+ then get the 
value of the style attribute and manually override the color for the 
custom view..? Seems a bit of a faff to have to do that? And how do I 
compile it to refer to that new attribute when I'm targetting 2.2? Any 
way to get it to work purely in xml with no additional java faff..?


But I'm also wondering about all that theming going on for custom roms 
- how do they handle this..? For a 2.2. phone, the text colour of 
black is hardcoded into that layout. So does that mean that no theme 
for a 2.2. device can change the colour of the notification bar 
background to black otherwise all the notifications will be 
unreadable? Am I missing something here?

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en 



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] What colour to use for custom contentView in notification for 2.2 and 2.3

2011-01-26 Thread H
Hi Kostya, cunning idea!

I've not made the leap to building against 2.3 yet as I like to see all the 
source code - plus there isn't a working 2.3 emulator with lvl support yet. 
Maybe this is the final reason...?

But surely there must be a better way to not have to resort to layouts for 
specific releases..?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] What colour to use for custom contentView in notification for 2.2 and 2.3

2011-01-26 Thread Kostya Vasilyev
Every time the SDK gets a new feature, using it requires building with 
the new version.


I don't see anything wrong with that (think alternate drawables in 1.6, 
install to sd in 2.2).


As for the alternate layout - 2.3 seems to have received some minor but 
probably important UI tweaks: in addition to the issue at hand, status 
bar icons for notifications have a new look, different from 2.2 and below.


http://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar.html

I would look at it this way: it's the price you pay for making your 
application look its best on all platform versions. Takes some work, but 
then what doesn't?


YMMV

-- Kostya

26.01.2011 15:59, H пишет:

Hi Kostya, cunning idea!

I've not made the leap to building against 2.3 yet as I like to see 
all the source code - plus there isn't a working 2.3 emulator with lvl 
support yet. Maybe this is the final reason...?


But surely there must be a better way to not have to resort to layouts 
for specific releases..?

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en 



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] What colour to use for custom contentView in notification for 2.2 and 2.3

2011-01-26 Thread H
Yeah, you're right of course.. :-)

I've already made a note a few days ago to download the gingerbread source 
after you posted how on your blog - I guess now's the time to jump in!

Thanks!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] What colour to use for custom contentView in notification for 2.2 and 2.3

2011-01-26 Thread Kostya Vasilyev

H,

More on sources in Eclipse - I just set it up so that the debugger finds 
a different version of Android sources from the one used for building.


In my case, I am building with 2.2, debugging on 2.1update1.

This is something I've been wanting to solve for some time, the email 
exchange we had today prompted me to dive into it, so thank you.


Will make a blog post about this (probably tomorrow), as this seems like 
a useful thing.


-- Kostya

26.01.2011 16:26, H пишет:

Yeah, you're right of course.. :-)

I've already made a note a few days ago to download the gingerbread 
source after you posted how on your blog - I guess now's the time to 
jump in!


Thanks!
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en 



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] What colour to use for custom contentView in notification for 2.2 and 2.3

2011-01-26 Thread H
Yeah, that would be good.

My concern with building against 2.3 was that if I debug'd, I would need to 
use a 2.3 emulator. And with the broken lvl in it, I would have to hack my 
app heavily and then couldn't rely on the testing anyway. So the ability to 
build against 2.3 but debug against 2.2 or 2.1 would fill that gap nicely.

Good work!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] What colour to use for custom contentView in notification for 2.2 and 2.3

2011-01-26 Thread Dianne Hackborn
You should design your notification icons to work well against any
background.

When we changed the status bar background to black, we were planning on
implementing compatibility for old apps that assumed the old background,
like we usually do.  However we realized that since there have already been
devices shipping with a black background from various vendors, it wouldn't
really help -- developers already unfortunately were in the boat where they
had to deal with making their icons work on both light and dark backgrounds.

So just design your icons to work on both.  The simplest way would be to do
something like put a black background behind them, perhaps a rounded
rectangle.

On Wed, Jan 26, 2011 at 6:17 AM, H m...@howardb.com wrote:

 Yeah, that would be good.

 My concern with building against 2.3 was that if I debug'd, I would need to
 use a 2.3 emulator. And with the broken lvl in it, I would have to hack my
 app heavily and then couldn't rely on the testing anyway. So the ability to
 build against 2.3 but debug against 2.2 or 2.1 would fill that gap nicely.

 Good work!

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] What colour to use for custom contentView in notification for 2.2 and 2.3

2011-01-26 Thread H
Thanks Dianne. I wasn't too worried about the icon as I can deal with that - 
it was the colour of the text to display by the side of it in the 
contentView. But you mentioned the same thing that I was realising: custom 
Themes must have broken this a long time ago anyway so there are probably 
many apps out there on gingerbread with black text on a black background in 
a custom notification anyway.

I've coded the solution Kostya suggested above and tested it in the gb 
emulator and it works a treat!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en