From 8d33464b3dca7eb34380c3e0f74dbd24f0e5aad8 Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Wed, 21 Nov 2012 15:03:10 -0800 Subject: [PATCH] Fixed sort order of timezones Bug: 7596888 Change-Id: I0008f05379f897b67e38a45c529403f2efab481f --- src/com/android/calendar/TimezoneAdapter.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/com/android/calendar/TimezoneAdapter.java b/src/com/android/calendar/TimezoneAdapter.java index ee8ec9db8..237536c6f 100644 --- a/src/com/android/calendar/TimezoneAdapter.java +++ b/src/com/android/calendar/TimezoneAdapter.java @@ -384,11 +384,11 @@ public class TimezoneAdapter extends ArrayAdapter { */ public CharSequence[][] getAllTimezones() { CharSequence[][] timeZones = new CharSequence[2][sTimezones.size()]; - List ids = new ArrayList(sTimezones.keySet()); List timezones = new ArrayList(sTimezones.values()); + Collections.sort(timezones); int i = 0; for (TimezoneRow row : timezones) { - timeZones[0][i] = ids.get(i); + timeZones[0][i] = row.mId; timeZones[1][i++] = row.toString(); } return timeZones; @@ -405,6 +405,9 @@ public class TimezoneAdapter extends ArrayAdapter { if (ids.length != labels.length) { Log.wtf(TAG, "ids length (" + ids.length + ") and labels length(" + labels.length + ") should be equal but aren't."); + if (ids.length > labels.length) { + length = labels.length; + } } for (int i = 0; i < length; i++) { sTimezones.put(ids[i], new TimezoneRow(ids[i], labels[i])); -- GitLab