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
BIN
packages/SystemUI/res/drawable-hdpi/shade_bg.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
packages/SystemUI/res/drawable-hdpi/shade_handlebar.9.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 204 B |
BIN
packages/SystemUI/res/drawable-hdpi/status_bar_background.9.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 945 B |
|
Before Width: | Height: | Size: 187 B |
|
After Width: | Height: | Size: 322 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 197 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 215 B |
BIN
packages/SystemUI/res/drawable-mdpi/shade_bg.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 646 B After Width: | Height: | Size: 646 B |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 186 B |
|
After Width: | Height: | Size: 11 KiB |
@@ -21,7 +21,7 @@
|
|||||||
<!-- android:background="@drawable/status_bar_closed_default_background" -->
|
<!-- android:background="@drawable/status_bar_closed_default_background" -->
|
||||||
<com.android.systemui.statusbar.StatusBarView
|
<com.android.systemui.statusbar.StatusBarView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:background="@drawable/statusbar_background"
|
android:background="@drawable/status_bar_background"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:descendantFocusability="afterDescendants"
|
android:descendantFocusability="afterDescendants"
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
android:orientation="horizontal"/>
|
android:orientation="horizontal"/>
|
||||||
|
|
||||||
<com.android.systemui.statusbar.Clock
|
<com.android.systemui.statusbar.Clock
|
||||||
|
android:textAppearance="@*android:style/TextAppearance.StatusBar.Icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
@@ -57,7 +58,6 @@
|
|||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:gravity="center_vertical|left"
|
android:gravity="center_vertical|left"
|
||||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -110,6 +110,6 @@
|
|||||||
android:gravity="center_vertical|left"
|
android:gravity="center_vertical|left"
|
||||||
android:paddingLeft="6px"
|
android:paddingLeft="6px"
|
||||||
android:paddingRight="6px"
|
android:paddingRight="6px"
|
||||||
android:background="@drawable/statusbar_background"
|
android:background="@drawable/status_bar_background"
|
||||||
/>
|
/>
|
||||||
</com.android.systemui.statusbar.StatusBarView>
|
</com.android.systemui.statusbar.StatusBarView>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
android:paddingTop="3dp"
|
android:paddingTop="3dp"
|
||||||
android:paddingBottom="5dp"
|
android:paddingBottom="5dp"
|
||||||
android:paddingRight="3dp"
|
android:paddingRight="3dp"
|
||||||
android:background="@drawable/status_bar_header_background"
|
android:background="@drawable/shade_header_background"
|
||||||
>
|
>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:textColor="?android:attr/textColorSecondaryInverse"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:paddingLeft="4dp"
|
android:paddingLeft="4dp"
|
||||||
/>
|
/>
|
||||||
<TextView android:id="@+id/spnLabel"
|
<TextView android:id="@+id/spnLabel"
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:textColor="?android:attr/textColorSecondaryInverse"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:paddingLeft="4dp"
|
android:paddingLeft="4dp"
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/title_bar_portrait"
|
android:background="@drawable/title_bar_portrait"
|
||||||
android:paddingLeft="5dp"
|
android:paddingLeft="5dp"
|
||||||
android:textAppearance="@style/TextAppearance.StatusBarTitle"
|
android:textAppearance="@style/TextAppearance.StatusBar.Title"
|
||||||
android:text="@string/status_bar_no_notifications_title"
|
android:text="@string/status_bar_no_notifications_title"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/title_bar_portrait"
|
android:background="@drawable/title_bar_portrait"
|
||||||
android:paddingLeft="5dp"
|
android:paddingLeft="5dp"
|
||||||
android:textAppearance="@style/TextAppearance.StatusBarTitle"
|
android:textAppearance="@style/TextAppearance.StatusBar.Title"
|
||||||
android:text="@string/status_bar_ongoing_events_title"
|
android:text="@string/status_bar_ongoing_events_title"
|
||||||
/>
|
/>
|
||||||
<LinearLayout android:id="@+id/ongoingItems"
|
<LinearLayout android:id="@+id/ongoingItems"
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/title_bar_portrait"
|
android:background="@drawable/title_bar_portrait"
|
||||||
android:paddingLeft="5dp"
|
android:paddingLeft="5dp"
|
||||||
android:textAppearance="@style/TextAppearance.StatusBarTitle"
|
android:textAppearance="@style/TextAppearance.StatusBar.Title"
|
||||||
android:text="@string/status_bar_latest_events_title"
|
android:text="@string/status_bar_latest_events_title"
|
||||||
/>
|
/>
|
||||||
<LinearLayout android:id="@+id/latestItems"
|
<LinearLayout android:id="@+id/latestItems"
|
||||||
|
|||||||
@@ -42,7 +42,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
android:src="@drawable/status_bar_close_on"/>
|
android:src="@drawable/shade_handlebar"
|
||||||
|
/>
|
||||||
|
|
||||||
</com.android.systemui.statusbar.CloseDragHandle>
|
</com.android.systemui.statusbar.CloseDragHandle>
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
<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:textAppearance">?android:attr/textAppearanceSmall</item>
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:textStyle">bold</item>
|
||||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||||
|
|||||||
@@ -16,19 +16,24 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar;
|
package com.android.systemui.statusbar;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.format.DateFormat;
|
|
||||||
import android.text.style.RelativeSizeSpan;
|
|
||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
import android.text.SpannableStringBuilder;
|
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.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -50,6 +55,12 @@ public class Clock extends TextView {
|
|||||||
private String mClockFormatString;
|
private String mClockFormatString;
|
||||||
private SimpleDateFormat mClockFormat;
|
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) {
|
public Clock(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
}
|
}
|
||||||
@@ -139,29 +150,30 @@ public class Clock extends TextView {
|
|||||||
* add dummy characters around it to let us find it again after
|
* add dummy characters around it to let us find it again after
|
||||||
* formatting and change its size.
|
* formatting and change its size.
|
||||||
*/
|
*/
|
||||||
int a = -1;
|
if (AM_PM_STYLE != AM_PM_STYLE_NORMAL) {
|
||||||
boolean quoted = false;
|
int a = -1;
|
||||||
for (int i = 0; i < format.length(); i++) {
|
boolean quoted = false;
|
||||||
char c = format.charAt(i);
|
for (int i = 0; i < format.length(); i++) {
|
||||||
|
char c = format.charAt(i);
|
||||||
|
|
||||||
if (c == '\'') {
|
if (c == '\'') {
|
||||||
quoted = !quoted;
|
quoted = !quoted;
|
||||||
|
}
|
||||||
|
if (!quoted && c == 'a') {
|
||||||
|
a = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!quoted && c == 'a') {
|
if (a >= 0) {
|
||||||
a = i;
|
// Move a back so any whitespace before AM/PM is also in the alternate size.
|
||||||
break;
|
final int b = a;
|
||||||
}
|
while (a > 0 && Character.isWhitespace(format.charAt(a-1))) {
|
||||||
}
|
a--;
|
||||||
|
}
|
||||||
if (a >= 0) {
|
format = format.substring(0, a) + MAGIC1 + format.substring(a, b)
|
||||||
// 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);
|
+ "a" + MAGIC2 + format.substring(b + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mClockFormat = sdf = new SimpleDateFormat(format);
|
mClockFormat = sdf = new SimpleDateFormat(format);
|
||||||
@@ -171,22 +183,28 @@ public class Clock extends TextView {
|
|||||||
}
|
}
|
||||||
String result = sdf.format(mCalendar.getTime());
|
String result = sdf.format(mCalendar.getTime());
|
||||||
|
|
||||||
int magic1 = result.indexOf(MAGIC1);
|
if (AM_PM_STYLE != AM_PM_STYLE_NORMAL) {
|
||||||
int magic2 = result.indexOf(MAGIC2);
|
int magic1 = result.indexOf(MAGIC1);
|
||||||
|
int magic2 = result.indexOf(MAGIC2);
|
||||||
if (magic1 >= 0 && magic2 > magic1) {
|
if (magic1 >= 0 && magic2 > magic1) {
|
||||||
SpannableStringBuilder formatted = new SpannableStringBuilder(result);
|
SpannableStringBuilder formatted = new SpannableStringBuilder(result);
|
||||||
|
if (AM_PM_STYLE == AM_PM_STYLE_GONE) {
|
||||||
formatted.setSpan(new RelativeSizeSpan(0.7f), magic1, magic2,
|
formatted.delete(magic1, magic2+1);
|
||||||
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
|
} else {
|
||||||
|
if (AM_PM_STYLE == AM_PM_STYLE_SMALL) {
|
||||||
formatted.delete(magic2, magic2 + 1);
|
CharacterStyle style = new RelativeSizeSpan(0.7f);
|
||||||
formatted.delete(magic1, magic1 + 1);
|
formatted.setSpan(style, magic1, magic2,
|
||||||
|
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
|
||||||
return formatted;
|
}
|
||||||
} else {
|
formatted.delete(magic2, magic2 + 1);
|
||||||
return result;
|
formatted.delete(magic1, magic1 + 1);
|
||||||
|
}
|
||||||
|
return formatted;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||