@@ -24,7 +24,6 @@ class NumberPickerPreference @JvmOverloads constructor(
2424 }
2525 }
2626
27- private var mSummary: CharSequence?
2827 var minValue: Int
2928 var maxValue: Int
3029 var wrapSelectorWheel: Boolean
@@ -33,13 +32,34 @@ class NumberPickerPreference @JvmOverloads constructor(
3332 field = value
3433 notifyChanged()
3534 }
35+ var value = 0
36+ set(value) {
37+ val wasBlocking = shouldDisableDependents()
38+ field = value
39+ initialed = true
40+ persistInt(value)
41+ val isBlocking = shouldDisableDependents()
42+ if (isBlocking != wasBlocking) {
43+ notifyDependencyChange(isBlocking)
44+ }
45+ notifyChanged()
46+ }
47+ private var initialed = false
3648 private var mSummary: CharSequence?
3749 override fun getSummary (): CharSequence? {
3850 val superSummary = super .getSummary()
3951 if (! formatSummary || mSummary == null ) {
4052 return superSummary
4153 }// formatSummary
42- val output = if (summaryProvider == null ) value.toString() else superSummary
54+ val output = if (summaryProvider == null ) {
55+ if (initialed) {
56+ value.toString()
57+ } else {
58+ null
59+ }
60+ } else {
61+ superSummary
62+ }
4363 if (output.isNullOrEmpty()) {
4464 return output
4565 }// formatSummaryValue
@@ -50,18 +70,6 @@ class NumberPickerPreference @JvmOverloads constructor(
5070 }
5171 }
5272
53- var value = 0
54- set(value) {
55- val wasBlocking = shouldDisableDependents()
56- field = value
57- persistInt(value)
58- val isBlocking = shouldDisableDependents()
59- if (isBlocking != wasBlocking) {
60- notifyDependencyChange(isBlocking)
61- }
62- notifyChanged()
63- }
64-
6573 private fun checkDefaultValue (defValue : Int ) = when {
6674 defValue < minValue -> minValue
6775 defValue > maxValue -> maxValue
0 commit comments