diff options
author | Daniel Sandler <dsandler@android.com> | 2010-05-21 15:42:06 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@android.com> | 2010-05-21 15:46:54 -0400 |
commit | 2c195f77a16e96fe2add0dd661b7376379e5513d (patch) | |
tree | 97f55f603f5d00449b1a452f7864c51f8a76c9ab /services/java/com/android/server | |
parent | 8e55e88ff56edb60f001673f94abf6a109edb2d6 (diff) | |
download | frameworks_base-2c195f77a16e96fe2add0dd661b7376379e5513d.zip frameworks_base-2c195f77a16e96fe2add0dd661b7376379e5513d.tar.gz frameworks_base-2c195f77a16e96fe2add0dd661b7376379e5513d.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.
Change-Id: Id9d5a699532f9336563cd6f9699bff3893735e4f
Diffstat (limited to 'services/java/com/android/server')
-rw-r--r-- | services/java/com/android/server/status/StatusBarIcon.java | 5 | ||||
-rw-r--r-- | services/java/com/android/server/status/StatusBarPolicy.java | 81 |
2 files changed, 52 insertions, 34 deletions
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() { |