diff options
author | Daniel Sandler <dsandler@android.com> | 2010-05-24 05:45:56 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-05-24 05:45:56 -0700 |
commit | 450da449ffb0d856b471c229634ab1d2bc12499a (patch) | |
tree | cffc7d821f980bc9e8f6ac9afaee46c4303be1ee | |
parent | bd329ddbea1860a2a859f065d7c405717c7d8133 (diff) | |
parent | 2c195f77a16e96fe2add0dd661b7376379e5513d (diff) | |
download | frameworks_base-450da449ffb0d856b471c229634ab1d2bc12499a.zip frameworks_base-450da449ffb0d856b471c229634ab1d2bc12499a.tar.gz frameworks_base-450da449ffb0d856b471c229634ab1d2bc12499a.tar.bz2 |
Merge "New shadowy status bar, direct from Z'ha'dum." into kraken
-rw-r--r-- | core/res/res/drawable-hdpi/status_bar_background.png | bin | 839 -> 1038 bytes | |||
-rw-r--r-- | core/res/res/drawable-hdpi/status_bar_close_on.9.png | bin | 945 -> 2368 bytes | |||
-rw-r--r-- | core/res/res/drawable-hdpi/status_bar_header_background.9.png | bin | 187 -> 204 bytes | |||
-rw-r--r-- | core/res/res/drawable-hdpi/statusbar_background.9.png | bin | 215 -> 3233 bytes | |||
-rw-r--r-- | core/res/res/layout/status_bar.xml | 10 | ||||
-rw-r--r-- | core/res/res/layout/status_bar_expanded.xml | 12 | ||||
-rw-r--r-- | core/res/res/layout/status_bar_latest_event_content.xml | 12 | ||||
-rw-r--r-- | core/res/res/values/styles.xml | 19 | ||||
-rw-r--r-- | services/java/com/android/server/status/StatusBarIcon.java | 5 | ||||
-rw-r--r-- | services/java/com/android/server/status/StatusBarPolicy.java | 81 |
10 files changed, 85 insertions, 54 deletions
diff --git a/core/res/res/drawable-hdpi/status_bar_background.png b/core/res/res/drawable-hdpi/status_bar_background.png Binary files differindex e6a865a..3d00cd0 100644 --- a/core/res/res/drawable-hdpi/status_bar_background.png +++ b/core/res/res/drawable-hdpi/status_bar_background.png diff --git a/core/res/res/drawable-hdpi/status_bar_close_on.9.png b/core/res/res/drawable-hdpi/status_bar_close_on.9.png Binary files differindex 5acf638..f313ffb 100644 --- a/core/res/res/drawable-hdpi/status_bar_close_on.9.png +++ b/core/res/res/drawable-hdpi/status_bar_close_on.9.png diff --git a/core/res/res/drawable-hdpi/status_bar_header_background.9.png b/core/res/res/drawable-hdpi/status_bar_header_background.9.png Binary files differindex be36ff2..37b5fef 100644 --- a/core/res/res/drawable-hdpi/status_bar_header_background.9.png +++ b/core/res/res/drawable-hdpi/status_bar_header_background.9.png diff --git a/core/res/res/drawable-hdpi/statusbar_background.9.png b/core/res/res/drawable-hdpi/statusbar_background.9.png Binary files differindex dcca695..a4be298 100644 --- a/core/res/res/drawable-hdpi/statusbar_background.9.png +++ b/core/res/res/drawable-hdpi/statusbar_background.9.png diff --git a/core/res/res/layout/status_bar.xml b/core/res/res/layout/status_bar.xml index e8d8866..2237ee4 100644 --- a/core/res/res/layout/status_bar.xml +++ b/core/res/res/layout/status_bar.xml @@ -76,28 +76,28 @@ android:paddingTop="2dip" android:paddingRight="10dip"> <TextView + android:textAppearance="@style/TextAppearance.StatusBar.Ticker" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" - android:textColor="#ff000000" /> + /> <TextView + android:textAppearance="@style/TextAppearance.StatusBar.Ticker" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" - android:textColor="#ff000000" /> + /> </com.android.server.status.TickerView> </LinearLayout> <com.android.server.status.DateView android:id="@+id/date" + android:textAppearance="@style/TextAppearance.StatusBar.Icon" android:layout_width="wrap_content" android:layout_height="match_parent" android:singleLine="true" - android:textSize="16sp" - android:textStyle="bold" android:gravity="center_vertical|left" android:paddingLeft="6px" android:paddingRight="6px" - android:textColor="?android:attr/textColorPrimaryInverse" android:background="@drawable/statusbar_background" /> </com.android.server.status.StatusBarView> diff --git a/core/res/res/layout/status_bar_expanded.xml b/core/res/res/layout/status_bar_expanded.xml index 30138a7..68eb922 100644 --- a/core/res/res/layout/status_bar_expanded.xml +++ b/core/res/res/layout/status_bar_expanded.xml @@ -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> @@ -67,7 +67,7 @@ android:layout_marginTop="4dp" android:layout_marginBottom="1dp" android:textSize="14sp" - android:textColor="#ff000000" + android:textColor="?android:attr/textColorPrimaryInverse" android:text="@string/status_bar_clear_all_button" style="?android:attr/buttonStyle" android:paddingLeft="15dp" @@ -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/core/res/res/layout/status_bar_latest_event_content.xml b/core/res/res/layout/status_bar_latest_event_content.xml index c3aa041..ea6200a 100644 --- a/core/res/res/layout/status_bar_latest_event_content.xml +++ b/core/res/res/layout/status_bar_latest_event_content.xml @@ -18,16 +18,15 @@ android:scaleType="fitCenter" android:src="@drawable/arrow_down_float"/> <TextView android:id="@+id/title" + android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:singleLine="true" android:ellipsize="marquee" android:fadingEdge="horizontal" - android:textStyle="bold" - android:textSize="18sp" android:paddingLeft="4dp" - android:textColor="#ff000000" /> + /> </LinearLayout> <LinearLayout android:layout_width="match_parent" @@ -35,23 +34,22 @@ android:orientation="horizontal" > <TextView android:id="@+id/text" + android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" - android:textColor="#ff000000" android:singleLine="true" android:ellipsize="marquee" android:fadingEdge="horizontal" - android:textSize="14sp" android:paddingLeft="4dp" /> <android.widget.DateTimeView android:id="@+id/time" + android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_marginLeft="4dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" - android:textSize="14sp" android:paddingRight="5dp" - android:textColor="#ff000000" /> + /> </LinearLayout> </LinearLayout> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index b5fff96..af04117 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -187,11 +187,26 @@ <!-- Status Bar Styles --> - <style name="TextAppearance.StatusBarTitle"> + <style name="TextAppearance.StatusBar"> <item name="android:textAppearance">?android:attr/textAppearanceSmall</item> - <item name="android:textStyle">bold</item> <item name="android:textColor">?android:attr/textColorPrimary</item> </style> + <style name="TextAppearance.StatusBar.Ticker"> + </style> + <style name="TextAppearance.StatusBar.Title"> + <item name="android:textStyle">bold</item> + </style> + + <style name="TextAppearance.StatusBar.Icon"> + <item name="android:textStyle">bold</item> + </style> + <style name="TextAppearance.StatusBar.EventContent"> + <item name="android:textColor">?android:attr/textColorPrimaryInverse</item> + </style> + <style name="TextAppearance.StatusBar.EventContent.Title"> + <item name="android:textSize">18sp</item> + <item name="android:textStyle">bold</item> + </style> <!-- Widget Styles --> diff --git a/services/java/com/android/server/status/StatusBarIcon.java b/services/java/com/android/server/status/StatusBarIcon.java index 6f8b8a8..f77b550 100644 --- a/services/java/com/android/server/status/StatusBarIcon.java +++ b/services/java/com/android/server/status/StatusBarIcon.java @@ -51,14 +51,11 @@ class StatusBarIcon { switch (data.type) { case IconData.TEXT: { TextView t; - t = new TextView(context); + t = new TextView(context, null, com.android.internal.R.style.TextAppearance_StatusBar_Icon); mTextView = t; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT); - t.setTextSize(16); - t.setTextColor(0xff000000); - t.setTypeface(Typeface.DEFAULT_BOLD); t.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); t.setPadding(6, 0, 0, 0); t.setLayoutParams(layoutParams); diff --git a/services/java/com/android/server/status/StatusBarPolicy.java b/services/java/com/android/server/status/StatusBarPolicy.java index 35ccfe8..cab2662 100644 --- a/services/java/com/android/server/status/StatusBarPolicy.java +++ b/services/java/com/android/server/status/StatusBarPolicy.java @@ -29,6 +29,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.TypedArray; import android.graphics.PixelFormat; +import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.location.LocationManager; import android.media.AudioManager; @@ -49,7 +50,10 @@ import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.telephony.TelephonyManager; import android.text.format.DateFormat; +import android.text.style.CharacterStyle; import android.text.style.RelativeSizeSpan; +import android.text.style.ForegroundColorSpan; +import android.text.style.StyleSpan; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.util.Slog; @@ -86,6 +90,12 @@ public class StatusBarPolicy { // message codes for the handler private static final int EVENT_BATTERY_CLOSE = 4; + 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; + private final Context mContext; private final StatusBarService mService; private final Handler mHandler = new StatusBarHandler(); @@ -576,29 +586,31 @@ public class StatusBarPolicy { * 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--; + 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) + + "a" + MAGIC2 + format.substring(b + 1); } - format = format.substring(0, a) + MAGIC1 + format.substring(a, b) - + "a" + MAGIC2 + format.substring(b + 1); } mClockFormat = sdf = new SimpleDateFormat(format); @@ -608,22 +620,31 @@ public class StatusBarPolicy { } String result = sdf.format(mCalendar.getTime()); - int magic1 = result.indexOf(MAGIC1); - int magic2 = result.indexOf(MAGIC2); + 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 (magic1 >= 0 && magic2 > magic1) { + SpannableStringBuilder formatted = new SpannableStringBuilder(result); - formatted.setSpan(new RelativeSizeSpan(0.7f), magic1, magic2, - Spannable.SPAN_EXCLUSIVE_INCLUSIVE); + 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); + formatted.delete(magic2, magic2 + 1); + formatted.delete(magic1, magic1 + 1); + } - return formatted; - } else { - return result; + return formatted; + } } + + return result; } private final void updateClock() { |