diff options
author | Jim Miller <jaggies@google.com> | 2010-12-17 16:23:30 -0800 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2010-12-17 17:53:02 -0800 |
commit | 4e659135fdb50dce83a3f26f61f410a65a8ff584 (patch) | |
tree | 2f8eb283a57f28cc4ba395d74e70f468ebad88dd /core/java/com/android | |
parent | b146b1214ef6e4fc75d98779b22434335764cfdb (diff) | |
download | frameworks_base-4e659135fdb50dce83a3f26f61f410a65a8ff584.zip frameworks_base-4e659135fdb50dce83a3f26f61f410a65a8ff584.tar.gz frameworks_base-4e659135fdb50dce83a3f26f61f410a65a8ff584.tar.bz2 |
Fix 3148496: Update LockScreen clock to use new font.
Change-Id: I8a4133f633bd3927de75010099e29ad847f3f671
Diffstat (limited to 'core/java/com/android')
-rw-r--r-- | core/java/com/android/internal/widget/DigitalClock.java | 23 |
1 files changed, 17 insertions, 6 deletions
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.BroadcastReceiver; 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 @@ import java.util.Calendar; */ 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 @@ public class DigitalClock extends RelativeLayout { 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 @@ public class DigitalClock extends RelativeLayout { } 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)); } |