Updated toggles in Date and time settings page
Design doc: go/dd-android-settings-time-2024 Changes: - toggling off "automatic time zone" now sets "use location" off and makes it unmodifiable - removing "use locale default" for time format Bug: 296835792 Test: on-device and atest Flag: com.android.settings.flags.revamp_toggles Change-Id: I31744f104fed06ee9980a6a0160501325175a02d
This commit is contained in:
@@ -25,6 +25,7 @@ import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.TogglePreferenceController;
|
||||
import com.android.settings.flags.Flags;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@@ -72,8 +73,10 @@ public class TimeFormatPreferenceController extends TogglePreferenceController {
|
||||
if (mIsFromSUW) {
|
||||
return DISABLED_DEPENDENT_SETTING;
|
||||
}
|
||||
if (AutoTimeFormatPreferenceController.isAutoTimeFormatSelection(mContext)) {
|
||||
return DISABLED_DEPENDENT_SETTING;
|
||||
if (!Flags.revampToggles()) {
|
||||
if (AutoTimeFormatPreferenceController.isAutoTimeFormatSelection(mContext)) {
|
||||
return DISABLED_DEPENDENT_SETTING;
|
||||
}
|
||||
}
|
||||
return AVAILABLE;
|
||||
}
|
||||
@@ -130,7 +133,7 @@ public class TimeFormatPreferenceController extends TogglePreferenceController {
|
||||
timeFormatPreference = Intent.EXTRA_TIME_PREF_VALUE_USE_LOCALE_DEFAULT;
|
||||
} else {
|
||||
timeFormatPreference = is24Hour ? Intent.EXTRA_TIME_PREF_VALUE_USE_24_HOUR
|
||||
: Intent.EXTRA_TIME_PREF_VALUE_USE_12_HOUR;
|
||||
: Intent.EXTRA_TIME_PREF_VALUE_USE_12_HOUR;
|
||||
}
|
||||
timeChanged.putExtra(Intent.EXTRA_TIME_PREF_24_HOUR_FORMAT, timeFormatPreference);
|
||||
context.sendBroadcast(timeChanged);
|
||||
@@ -138,7 +141,7 @@ public class TimeFormatPreferenceController extends TogglePreferenceController {
|
||||
|
||||
static void set24Hour(Context context, Boolean is24Hour) {
|
||||
String value = is24Hour == null ? null :
|
||||
is24Hour ? HOURS_24 : HOURS_12;
|
||||
is24Hour ? HOURS_24 : HOURS_12;
|
||||
Settings.System.putString(context.getContentResolver(),
|
||||
Settings.System.TIME_12_24, value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user