From d46dff8d4fb336ccd74e8541722e34c2de1f9ee3 Mon Sep 17 00:00:00 2001 From: Sunny Shao Date: Thu, 16 Jun 2022 16:10:02 +0800 Subject: [PATCH] Fix UI flicker problem and update wordings - "Set time zone automatically" changes to "Set automatically". - "Use location to set time zone" changes to "Use location" - Add a new summary text with "Location may be used to set time zone". Fixes: 233968737 Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.datetime Change-Id: Ia16c428e906cda4ebe052bad83c3f574075a7a64 --- res/values/strings.xml | 6 ++++-- res/xml/date_time_prefs.xml | 1 - .../LocationTimeZoneDetectionPreferenceController.java | 2 +- .../LocationTimeZoneDetectionPreferenceControllerTest.java | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index f397b478562..880a7dcee4a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -606,7 +606,7 @@ Set time automatically - Set time zone automatically + Set automatically Use locale default @@ -4254,7 +4254,7 @@ Location services for work - Use location to set time zone + Use location Device location needed @@ -4280,6 +4280,8 @@ Location time zone detection changes are not allowed + + Location may be used to set time zone Wi\u2011Fi & mobile network location diff --git a/res/xml/date_time_prefs.xml b/res/xml/date_time_prefs.xml index a0801f9df1b..e3d0a7e2e23 100644 --- a/res/xml/date_time_prefs.xml +++ b/res/xml/date_time_prefs.xml @@ -45,7 +45,6 @@ diff --git a/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceController.java b/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceController.java index 93e6d0a9644..36cbc9e0b80 100644 --- a/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceController.java +++ b/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceController.java @@ -174,7 +174,7 @@ public class LocationTimeZoneDetectionPreferenceController // If capability is possessed, toggle status already tells all the information needed. // Returning null will make previous text stick on toggling. // See AbstractPreferenceController#refreshSummary. - return ""; + summaryResId = R.string.location_time_zone_detection_auto_is_on; } else { // This is unexpected: getAvailabilityStatus() should ensure that the UI element isn't // even shown for known cases, or the capability is unknown. diff --git a/tests/robotests/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceControllerTest.java index b9c4edc9af2..1f50bed2b5c 100644 --- a/tests/robotests/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceControllerTest.java @@ -150,7 +150,8 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { new TimeZoneCapabilitiesAndConfig(capabilities, configuration); when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig); - assertThat(mController.getSummary().toString()).isEmpty(); + assertThat(mController.getSummary()).isEqualTo( + mContext.getString(R.string.location_time_zone_detection_auto_is_on)); } @Test