Select max timeout, if it's in the timeout list
Bug: 10192592 Change-Id: I21ec208abf0c8659233cdb5219d9b226528aa1d4
This commit is contained in:
@@ -193,13 +193,18 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (revisedEntries.size() != entries.length || revisedValues.size() != values.length) {
|
if (revisedEntries.size() != entries.length || revisedValues.size() != values.length) {
|
||||||
|
final int userPreference = Integer.parseInt(screenTimeoutPreference.getValue());
|
||||||
screenTimeoutPreference.setEntries(
|
screenTimeoutPreference.setEntries(
|
||||||
revisedEntries.toArray(new CharSequence[revisedEntries.size()]));
|
revisedEntries.toArray(new CharSequence[revisedEntries.size()]));
|
||||||
screenTimeoutPreference.setEntryValues(
|
screenTimeoutPreference.setEntryValues(
|
||||||
revisedValues.toArray(new CharSequence[revisedValues.size()]));
|
revisedValues.toArray(new CharSequence[revisedValues.size()]));
|
||||||
final int userPreference = Integer.parseInt(screenTimeoutPreference.getValue());
|
|
||||||
if (userPreference <= maxTimeout) {
|
if (userPreference <= maxTimeout) {
|
||||||
screenTimeoutPreference.setValue(String.valueOf(userPreference));
|
screenTimeoutPreference.setValue(String.valueOf(userPreference));
|
||||||
|
} else if (revisedValues.size() > 0
|
||||||
|
&& Long.parseLong(revisedValues.get(revisedValues.size() - 1).toString())
|
||||||
|
== maxTimeout) {
|
||||||
|
// If the last one happens to be the same as the max timeout, select that
|
||||||
|
screenTimeoutPreference.setValue(String.valueOf(maxTimeout));
|
||||||
} else {
|
} else {
|
||||||
// There will be no highlighted selection since nothing in the list matches
|
// There will be no highlighted selection since nothing in the list matches
|
||||||
// maxTimeout. The user can still select anything less than maxTimeout.
|
// maxTimeout. The user can still select anything less than maxTimeout.
|
||||||
|
Reference in New Issue
Block a user