/**
* Update monitoring preference.
*
* @param preference preference to update.
* @param value new value.
*/
private void updatePreference(Preference preference, Object value) {
// Get value if not passed
Object newVal;
if (value == null) {
if (preference instanceof VNTNumberPickerPreference) {
newVal = PreferenceManager.getDefaultSharedPreferences(preference.getContext())
.getInt(preference.getKey(), Integer.parseInt(preference.getSummary().toString()));
} else if (preference instanceof TwoStatePreference) {
newVal = PreferenceManager.getDefaultSharedPreferences(preference.getContext())
.getBoolean(preference.getKey(), true);
} else {
newVal = PreferenceManager.getDefaultSharedPreferences(preference.getContext())
.getString(preference.getKey(), "");
}
} else {
newVal = value;
}
// Update preference
updateAlgorithm(preference, newVal);
updateSummary(preference, newVal);
}
MonitoringSettingsFragment.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:go-bees
作者:
评论列表
文章目录