Merge "Revert the time zone display name logic" into oc-dev
This commit is contained in:
@@ -88,21 +88,16 @@ public class ZoneGetter {
|
|||||||
private static final String XMLTAG_TIMEZONE = "timezone";
|
private static final String XMLTAG_TIMEZONE = "timezone";
|
||||||
|
|
||||||
public static CharSequence getTimeZoneOffsetAndName(Context context, TimeZone tz, Date now) {
|
public static CharSequence getTimeZoneOffsetAndName(Context context, TimeZone tz, Date now) {
|
||||||
final Locale locale = Locale.getDefault();
|
Locale locale = Locale.getDefault();
|
||||||
final CharSequence gmtText = getGmtOffsetText(context, locale, tz, now);
|
CharSequence gmtText = getGmtOffsetText(context, locale, tz, now);
|
||||||
final TimeZoneNames timeZoneNames = TimeZoneNames.getInstance(locale);
|
TimeZoneNames timeZoneNames = TimeZoneNames.getInstance(locale);
|
||||||
final ZoneGetterData data = new ZoneGetterData(context);
|
String zoneNameString = getZoneLongName(timeZoneNames, tz, now);
|
||||||
|
if (zoneNameString == null) {
|
||||||
final boolean useExemplarLocationForLocalNames =
|
|
||||||
shouldUseExemplarLocationForLocalNames(data, timeZoneNames);
|
|
||||||
final CharSequence zoneName = getTimeZoneDisplayName(data, timeZoneNames,
|
|
||||||
useExemplarLocationForLocalNames, tz, tz.getID());
|
|
||||||
if (zoneName == null) {
|
|
||||||
return gmtText;
|
return gmtText;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't use punctuation here to avoid having to worry about localizing that too!
|
// We don't use punctuation here to avoid having to worry about localizing that too!
|
||||||
return TextUtils.concat(gmtText, " ", zoneName);
|
return TextUtils.concat(gmtText, " ", zoneNameString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Map<String, Object>> getZonesList(Context context) {
|
public static List<Map<String, Object>> getZonesList(Context context) {
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ public class ZoneGetterTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getTimeZoneOffsetAndName_setLondon_returnLondon() {
|
public void getTimeZoneOffsetAndName_setLondon_returnBritishSummerTime() {
|
||||||
// Check it will ends with 'London', not 'British Summer Time' or sth else
|
// Check it will ends with 'British Summer Time', not 'London' or sth else
|
||||||
testTimeZoneOffsetAndNameInner(TIME_ZONE_LONDON_ID, "London");
|
testTimeZoneOffsetAndNameInner(TIME_ZONE_LONDON_ID, "British Summer Time");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user