OSDN Git Service

Look up the localized name of the time zone of the Calendar event.
authorEric Fischer <enf@google.com>
Tue, 4 Aug 2009 00:53:29 +0000 (17:53 -0700)
committerEric Fischer <enf@google.com>
Tue, 4 Aug 2009 00:55:28 +0000 (17:55 -0700)
Previously it was just displaying the ID of the zone, which is fine
for English speakers but not so good for other writing systems.

Bug 2022197

src/com/android/calendar/EventInfoActivity.java

index 551aca6..9be1900 100644 (file)
@@ -55,6 +55,7 @@ import android.widget.Toast;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.TimeZone;
 import java.util.regex.Pattern;
 
 public class EventInfoActivity extends Activity implements View.OnClickListener,
@@ -636,7 +637,15 @@ public class EventInfoActivity extends Activity implements View.OnClickListener,
             localTimezone = Time.TIMEZONE_UTC;
         }
         if (eventTimezone != null && !localTimezone.equals(eventTimezone) && !allDay) {
-            setTextCommon(R.id.timezone, localTimezone);
+            String displayName;
+            TimeZone tz = TimeZone.getTimeZone(localTimezone);
+            if (tz == null || tz.getID().equals("GMT")) {
+                displayName = localTimezone;
+            } else {
+                displayName = tz.getDisplayName();
+            }
+
+            setTextCommon(R.id.timezone, displayName);
         } else {
             setVisibilityCommon(R.id.timezone_container, View.GONE);
         }