diff options
-rw-r--r-- | res/layout-land/desk_clock.xml | 3 | ||||
-rw-r--r-- | res/layout/desk_clock.xml | 3 | ||||
-rw-r--r-- | res/layout/desk_clock_battery.xml | 3 | ||||
-rw-r--r-- | res/layout/desk_clock_saver.xml | 3 | ||||
-rw-r--r-- | res/layout/desk_clock_time_date.xml | 7 | ||||
-rw-r--r-- | res/layout/desk_clock_weather.xml | 12 | ||||
-rw-r--r-- | src/com/android/deskclock/DeskClock.java | 33 |
7 files changed, 20 insertions, 44 deletions
diff --git a/res/layout-land/desk_clock.xml b/res/layout-land/desk_clock.xml index 8e7ce88a7..6ea363b2a 100644 --- a/res/layout-land/desk_clock.xml +++ b/res/layout-land/desk_clock.xml @@ -55,8 +55,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:gravity="left" - android:textSize="18sp" - android:textColor="#FFFFFFFF" + android:textAppearance="?android:attr/textAppearanceMedium" android:drawablePadding="6dip" android:drawableLeft="@drawable/ic_lock_idle_alarm" android:shadowColor="#C0000000" diff --git a/res/layout/desk_clock.xml b/res/layout/desk_clock.xml index 2246a2fab..7ffd1d21f 100644 --- a/res/layout/desk_clock.xml +++ b/res/layout/desk_clock.xml @@ -57,8 +57,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:gravity="left" - android:textSize="18sp" - android:textColor="#FFFFFFFF" + android:textAppearance="?android:attr/textAppearanceMedium" android:drawablePadding="6dip" android:drawableLeft="@drawable/ic_lock_idle_alarm" android:shadowColor="#C0000000" diff --git a/res/layout/desk_clock_battery.xml b/res/layout/desk_clock_battery.xml index ded2ffcda..95375000e 100644 --- a/res/layout/desk_clock_battery.xml +++ b/res/layout/desk_clock_battery.xml @@ -17,8 +17,7 @@ <!-- battery/charge status --> <TextView android:id="@+id/battery" xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="right" - android:textSize="18sp" - android:textColor="#FFFFFFFF" + android:textAppearance="?android:attr/textAppearanceMedium" android:drawablePadding="6dip" android:shadowColor="#C0000000" android:shadowDx="0" diff --git a/res/layout/desk_clock_saver.xml b/res/layout/desk_clock_saver.xml index d34adfd07..945066176 100644 --- a/res/layout/desk_clock_saver.xml +++ b/res/layout/desk_clock_saver.xml @@ -40,8 +40,7 @@ android:layout_height="wrap_content" android:layout_marginBottom="10dip" android:gravity="left" - android:textSize="18sp" - android:textColor="#FFFFFFFF" + android:textAppearance="?android:attr/textAppearanceMedium" android:drawablePadding="6dip" /> <include layout="@layout/desk_clock_time_date" diff --git a/res/layout/desk_clock_time_date.xml b/res/layout/desk_clock_time_date.xml index d6791f3a3..411115eb3 100644 --- a/res/layout/desk_clock_time_date.xml +++ b/res/layout/desk_clock_time_date.xml @@ -47,10 +47,10 @@ android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="bottom" - android:textSize="24sp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:textStyle="bold" android:singleLine="true" android:layout_marginLeft="3dip" - android:textColor="#FFFFFFFF" android:shadowColor="#C0000000" android:shadowDx="0" android:shadowDy="0" @@ -63,8 +63,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left" - android:textSize="22sp" - android:textColor="#FFFFFFFF" + android:textAppearance="?android:attr/textAppearanceMedium" android:shadowColor="#C0000000" android:shadowDx="0" android:shadowDy="0" diff --git a/res/layout/desk_clock_weather.xml b/res/layout/desk_clock_weather.xml index 6847d144d..c5ee761d7 100644 --- a/res/layout/desk_clock_weather.xml +++ b/res/layout/desk_clock_weather.xml @@ -40,8 +40,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" - android:textSize="50sp" - android:textColor="#FFFFFFFF" + android:textSize="46sp" + android:textColor="?android:attr/textColorPrimary" android:shadowColor="#C0000000" android:shadowDx="0" android:shadowDy="0" @@ -55,8 +55,8 @@ android:layout_width="40sp" android:layout_height="wrap_content" android:singleLine="true" - android:textSize="16sp" - android:textColor="#FFBEBEBE" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="?android:attr/textColorSecondary" android:shadowColor="#C0000000" android:shadowDx="0" android:shadowDy="0" @@ -68,8 +68,8 @@ android:layout_width="40sp" android:layout_height="wrap_content" android:singleLine="true" - android:textSize="18sp" - android:textColor="#FFFFFFFF" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="?android:attr/textColorPrimary" android:shadowColor="#C0000000" android:shadowDx="0" android:shadowDy="0" diff --git a/src/com/android/deskclock/DeskClock.java b/src/com/android/deskclock/DeskClock.java index e7060b5a3..654d6d93a 100644 --- a/src/com/android/deskclock/DeskClock.java +++ b/src/com/android/deskclock/DeskClock.java @@ -41,6 +41,7 @@ import android.os.SystemClock; import android.os.PowerManager; import android.provider.Settings; import android.text.TextUtils; +import android.text.format.DateFormat; import android.util.DisplayMetrics; import android.util.Log; import android.view.ContextMenu.ContextMenuInfo; @@ -74,8 +75,6 @@ import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN; import java.io.IOException; import java.io.InputStream; -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; @@ -155,7 +154,7 @@ public class DeskClock extends Activity { private boolean mDimmed = false; private boolean mScreenSaverMode = false; - private DateFormat mDateFormat; + private String mDateFormat; private int mBatteryLevel = -1; private boolean mPluggedIn = false; @@ -336,16 +335,6 @@ public class DeskClock extends Activity { mWeatherFetchScheduled = false; } - private static final boolean sCelsius; - static { - String cc = Locale.getDefault().getCountry().toLowerCase(); - sCelsius = !("us".equals(cc) || "bz".equals(cc) || "jm".equals(cc)); - } - - private static int celsiusToLocal(int tempC) { - return sCelsius ? tempC : (int) Math.round(tempC * 1.8f + 32); - } - private void fetchWeatherData() { // if we couldn't load the weather widget's resources, we simply // assume it's not present on the device. @@ -390,11 +379,11 @@ public class DeskClock extends Activity { mWeatherIconDrawable = mGenieResources.getDrawable(cur.getInt( cur.getColumnIndexOrThrow("iconResId"))); mWeatherCurrentTemperatureString = String.format("%d\u00b0", - celsiusToLocal(cur.getInt(cur.getColumnIndexOrThrow("temperature")))); + (cur.getInt(cur.getColumnIndexOrThrow("temperature")))); mWeatherHighTemperatureString = String.format("%d\u00b0", - celsiusToLocal(cur.getInt(cur.getColumnIndexOrThrow("highTemperature")))); + (cur.getInt(cur.getColumnIndexOrThrow("highTemperature")))); mWeatherLowTemperatureString = String.format("%d\u00b0", - celsiusToLocal(cur.getInt(cur.getColumnIndexOrThrow("lowTemperature")))); + (cur.getInt(cur.getColumnIndexOrThrow("lowTemperature")))); mWeatherLocationString = cur.getString( cur.getColumnIndexOrThrow("location")); } else { @@ -455,7 +444,7 @@ public class DeskClock extends Activity { private void refreshDate() { final Date now = new Date(); if (DEBUG) Log.d(LOG_TAG, "refreshing date..." + now); - mDate.setText(mDateFormat.format(now)); + mDate.setText(DateFormat.format(mDateFormat, now)); } private void refreshAlarm() { @@ -521,15 +510,7 @@ public class DeskClock extends Activity { // reload the date format in case the user has changed settings // recently - final SimpleDateFormat dateFormat = (SimpleDateFormat) - java.text.DateFormat.getDateInstance(java.text.DateFormat.FULL); - // This is a little clumsy; we want to honor the locale's date format - // (rather than simply hardcoding "Weekday, Month Date") but - // DateFormat.FULL includes the year (at least, in enUS). So we lop - // that bit off if it's there; should have no effect on - // locale-specific date strings that look different. - mDateFormat = new SimpleDateFormat(dateFormat.toPattern() - .replace(", yyyy", "")); // no year + mDateFormat = getString(com.android.internal.R.string.full_wday_month_day_no_year); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_DATE_CHANGED); |