summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorSam Blitzstein <sblitz@google.com>2013-05-03 18:18:41 -0700
committerSam Blitzstein <sblitz@google.com>2013-05-03 18:43:27 -0700
commit5f2204bc83982ec4ffec0e01efa39325b4fe58ae (patch)
tree1dc0f3c22d8b89ff0b47fe49710ee50d3dad885c /src/com/android
parentc2231ca83440271975f26a0d31e361b2e25145ef (diff)
downloadandroid_frameworks_opt_timezonepicker-5f2204bc83982ec4ffec0e01efa39325b4fe58ae.tar.gz
android_frameworks_opt_timezonepicker-5f2204bc83982ec4ffec0e01efa39325b4fe58ae.tar.bz2
android_frameworks_opt_timezonepicker-5f2204bc83982ec4ffec0e01efa39325b4fe58ae.zip
Reformat timezone name to better distinguish GMT from timezone.
Bug: 8794160 Change-Id: If97efddb49ee05394666d95a83c74731f8501807
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/timezonepicker/TimeZoneInfo.java2
-rw-r--r--src/com/android/timezonepicker/TimeZonePickerUtils.java18
2 files changed, 12 insertions, 8 deletions
diff --git a/src/com/android/timezonepicker/TimeZoneInfo.java b/src/com/android/timezonepicker/TimeZoneInfo.java
index 5a019a6..9d302eb 100644
--- a/src/com/android/timezonepicker/TimeZoneInfo.java
+++ b/src/com/android/timezonepicker/TimeZoneInfo.java
@@ -165,7 +165,7 @@ public class TimeZoneInfo implements Comparable<TimeZoneInfo> {
// mFormatter writes to mSB
DateUtils.formatDateRange(context, mFormatter, now, now, flags, mTzId);
- mSB.append(' ');
+ mSB.append(" ");
int gmtStart = mSB.length();
TimeZonePickerUtils.appendGmtOffset(mSB, gmtOffset);
int gmtEnd = mSB.length();
diff --git a/src/com/android/timezonepicker/TimeZonePickerUtils.java b/src/com/android/timezonepicker/TimeZonePickerUtils.java
index 9dae7aa..e0f50ce 100644
--- a/src/com/android/timezonepicker/TimeZonePickerUtils.java
+++ b/src/com/android/timezonepicker/TimeZonePickerUtils.java
@@ -32,7 +32,7 @@ import java.util.TimeZone;
public class TimeZonePickerUtils {
private static final String TAG = "TimeZonePickerUtils";
- public static final int GMT_TEXT_COLOR = 0xFFAAAAAA;
+ public static final int GMT_TEXT_COLOR = 0xFF888888;
public static final int DST_SYMBOL_COLOR = 0xFFBFBFBF;
private static final Factory mSpannableFactory = Spannable.Factory.getInstance();
@@ -59,9 +59,11 @@ public class TimeZonePickerUtils {
* @param context Context in case the override labels need to be re-cached.
* @param id The timezone id
* @param millis The time (daylight savings or not)
+ * @param grayGmt Whether the "GMT+x" part of the returned string should be colored gray.
* @return The display name of the timezone.
*/
- public CharSequence getGmtDisplayName(Context context, String id, long millis) {
+ public CharSequence getGmtDisplayName(Context context, String id, long millis,
+ boolean grayGmt) {
TimeZone timezone = TimeZone.getTimeZone(id);
if (timezone == null) {
return null;
@@ -74,10 +76,10 @@ public class TimeZonePickerUtils {
mDefaultLocale = defaultLocale;
cacheOverrides(context);
}
- return buildGmtDisplayName(timezone, millis);
+ return buildGmtDisplayName(timezone, millis, grayGmt);
}
- private CharSequence buildGmtDisplayName(TimeZone tz, long timeMillis) {
+ private CharSequence buildGmtDisplayName(TimeZone tz, long timeMillis, boolean grayGmt) {
Time time = new Time(tz.getID());
time.set(timeMillis);
@@ -86,7 +88,7 @@ public class TimeZonePickerUtils {
String displayName = getDisplayName(tz, time.isDst != 0);
sb.append(displayName);
- sb.append(" ");
+ sb.append(" ");
final int gmtOffset = tz.getOffset(timeMillis);
int gmtStart = sb.length();
appendGmtOffset(sb, gmtOffset);
@@ -103,8 +105,10 @@ public class TimeZonePickerUtils {
// Set the gray colors.
Spannable spannableText = mSpannableFactory.newSpannable(sb);
- spannableText.setSpan(new ForegroundColorSpan(GMT_TEXT_COLOR),
- gmtStart, gmtEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ if (grayGmt) {
+ spannableText.setSpan(new ForegroundColorSpan(GMT_TEXT_COLOR),
+ gmtStart, gmtEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
if (tz.useDaylightTime()) {
spannableText.setSpan(new ForegroundColorSpan(DST_SYMBOL_COLOR),
symbolStart, symbolEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);