Don't assume we can pulse when calling setAllValues().
Don't display both on/off pulse values when it cannot pulse.
Default to Always on when we can't pulse.
Ref: CYNGNOS-403
Change-Id: Ie356cdc35cb545dd51896697f89ef265ada1147f
Signed-off-by: Roman Birg <roman@cyngn.com>
mOnValueView.setText(mapLengthValue(mOnValue));
}
if (mOffValueView != null) {
- if (mOnValue == 1) {
+ if (mOnValue == 1 || !mOnOffChangeable) {
mOffValueView.setVisibility(View.GONE);
} else {
mOffValueView.setVisibility(View.VISIBLE);
mColorValue = color;
mOnValue = onValue;
mOffValue = offValue;
- mOnOffChangeable = true;
updatePreferenceViews();
}
}
private String mapLengthValue(Integer time) {
+ if (!mOnOffChangeable) {
+ return getContext().getString(R.string.pulse_length_always_on);
+ }
if (time == DEFAULT_TIME) {
return getContext().getString(R.string.default_time);
}