Use ColorDisplayManager for night display settings
Bug: 123352608 Test: make ROBOTEST_FILTER="(Night*)" RunSettingsRoboTests -j48 Change-Id: Id4ab9ca4a21243be5967d63db72212daefb3dcb9
This commit is contained in:
@@ -50,6 +50,7 @@ public class NightDisplaySettings extends DashboardFragment
|
||||
private static final int DIALOG_START_TIME = 0;
|
||||
private static final int DIALOG_END_TIME = 1;
|
||||
|
||||
private ColorDisplayManager mColorDisplayManager;
|
||||
private ColorDisplayController mController;
|
||||
|
||||
@Override
|
||||
@@ -57,6 +58,7 @@ public class NightDisplaySettings extends DashboardFragment
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
final Context context = getContext();
|
||||
mColorDisplayManager = context.getSystemService(ColorDisplayManager.class);
|
||||
mController = new ColorDisplayController(context);
|
||||
}
|
||||
|
||||
@@ -93,9 +95,9 @@ public class NightDisplaySettings extends DashboardFragment
|
||||
if (dialogId == DIALOG_START_TIME || dialogId == DIALOG_END_TIME) {
|
||||
final LocalTime initialTime;
|
||||
if (dialogId == DIALOG_START_TIME) {
|
||||
initialTime = mController.getCustomStartTime();
|
||||
initialTime = mColorDisplayManager.getNightDisplayCustomStartTime();
|
||||
} else {
|
||||
initialTime = mController.getCustomEndTime();
|
||||
initialTime = mColorDisplayManager.getNightDisplayCustomEndTime();
|
||||
}
|
||||
|
||||
final Context context = getContext();
|
||||
@@ -103,9 +105,9 @@ public class NightDisplaySettings extends DashboardFragment
|
||||
return new TimePickerDialog(context, (view, hourOfDay, minute) -> {
|
||||
final LocalTime time = LocalTime.of(hourOfDay, minute);
|
||||
if (dialogId == DIALOG_START_TIME) {
|
||||
mController.setCustomStartTime(time);
|
||||
mColorDisplayManager.setNightDisplayCustomStartTime(time);
|
||||
} else {
|
||||
mController.setCustomEndTime(time);
|
||||
mColorDisplayManager.setNightDisplayCustomEndTime(time);
|
||||
}
|
||||
}, initialTime.getHour(), initialTime.getMinute(), use24HourFormat);
|
||||
}
|
||||
|
Reference in New Issue
Block a user