Merge "Replace dynamic summary text for SettingPref" into oc-dev

am: 49b86b5c6a

Change-Id: Icb21526f03242d310824d20a21c82bd2f76893f2
This commit is contained in:
Matthew Fritze
2017-05-16 00:12:07 +00:00
committed by android-build-merger
5 changed files with 83 additions and 4 deletions

View File

@@ -99,7 +99,6 @@ public class BatterySaverSettings extends SettingsPreferenceFragment
}
};
mTriggerPref.init(this);
mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
}

View File

@@ -121,6 +121,19 @@ public class SettingPref {
if (mTwoState != null) {
mTwoState.setChecked(val != 0);
} else if (mDropDown != null) {
if (mValues != null) {
int index = 0;
for (int len = mValues.length; index < len; index++) {
if (mValues[index] == val) {
break;
}
}
if (index < mValues.length) {
CharSequence entry = mDropDown.getEntries()[index];
mDropDown.setSummary(entry);
}
}
mDropDown.setValue(Integer.toString(val));
}
}