diff options
author | Daniel Sandler <dsandler@android.com> | 2010-05-27 13:44:11 -0400 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2010-06-02 14:48:45 -0700 |
commit | 87937dbcd1cee800aa6cc9824bfc32b587d893bd (patch) | |
tree | 10ef2020851e63bd9f4b5bc8f0ce7d91477f7906 | |
parent | 798ac4c7d79534a8230623b737b5b1b6a415d105 (diff) | |
download | frameworks_base-87937dbcd1cee800aa6cc9824bfc32b587d893bd.zip frameworks_base-87937dbcd1cee800aa6cc9824bfc32b587d893bd.tar.gz frameworks_base-87937dbcd1cee800aa6cc9824bfc32b587d893bd.tar.bz2 |
New shadowy status bar, direct from Z'ha'dum.
Artwork is FPO but serviceable enough. Many hardcoded font
colors & styles were moved to styles.xml where they belong.
AM/PM finally given the old heave-ho (but configurable in
StatusBarPolicy.java).
Notification content remains on a light-gray background for
now (so as not to screw up custom RemoteViews) but status
icons will definitely need across-the-board rework to look
better against a dark background.
(Re-integrated on top of new status bar code.)
Change-Id: Ia180b3c2ba8e23c9a2f50cf46f98f12958022b53
24 files changed, 68 insertions, 49 deletions
diff --git a/packages/SystemUI/res/drawable-hdpi/shade_bg.png b/packages/SystemUI/res/drawable-hdpi/shade_bg.png Binary files differnew file mode 100644 index 0000000..3d00cd0 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/shade_bg.png diff --git a/packages/SystemUI/res/drawable-hdpi/shade_handlebar.9.png b/packages/SystemUI/res/drawable-hdpi/shade_handlebar.9.png Binary files differnew file mode 100644 index 0000000..f313ffb --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/shade_handlebar.9.png diff --git a/packages/SystemUI/res/drawable-hdpi/shade_header_background.9.png b/packages/SystemUI/res/drawable-hdpi/shade_header_background.9.png Binary files differnew file mode 100644 index 0000000..37b5fef --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/shade_header_background.9.png diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_background.9.png b/packages/SystemUI/res/drawable-hdpi/status_bar_background.9.png Binary files differnew file mode 100644 index 0000000..a4be298 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/status_bar_background.9.png diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_close_on.9.png b/packages/SystemUI/res/drawable-hdpi/status_bar_close_on.9.png Binary files differdeleted file mode 100644 index 5acf638..0000000 --- a/packages/SystemUI/res/drawable-hdpi/status_bar_close_on.9.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_header_background.9.png b/packages/SystemUI/res/drawable-hdpi/status_bar_header_background.9.png Binary files differdeleted file mode 100644 index be36ff2..0000000 --- a/packages/SystemUI/res/drawable-hdpi/status_bar_header_background.9.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_item_app_background_normal.9.png b/packages/SystemUI/res/drawable-hdpi/status_bar_item_app_background_normal.9.png Binary files differnew file mode 100644 index 0000000..4fbfa4f --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/status_bar_item_app_background_normal.9.png diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_item_background_focus.9.png b/packages/SystemUI/res/drawable-hdpi/status_bar_item_background_focus.9.png Binary files differnew file mode 100644 index 0000000..0876bc6 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/status_bar_item_background_focus.9.png diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_item_background_normal.9.png b/packages/SystemUI/res/drawable-hdpi/status_bar_item_background_normal.9.png Binary files differnew file mode 100644 index 0000000..c01c018 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/status_bar_item_background_normal.9.png diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_item_background_pressed.9.png b/packages/SystemUI/res/drawable-hdpi/status_bar_item_background_pressed.9.png Binary files differnew file mode 100644 index 0000000..343e4ca --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/status_bar_item_background_pressed.9.png diff --git a/packages/SystemUI/res/drawable-hdpi/statusbar_background.9.png b/packages/SystemUI/res/drawable-hdpi/statusbar_background.9.png Binary files differdeleted file mode 100644 index dcca695..0000000 --- a/packages/SystemUI/res/drawable-hdpi/statusbar_background.9.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-mdpi/shade_bg.png b/packages/SystemUI/res/drawable-mdpi/shade_bg.png Binary files differnew file mode 100644 index 0000000..941d3b1 --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/shade_bg.png diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_close_on.9.png b/packages/SystemUI/res/drawable-mdpi/shade_handlebar.9.png Binary files differindex 9cbd9fe..9cbd9fe 100644 --- a/packages/SystemUI/res/drawable-mdpi/status_bar_close_on.9.png +++ b/packages/SystemUI/res/drawable-mdpi/shade_handlebar.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_header_background.9.png b/packages/SystemUI/res/drawable-mdpi/shade_header_background.9.png Binary files differindex fa9a90c..fa9a90c 100644 --- a/packages/SystemUI/res/drawable-mdpi/status_bar_header_background.9.png +++ b/packages/SystemUI/res/drawable-mdpi/shade_header_background.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/statusbar_background.9.png b/packages/SystemUI/res/drawable-mdpi/status_bar_background.9.png Binary files differindex eb7c1a4..eb7c1a4 100644 --- a/packages/SystemUI/res/drawable-mdpi/statusbar_background.9.png +++ b/packages/SystemUI/res/drawable-mdpi/status_bar_background.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_item_app_background_normal.9.png b/packages/SystemUI/res/drawable-mdpi/status_bar_item_app_background_normal.9.png Binary files differnew file mode 100644 index 0000000..c079615 --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/status_bar_item_app_background_normal.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_item_background_focus.9.png b/packages/SystemUI/res/drawable-mdpi/status_bar_item_background_focus.9.png Binary files differnew file mode 100644 index 0000000..c3e2415 --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/status_bar_item_background_focus.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_item_background_normal.9.png b/packages/SystemUI/res/drawable-mdpi/status_bar_item_background_normal.9.png Binary files differnew file mode 100644 index 0000000..b8e399d --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/status_bar_item_background_normal.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_item_background_pressed.9.png b/packages/SystemUI/res/drawable-mdpi/status_bar_item_background_pressed.9.png Binary files differnew file mode 100644 index 0000000..02b4e9a --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/status_bar_item_background_pressed.9.png diff --git a/packages/SystemUI/res/layout/status_bar.xml b/packages/SystemUI/res/layout/status_bar.xml index 420286b..5fe8e79 100644 --- a/packages/SystemUI/res/layout/status_bar.xml +++ b/packages/SystemUI/res/layout/status_bar.xml @@ -21,7 +21,7 @@ <!-- android:background="@drawable/status_bar_closed_default_background" --> <com.android.systemui.statusbar.StatusBarView xmlns:android="http://schemas.android.com/apk/res/android" - android:background="@drawable/statusbar_background" + android:background="@drawable/status_bar_background" android:orientation="vertical" android:focusable="true" android:descendantFocusability="afterDescendants" @@ -50,6 +50,7 @@ android:orientation="horizontal"/> <com.android.systemui.statusbar.Clock + android:textAppearance="@*android:style/TextAppearance.StatusBar.Icon" android:layout_width="wrap_content" android:layout_height="match_parent" android:singleLine="true" @@ -57,7 +58,6 @@ android:textSize="16sp" android:textStyle="bold" android:gravity="center_vertical|left" - android:textColor="?android:attr/textColorPrimaryInverse" /> </LinearLayout> @@ -110,6 +110,6 @@ android:gravity="center_vertical|left" android:paddingLeft="6px" android:paddingRight="6px" - android:background="@drawable/statusbar_background" + android:background="@drawable/status_bar_background" /> </com.android.systemui.statusbar.StatusBarView> diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index 350a675..e266829 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -31,7 +31,7 @@ android:paddingTop="3dp" android:paddingBottom="5dp" android:paddingRight="3dp" - android:background="@drawable/status_bar_header_background" + android:background="@drawable/shade_header_background" > <LinearLayout android:layout_width="0dp" @@ -48,7 +48,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:textAppearance="?android:attr/textAppearanceLarge" - android:textColor="?android:attr/textColorSecondaryInverse" + android:textColor="?android:attr/textColorSecondary" android:paddingLeft="4dp" /> <TextView android:id="@+id/spnLabel" @@ -56,7 +56,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:textAppearance="?android:attr/textAppearanceLarge" - android:textColor="?android:attr/textColorSecondaryInverse" + android:textColor="?android:attr/textColorSecondary" android:paddingLeft="4dp" /> </LinearLayout> @@ -99,7 +99,7 @@ android:layout_height="wrap_content" android:background="@drawable/title_bar_portrait" android:paddingLeft="5dp" - android:textAppearance="@style/TextAppearance.StatusBarTitle" + android:textAppearance="@style/TextAppearance.StatusBar.Title" android:text="@string/status_bar_no_notifications_title" /> @@ -108,7 +108,7 @@ android:layout_height="wrap_content" android:background="@drawable/title_bar_portrait" android:paddingLeft="5dp" - android:textAppearance="@style/TextAppearance.StatusBarTitle" + android:textAppearance="@style/TextAppearance.StatusBar.Title" android:text="@string/status_bar_ongoing_events_title" /> <LinearLayout android:id="@+id/ongoingItems" @@ -122,7 +122,7 @@ android:layout_height="wrap_content" android:background="@drawable/title_bar_portrait" android:paddingLeft="5dp" - android:textAppearance="@style/TextAppearance.StatusBarTitle" + android:textAppearance="@style/TextAppearance.StatusBar.Title" android:text="@string/status_bar_latest_events_title" /> <LinearLayout android:id="@+id/latestItems" diff --git a/packages/SystemUI/res/layout/status_bar_tracking.xml b/packages/SystemUI/res/layout/status_bar_tracking.xml index bffd67e..a2b40e6 100644 --- a/packages/SystemUI/res/layout/status_bar_tracking.xml +++ b/packages/SystemUI/res/layout/status_bar_tracking.xml @@ -42,7 +42,8 @@ android:layout_height="wrap_content" android:layout_gravity="bottom" android:scaleType="fitXY" - android:src="@drawable/status_bar_close_on"/> + android:src="@drawable/shade_handlebar" + /> </com.android.systemui.statusbar.CloseDragHandle> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 41c8ae7..10fa930 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -16,7 +16,7 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="TextAppearance.StatusBarTitle" parent="@android:style/TextAppearance"> + <style name="TextAppearance.StatusBar.Title" parent="@android:style/TextAppearance.StatusBar"> <item name="android:textAppearance">?android:attr/textAppearanceSmall</item> <item name="android:textStyle">bold</item> <item name="android:textColor">?android:attr/textColorPrimary</item> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/Clock.java index eff05dc..c944808 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/Clock.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/Clock.java @@ -16,19 +16,24 @@ package com.android.systemui.statusbar; +import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.content.BroadcastReceiver; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; +import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.Handler; -import android.text.format.DateFormat; -import android.text.style.RelativeSizeSpan; import android.text.Spannable; import android.text.SpannableStringBuilder; +import android.text.format.DateFormat; +import android.text.style.CharacterStyle; +import android.text.style.ForegroundColorSpan; +import android.text.style.RelativeSizeSpan; +import android.text.style.RelativeSizeSpan; +import android.text.style.StyleSpan; import android.util.AttributeSet; import android.view.View; import android.widget.TextView; @@ -50,6 +55,12 @@ public class Clock extends TextView { private String mClockFormatString; private SimpleDateFormat mClockFormat; + private static final int AM_PM_STYLE_NORMAL = 0; + private static final int AM_PM_STYLE_SMALL = 1; + private static final int AM_PM_STYLE_GONE = 2; + + private static final int AM_PM_STYLE = AM_PM_STYLE_GONE; + public Clock(Context context) { this(context, null); } @@ -139,29 +150,30 @@ public class Clock extends TextView { * add dummy characters around it to let us find it again after * formatting and change its size. */ - int a = -1; - boolean quoted = false; - for (int i = 0; i < format.length(); i++) { - char c = format.charAt(i); - - if (c == '\'') { - quoted = !quoted; + if (AM_PM_STYLE != AM_PM_STYLE_NORMAL) { + int a = -1; + boolean quoted = false; + for (int i = 0; i < format.length(); i++) { + char c = format.charAt(i); + + if (c == '\'') { + quoted = !quoted; + } + if (!quoted && c == 'a') { + a = i; + break; + } } - if (!quoted && c == 'a') { - a = i; - break; - } - } - - if (a >= 0) { - // Move a back so any whitespace before the AM/PM is also in the alternate size. - final int b = a; - while (a > 0 && Character.isWhitespace(format.charAt(a-1))) { - a--; - } - format = format.substring(0, a) + MAGIC1 + format.substring(a, b) + if (a >= 0) { + // Move a back so any whitespace before AM/PM is also in the alternate size. + final int b = a; + while (a > 0 && Character.isWhitespace(format.charAt(a-1))) { + a--; + } + format = format.substring(0, a) + MAGIC1 + format.substring(a, b) + "a" + MAGIC2 + format.substring(b + 1); + } } mClockFormat = sdf = new SimpleDateFormat(format); @@ -171,22 +183,28 @@ public class Clock extends TextView { } String result = sdf.format(mCalendar.getTime()); - int magic1 = result.indexOf(MAGIC1); - int magic2 = result.indexOf(MAGIC2); - - if (magic1 >= 0 && magic2 > magic1) { - SpannableStringBuilder formatted = new SpannableStringBuilder(result); - - formatted.setSpan(new RelativeSizeSpan(0.7f), magic1, magic2, - Spannable.SPAN_EXCLUSIVE_INCLUSIVE); - - formatted.delete(magic2, magic2 + 1); - formatted.delete(magic1, magic1 + 1); - - return formatted; - } else { - return result; + if (AM_PM_STYLE != AM_PM_STYLE_NORMAL) { + int magic1 = result.indexOf(MAGIC1); + int magic2 = result.indexOf(MAGIC2); + if (magic1 >= 0 && magic2 > magic1) { + SpannableStringBuilder formatted = new SpannableStringBuilder(result); + if (AM_PM_STYLE == AM_PM_STYLE_GONE) { + formatted.delete(magic1, magic2+1); + } else { + if (AM_PM_STYLE == AM_PM_STYLE_SMALL) { + CharacterStyle style = new RelativeSizeSpan(0.7f); + formatted.setSpan(style, magic1, magic2, + Spannable.SPAN_EXCLUSIVE_INCLUSIVE); + } + formatted.delete(magic2, magic2 + 1); + formatted.delete(magic1, magic1 + 1); + } + return formatted; + } } + + return result; + } } |