summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorSam Blitzstein <sblitz@google.com>2015-02-13 11:40:04 -0800
committermh0rst <moritz@mho-service.net>2016-05-07 20:53:28 +0200
commit5969b9a0b925095ca0bfe036a54b98c1f479abe4 (patch)
tree5c53ec3386f7f0196e8c314aba1d9f0526c2d310 /src/com
parent5bff6769e52dfc57528a6f30101461d80fb5a1e9 (diff)
downloadandroid_frameworks_opt_timezonepicker-cm-13.0.tar.gz
android_frameworks_opt_timezonepicker-cm-13.0.tar.bz2
android_frameworks_opt_timezonepicker-cm-13.0.zip
Bug: 19172146 (cherry picked from commit 882a2d8881017d0315bfb5fd213487147cde4450) Change-Id: I90404c95982505accd97afcc2eb4f27210d1d143
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/timezonepicker/TimeZoneInfo.java68
1 files changed, 1 insertions, 67 deletions
diff --git a/src/com/android/timezonepicker/TimeZoneInfo.java b/src/com/android/timezonepicker/TimeZoneInfo.java
index 9d302eb..e9590f5 100644
--- a/src/com/android/timezonepicker/TimeZoneInfo.java
+++ b/src/com/android/timezonepicker/TimeZoneInfo.java
@@ -46,7 +46,6 @@ public class TimeZoneInfo implements Comparable<TimeZoneInfo> {
TimeZone mTz;
public String mTzId;
int mRawoffset;
- public int[] mTransitions; // may have trailing 0's.
public String mCountry;
public int groupId;
public String mDisplayName;
@@ -59,13 +58,6 @@ public class TimeZoneInfo implements Comparable<TimeZoneInfo> {
mTzId = tz.getID();
mCountry = country;
mRawoffset = tz.getRawOffset();
-
- try {
- mTransitions = getTransitions(tz, time);
- } catch (NoSuchFieldException ignored) {
- } catch (IllegalAccessException ignored) {
- ignored.printStackTrace();
- }
}
SparseArray<String> mLocalTimeCache = new SparseArray<String>();
@@ -194,34 +186,8 @@ public class TimeZoneInfo implements Comparable<TimeZoneInfo> {
return displayName;
}
- private static int[] getTransitions(TimeZone tz, long time)
- throws IllegalAccessException, NoSuchFieldException {
- Class<?> zoneInfoClass = tz.getClass();
- Field mTransitionsField = zoneInfoClass.getDeclaredField("mTransitions");
- mTransitionsField.setAccessible(true);
- int[] objTransitions = (int[]) mTransitionsField.get(tz);
- int[] transitions = null;
- if (objTransitions.length != 0) {
- transitions = new int[NUM_OF_TRANSITIONS];
- int numOfTransitions = 0;
- for (int i = 0; i < objTransitions.length; ++i) {
- if (objTransitions[i] < time) {
- continue;
- }
- transitions[numOfTransitions++] = objTransitions[i];
- if (numOfTransitions == NUM_OF_TRANSITIONS) {
- break;
- }
- }
- }
- return transitions;
- }
-
public boolean hasSameRules(TimeZoneInfo tzi) {
- // this.mTz.hasSameRules(tzi.mTz)
-
- return this.mRawoffset == tzi.mRawoffset
- && Arrays.equals(this.mTransitions, tzi.mTransitions);
+ return this.mTz.hasSameRules(tzi.mTz);
}
@Override
@@ -268,33 +234,6 @@ public class TimeZoneInfo implements Comparable<TimeZoneInfo> {
sb.append(getLocalTime(1383307200000L));
sb.append(SEPARATOR);
- // if (this.mTransitions != null && this.mTransitions.length != 0) {
- // sb.append('"');
- // DateFormat df = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss Z",
- // Locale.US);
- // df.setTimeZone(tz);
- // DateFormat weekdayFormat = new SimpleDateFormat("EEEE", Locale.US);
- // weekdayFormat.setTimeZone(tz);
- // Formatter f = new Formatter(sb);
- // for (int i = 0; i < this.mTransitions.length; ++i) {
- // if (this.mTransitions[i] < time) {
- // continue;
- // }
- //
- // String fromTime = formatTime(df, this.mTransitions[i] - 1);
- // String toTime = formatTime(df, this.mTransitions[i]);
- // f.format("%s -> %s (%d)", fromTime, toTime, this.mTransitions[i]);
- //
- // String weekday = weekdayFormat.format(new Date(1000L *
- // this.mTransitions[i]));
- // if (!weekday.equals("Sunday")) {
- // f.format(" -- %s", weekday);
- // }
- // sb.append("##");
- // }
- // sb.append('"');
- // }
- // sb.append(SEPARATOR);
sb.append('\n');
return sb.toString();
}
@@ -332,11 +271,6 @@ public class TimeZoneInfo implements Comparable<TimeZoneInfo> {
}
}
- if (Arrays.equals(this.mTransitions, other.mTransitions)) {
- Log.e(TAG, "Not expected to be comparing tz with the same country, same offset," +
- " same dst, same transitions:\n" + this.toString() + "\n" + other.toString());
- }
-
// Finally diff by display name
if (mDisplayName != null && other.mDisplayName != null)
return this.mDisplayName.compareTo(other.mDisplayName);