62 |
|
|
63 |
@Override |
@Override |
64 |
public int compareTo(DepartureBean otherBean) { |
public int compareTo(DepartureBean otherBean) { |
65 |
|
String timeStr1 = time.replace(":","").trim(); |
66 |
|
String timeStr2 = otherBean.time.replace(":","").trim(); |
67 |
|
|
68 |
int time1 = Integer.parseInt(time.replace(":", "")); |
int time1 = 0; |
69 |
int time2 = Integer.parseInt(otherBean.time.replace(":", "")); |
int time2 = 0; |
70 |
if (time1 > time2) |
|
71 |
return 1; |
if (timeStr1.length() > 0) |
72 |
else |
time1 = Integer.parseInt(timeStr1); |
73 |
return -1; |
|
74 |
|
if (timeStr2.length() > 0) |
75 |
|
time2 = Integer.parseInt(timeStr2); |
76 |
|
|
77 |
|
//work correctly when clock wraps around at midnight |
78 |
|
if (Math.abs(time1-time2) < 1200) { |
79 |
|
if (time1 > time2) |
80 |
|
return 1; |
81 |
|
else |
82 |
|
return -1; |
83 |
|
} else { |
84 |
|
if (time1 < time2) |
85 |
|
return 1; |
86 |
|
else |
87 |
|
return -1; |
88 |
|
|
89 |
|
} |
90 |
|
|
91 |
} |
} |
92 |
|
|
98 |
updStr = "< 3 min"; |
updStr = "< 3 min"; |
99 |
break; |
break; |
100 |
case 2: |
case 2: |
101 |
updStr = "< 3 min"; |
updStr = "3-10 min"; |
102 |
break; |
break; |
103 |
case 3: |
case 3: |
104 |
updStr = "> 10 min"; |
updStr = "> 10 min"; |