Loading packages/SettingsLib/src/com/android/settingslib/datetime/ZoneGetter.java +6 −11 Original line number Diff line number Diff line Loading @@ -88,21 +88,16 @@ public class ZoneGetter { private static final String XMLTAG_TIMEZONE = "timezone"; public static CharSequence getTimeZoneOffsetAndName(Context context, TimeZone tz, Date now) { final Locale locale = Locale.getDefault(); final CharSequence gmtText = getGmtOffsetText(context, locale, tz, now); final TimeZoneNames timeZoneNames = TimeZoneNames.getInstance(locale); final ZoneGetterData data = new ZoneGetterData(context); final boolean useExemplarLocationForLocalNames = shouldUseExemplarLocationForLocalNames(data, timeZoneNames); final CharSequence zoneName = getTimeZoneDisplayName(data, timeZoneNames, useExemplarLocationForLocalNames, tz, tz.getID()); if (zoneName == null) { Locale locale = Locale.getDefault(); CharSequence gmtText = getGmtOffsetText(context, locale, tz, now); TimeZoneNames timeZoneNames = TimeZoneNames.getInstance(locale); String zoneNameString = getZoneLongName(timeZoneNames, tz, now); if (zoneNameString == null) { return gmtText; } // 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) { Loading packages/SettingsLib/tests/integ/src/com/android/settingslib/utils/ZoneGetterTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -47,9 +47,9 @@ public class ZoneGetterTest { } @Test public void getTimeZoneOffsetAndName_setLondon_returnLondon() { // Check it will ends with 'London', not 'British Summer Time' or sth else testTimeZoneOffsetAndNameInner(TIME_ZONE_LONDON_ID, "London"); public void getTimeZoneOffsetAndName_setLondon_returnBritishSummerTime() { // Check it will ends with 'British Summer Time', not 'London' or sth else testTimeZoneOffsetAndNameInner(TIME_ZONE_LONDON_ID, "British Summer Time"); } @Test Loading Loading
packages/SettingsLib/src/com/android/settingslib/datetime/ZoneGetter.java +6 −11 Original line number Diff line number Diff line Loading @@ -88,21 +88,16 @@ public class ZoneGetter { private static final String XMLTAG_TIMEZONE = "timezone"; public static CharSequence getTimeZoneOffsetAndName(Context context, TimeZone tz, Date now) { final Locale locale = Locale.getDefault(); final CharSequence gmtText = getGmtOffsetText(context, locale, tz, now); final TimeZoneNames timeZoneNames = TimeZoneNames.getInstance(locale); final ZoneGetterData data = new ZoneGetterData(context); final boolean useExemplarLocationForLocalNames = shouldUseExemplarLocationForLocalNames(data, timeZoneNames); final CharSequence zoneName = getTimeZoneDisplayName(data, timeZoneNames, useExemplarLocationForLocalNames, tz, tz.getID()); if (zoneName == null) { Locale locale = Locale.getDefault(); CharSequence gmtText = getGmtOffsetText(context, locale, tz, now); TimeZoneNames timeZoneNames = TimeZoneNames.getInstance(locale); String zoneNameString = getZoneLongName(timeZoneNames, tz, now); if (zoneNameString == null) { return gmtText; } // 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) { Loading
packages/SettingsLib/tests/integ/src/com/android/settingslib/utils/ZoneGetterTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -47,9 +47,9 @@ public class ZoneGetterTest { } @Test public void getTimeZoneOffsetAndName_setLondon_returnLondon() { // Check it will ends with 'London', not 'British Summer Time' or sth else testTimeZoneOffsetAndNameInner(TIME_ZONE_LONDON_ID, "London"); public void getTimeZoneOffsetAndName_setLondon_returnBritishSummerTime() { // Check it will ends with 'British Summer Time', not 'London' or sth else testTimeZoneOffsetAndNameInner(TIME_ZONE_LONDON_ID, "British Summer Time"); } @Test Loading