Merge "Fix 3148496: Update LockScreen clock to use new font."
diff --git a/core/java/com/android/internal/widget/DigitalClock.java b/core/java/com/android/internal/widget/DigitalClock.java
index 23e2277..ebfe9a9 100644
--- a/core/java/com/android/internal/widget/DigitalClock.java
+++ b/core/java/com/android/internal/widget/DigitalClock.java
@@ -22,6 +22,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.res.AssetManager;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Typeface;
@@ -41,12 +42,16 @@
*/
public class DigitalClock extends RelativeLayout {
+ private static final String SYSTEM = "/system/fonts/";
+ private static final String SYSTEM_FONT_TIME_BACKGROUND = SYSTEM + "AndroidClock.ttf";
+ private static final String SYSTEM_FONT_TIME_FOREGROUND = SYSTEM + "AndroidClock_Highlight.ttf";
private final static String M12 = "h:mm";
private final static String M24 = "kk:mm";
private Calendar mCalendar;
private String mFormat;
- private TextView mTimeDisplay;
+ private TextView mTimeDisplayBackground;
+ private TextView mTimeDisplayForeground;
private AmPm mAmPm;
private ContentObserver mFormatChangeObserver;
private boolean mLive = true;
@@ -117,9 +122,14 @@
protected void onFinishInflate() {
super.onFinishInflate();
- mTimeDisplay = (TextView) findViewById(R.id.timeDisplay);
- mTimeDisplay.setTypeface(Typeface.createFromFile("/system/fonts/Clockopia.ttf"));
- mAmPm = new AmPm(this, Typeface.createFromFile("/system/fonts/DroidSans-Bold.ttf"));
+ AssetManager assets = mContext.getAssets();
+
+ /* The time display consists of two tones. That's why we have two overlapping text views. */
+ mTimeDisplayBackground = (TextView) findViewById(R.id.timeDisplayBackground);
+ mTimeDisplayBackground.setTypeface(Typeface.createFromFile(SYSTEM_FONT_TIME_BACKGROUND));
+ mTimeDisplayForeground = (TextView) findViewById(R.id.timeDisplayForeground);
+ mTimeDisplayForeground.setTypeface(Typeface.createFromFile(SYSTEM_FONT_TIME_FOREGROUND));
+ mAmPm = new AmPm(this, Typeface.createFromFile(SYSTEM_FONT_TIME_BACKGROUND));
mCalendar = Calendar.getInstance();
setDateFormat();
@@ -175,12 +185,13 @@
}
CharSequence newTime = DateFormat.format(mFormat, mCalendar);
- mTimeDisplay.setText(newTime);
+ mTimeDisplayBackground.setText(newTime);
+ mTimeDisplayForeground.setText(newTime);
mAmPm.setIsMorning(mCalendar.get(Calendar.AM_PM) == 0);
}
private void setDateFormat() {
- mFormat = android.text.format.DateFormat.is24HourFormat(getContext())
+ mFormat = android.text.format.DateFormat.is24HourFormat(getContext())
? M24 : M12;
mAmPm.setShowAmPm(mFormat.equals(M12));
}
diff --git a/core/res/res/layout-xlarge/keyguard_screen_status_land.xml b/core/res/res/layout-xlarge/keyguard_screen_status_land.xml
index 8589862..7a20f9a 100644
--- a/core/res/res/layout-xlarge/keyguard_screen_status_land.xml
+++ b/core/res/res/layout-xlarge/keyguard_screen_status_land.xml
@@ -38,6 +38,7 @@
android:layout_marginTop="32dip"
android:singleLine="true"
android:ellipsize="marquee"
+ android:visibility="gone"
/>
<com.android.internal.widget.DigitalClock android:id="@+id/time"
@@ -47,37 +48,45 @@
android:layout_alignParentLeft="true"
android:layout_marginTop="8dip"
android:layout_marginBottom="8dip"
+ android:layout_marginLeft="-10dip"
>
- <TextView android:id="@+id/timeDisplay"
+ <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
+ top of the other. Hence the redundant layout... -->
+ <TextView android:id="@+id/timeDisplayBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="none"
android:textSize="120sp"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#C0000000"
- android:shadowDx="0"
- android:shadowDy="0"
- android:shadowRadius="3.0"
+ android:textColor="#999999"
android:layout_marginBottom="6dip"
/>
+ <TextView android:id="@+id/timeDisplayForeground"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="none"
+ android:textSize="120sp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="#666666"
+ android:layout_alignLeft="@id/timeDisplayBackground"
+ android:layout_alignTop="@id/timeDisplayBackground"
+ android:layout_marginBottom="6dip"
+ />
<TextView android:id="@+id/am_pm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_toRightOf="@id/timeDisplay"
- android:layout_alignBaseline="@id/timeDisplay"
+ android:layout_toRightOf="@id/timeDisplayBackground"
+ android:layout_alignBaseline="@id/timeDisplayBackground"
android:singleLine="true"
android:ellipsize="none"
android:textSize="30sp"
android:layout_marginLeft="8dip"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#C0000000"
- android:shadowDx="0"
- android:shadowDy="0"
- android:shadowRadius="3.0"
/>
</com.android.internal.widget.DigitalClock>
@@ -87,32 +96,33 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/time"
- android:layout_marginTop="5dip"
+ android:layout_marginTop="10dip"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="32sp"
+ android:textSize="22sp"
/>
- <!-- used for instructions such as "draw pattern to unlock", the next alarm, and charging
- status. -->
+ <!-- Status2 is generally charge status -->
<TextView
android:id="@+id/status2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="32sp"
- android:layout_marginTop="50dip"
+ android:textSize="22sp"
+ android:layout_marginTop="10dip"
android:drawablePadding="4dip"
/>
+
+ <!-- Status1 is generally alarm status -->
<TextView
android:id="@+id/status1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="15dip"
- android:textSize="32sp"
+ android:layout_marginTop="10dip"
+ android:textSize="22sp"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
-
+
<TextView
android:id="@+id/propertyOf"
android:lineSpacingExtra="8dip"
@@ -120,7 +130,7 @@
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="22sp"
- android:layout_marginTop="50dip"
+ android:layout_marginTop="20dip"
android:singleLine="false"
android:visibility="invisible"
/>
diff --git a/core/res/res/layout-xlarge/keyguard_screen_status_port.xml b/core/res/res/layout-xlarge/keyguard_screen_status_port.xml
index 8589862..4e87b21 100644
--- a/core/res/res/layout-xlarge/keyguard_screen_status_port.xml
+++ b/core/res/res/layout-xlarge/keyguard_screen_status_port.xml
@@ -38,6 +38,7 @@
android:layout_marginTop="32dip"
android:singleLine="true"
android:ellipsize="marquee"
+ android:visibility="gone"
/>
<com.android.internal.widget.DigitalClock android:id="@+id/time"
@@ -47,37 +48,44 @@
android:layout_alignParentLeft="true"
android:layout_marginTop="8dip"
android:layout_marginBottom="8dip"
- >
+ android_layout_marginLeft="-10dip">
- <TextView android:id="@+id/timeDisplay"
+ <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
+ top of the other. Hence the redundant layout... -->
+ <TextView android:id="@+id/timeDisplayBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="none"
android:textSize="120sp"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#C0000000"
- android:shadowDx="0"
- android:shadowDy="0"
- android:shadowRadius="3.0"
+ android:textColor="#999999"
android:layout_marginBottom="6dip"
/>
+ <TextView android:id="@+id/timeDisplayForeground"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="none"
+ android:textSize="120sp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="#666666"
+ android:layout_marginBottom="6dip"
+ android:layout_alignLeft="@id/timeDisplayBackground"
+ android:layout_alignTop="@id/timeDisplayBackground"
+ />
<TextView android:id="@+id/am_pm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_toRightOf="@id/timeDisplay"
- android:layout_alignBaseline="@id/timeDisplay"
+ android:layout_toRightOf="@id/timeDisplayBackground"
+ android:layout_alignBaseline="@id/timeDisplayBackground"
android:singleLine="true"
android:ellipsize="none"
android:textSize="30sp"
android:layout_marginLeft="8dip"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#C0000000"
- android:shadowDx="0"
- android:shadowDy="0"
- android:shadowRadius="3.0"
/>
</com.android.internal.widget.DigitalClock>
@@ -87,40 +95,40 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/time"
- android:layout_marginTop="5dip"
+ android:layout_marginTop="10dip"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="32sp"
+ android:textSize="22sp"
/>
- <!-- used for instructions such as "draw pattern to unlock", the next alarm, and charging
- status. -->
+ <!-- used for status such as the next alarm, and charging status. -->
<TextView
android:id="@+id/status2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="32sp"
- android:layout_marginTop="50dip"
+ android:textSize="22sp"
+ android:layout_marginTop="10dip"
android:drawablePadding="4dip"
/>
+
<TextView
android:id="@+id/status1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="15dip"
- android:textSize="32sp"
+ android:layout_marginTop="10dip"
+ android:textSize="22sp"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
-
+
<TextView
android:id="@+id/propertyOf"
android:lineSpacingExtra="8dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="20dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="22sp"
- android:layout_marginTop="50dip"
android:singleLine="false"
android:visibility="invisible"
/>
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock.xml b/core/res/res/layout/keyguard_screen_tab_unlock.xml
index 6edbdf9..03bd45b 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock.xml
@@ -67,35 +67,42 @@
android:layout_marginBottom="8dip"
>
- <TextView android:id="@+id/timeDisplay"
+ <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
+ top of the other. Hence the redundant layout... -->
+ <TextView android:id="@+id/timeDisplayBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="none"
android:textSize="72sp"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#C0000000"
- android:shadowDx="0"
- android:shadowDy="0"
- android:shadowRadius="3.0"
- android:layout_marginBottom="10dip"
+ android:layout_marginBottom="6dip"
+ android:textColor="#999999"
/>
+ <TextView android:id="@+id/timeDisplayForeground"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="none"
+ android:textSize="72sp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_marginBottom="6dip"
+ android:textColor="#666666"
+ android:layout_alignLeft="@id/timeDisplayBackground"
+ android:layout_alignTop="@id/timeDisplayBackground"
+ />
<TextView android:id="@+id/am_pm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_toRightOf="@id/timeDisplay"
- android:layout_alignBaseline="@id/timeDisplay"
+ android:layout_toRightOf="@id/timeDisplayBackground"
+ android:layout_alignBaseline="@id/timeDisplayBackground"
android:singleLine="true"
android:ellipsize="none"
android:textSize="22sp"
android:layout_marginLeft="8dip"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#C0000000"
- android:shadowDx="0"
- android:shadowDy="0"
- android:shadowRadius="3.0"
/>
</com.android.internal.widget.DigitalClock>
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
index e66b492..bb0c012 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
@@ -68,35 +68,42 @@
android:layout_marginBottom="8dip"
>
- <TextView android:id="@+id/timeDisplay"
+ <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
+ top of the other. Hence the redundant layout... -->
+ <TextView android:id="@+id/timeDisplayBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="none"
android:textSize="72sp"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#C0000000"
- android:shadowDx="0"
- android:shadowDy="0"
- android:shadowRadius="3.0"
android:layout_marginBottom="6dip"
+ android:textColor="#999999"
/>
+ <TextView android:id="@+id/timeDisplayForeground"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="none"
+ android:textSize="72sp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_marginBottom="6dip"
+ android:textColor="#666666"
+ android:layout_alignLeft="@id/timeDisplayBackground"
+ android:layout_alignTop="@id/timeDisplayBackground"
+ />
<TextView android:id="@+id/am_pm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_toRightOf="@id/timeDisplay"
- android:layout_alignBaseline="@id/timeDisplay"
+ android:layout_toRightOf="@id/timeDisplayBackground"
+ android:layout_alignBaseline="@id/timeDisplayBackground"
android:singleLine="true"
android:ellipsize="none"
android:textSize="22sp"
android:layout_marginLeft="8dip"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#C0000000"
- android:shadowDx="0"
- android:shadowDy="0"
- android:shadowRadius="3.0"
/>
</com.android.internal.widget.DigitalClock>
diff --git a/core/res/res/layout/keyguard_screen_unlock_landscape.xml b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
index 83381a1..a6face9 100644
--- a/core/res/res/layout/keyguard_screen_unlock_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
@@ -68,35 +68,44 @@
android:layout_marginBottom="8dip"
>
- <TextView android:id="@+id/timeDisplay"
+ <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
+ top of the other. Hence the redundant layout... -->
+ <TextView android:id="@+id/timeDisplayBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="none"
android:textSize="72sp"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#C0000000"
- android:shadowDx="0"
- android:shadowDy="0"
- android:shadowRadius="3.0"
android:layout_marginBottom="6dip"
+ android:textColor="#999999"
/>
+ <TextView android:id="@+id/timeDisplayForeground"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="none"
+ android:textSize="72sp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_marginBottom="6dip"
+ android:layout_alignLeft="@id/timeDisplayBackground"
+ android:layout_alignTop="@id/timeDisplayBackground"
+ android:textColor="#666666"
+ />
+
+
<TextView android:id="@+id/am_pm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_toRightOf="@id/timeDisplay"
- android:layout_alignBaseline="@id/timeDisplay"
+ android:layout_toRightOf="@id/timeDisplayBackground"
+ android:layout_alignBaseline="@id/timeDisplayBackground"
android:singleLine="true"
android:ellipsize="none"
android:textSize="22sp"
android:layout_marginLeft="8dip"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#C0000000"
- android:shadowDx="0"
- android:shadowDy="0"
- android:shadowRadius="3.0"
/>
</com.android.internal.widget.DigitalClock>
diff --git a/core/res/res/layout/keyguard_screen_unlock_portrait.xml b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
index 8dacfaf..42144ab 100644
--- a/core/res/res/layout/keyguard_screen_unlock_portrait.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
@@ -58,34 +58,40 @@
android:layout_marginBottom="8dip"
>
- <TextView android:id="@+id/timeDisplay"
+ <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
+ top of the other. Hence the redundant layout... -->
+ <TextView android:id="@+id/timeDisplayBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="none"
android:textSize="56sp"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#C0000000"
- android:shadowDx="0"
- android:shadowDy="0"
- android:shadowRadius="3.0"
android:layout_marginBottom="6dip"
+ android:textColor="#999999"
+ />
+
+ <TextView android:id="@+id/timeDisplayForeground"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="none"
+ android:textSize="56sp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_marginBottom="6dip"
+ android:textColor="#666666"
/>
<TextView android:id="@+id/am_pm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_toRightOf="@id/timeDisplay"
- android:layout_alignBaseline="@id/timeDisplay"
+ android:layout_toRightOf="@id/timeDisplayBackground"
+ android:layout_alignBaseline="@id/timeDisplayBackground"
android:singleLine="true"
android:ellipsize="none"
android:textSize="18sp"
android:layout_marginLeft="4dip"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:shadowColor="#C0000000"
- android:shadowDx="0"
- android:shadowDy="0"
- android:shadowRadius="3.0"
/>
</com.android.internal.widget.DigitalClock>
diff --git a/data/fonts/AndroidClock.ttf b/data/fonts/AndroidClock.ttf
new file mode 100644
index 0000000..3945183
--- /dev/null
+++ b/data/fonts/AndroidClock.ttf
Binary files differ
diff --git a/data/fonts/AndroidClock_Highlight.ttf b/data/fonts/AndroidClock_Highlight.ttf
new file mode 100644
index 0000000..fa0221e
--- /dev/null
+++ b/data/fonts/AndroidClock_Highlight.ttf
Binary files differ
diff --git a/data/fonts/fonts.mk b/data/fonts/fonts.mk
index 34d0331..b8a93e8 100644
--- a/data/fonts/fonts.mk
+++ b/data/fonts/fonts.mk
@@ -26,4 +26,6 @@
frameworks/base/data/fonts/DroidSerif-BoldItalic.ttf:system/fonts/DroidSerif-BoldItalic.ttf \
frameworks/base/data/fonts/DroidSansMono.ttf:system/fonts/DroidSansMono.ttf \
frameworks/base/data/fonts/Clockopia.ttf:system/fonts/Clockopia.ttf \
- frameworks/base/data/fonts/DroidSansFallback.ttf:system/fonts/DroidSansFallback.ttf
+ frameworks/base/data/fonts/DroidSansFallback.ttf:system/fonts/DroidSansFallback.ttf \
+ frameworks/base/data/fonts/AndroidClock.ttf:system/fonts/AndroidClock.ttf \
+ frameworks/base/data/fonts/AndroidClock_Highlight.ttf:system/fonts/AndroidClock_Highlight.ttf