Update titles and summaries of the Date and time settings page

Design doc: go/dd-android-settings-time-2024

This change covers Part 1, which consists of adding user-friendly summary under each toggle and rewording titles.

Bug: 296835792
Test: on-device and atest
Flag: EXEMPT resource only update
Change-Id: I0b685743599880fc1c4ad680eca9c36e4e64d0ff
This commit is contained in:
Geoffrey Boullanger
2024-09-23 21:32:28 +00:00
parent 9cdd1108c3
commit 8b7399a8d9
6 changed files with 41 additions and 13 deletions

View File

@@ -27,6 +27,8 @@ import android.app.time.TimeConfiguration;
import android.app.time.TimeManager;
import android.content.Context;
import androidx.preference.Preference;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
import com.android.settings.core.TogglePreferenceController;
@@ -76,6 +78,17 @@ public class AutoTimePreferenceController extends TogglePreferenceController {
}
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
refreshSummary(preference);
}
@Override
public CharSequence getSummary() {
return mContext.getString(R.string.date_time_auto_summary);
}
@Override
public boolean isChecked() {
return isEnabled();

View File

@@ -129,11 +129,11 @@ public class AutoTimeZonePreferenceController extends TogglePreferenceController
// time zone must use location.
if (LocationProviderStatusPreferenceController.hasLocationTimeZoneNoTelephonyFallback(
mTimeManager.getTimeZoneCapabilitiesAndConfig().getDetectorStatus())) {
return mContext.getResources().getString(R.string.auto_zone_requires_location_summary);
return mContext.getString(R.string.auto_zone_requires_location_summary);
}
// If the user has a dedicated toggle to control location use, the summary can
// be empty because the use of location is explicit.
return "";
// If the user has a dedicated toggle to control location use, explain what it does.
return mContext.getString(R.string.zone_auto_title_summary);
}
@VisibleForTesting