am 450da449: Merge "New shadowy status bar, direct from Z\'ha\'dum." into kraken
|
Before Width: | Height: | Size: 839 B After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 945 B After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 187 B After Width: | Height: | Size: 204 B |
|
Before Width: | Height: | Size: 215 B After Width: | Height: | Size: 3.2 KiB |
@@ -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>
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 -->
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,31 +586,33 @@ 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 (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 (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)
|
||||
+ "a" + MAGIC2 + format.substring(b + 1);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
mClockFormat = sdf = new SimpleDateFormat(format);
|
||||
mClockFormatString = format;
|
||||
} else {
|
||||
@@ -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() {
|
||||
|
||||