@@ -11,7 +11,6 @@ import androidx.preference.SeekBarPreference
11
11
import androidx.preference.children
12
12
import com.programminghoch10.VolumeStepsIncrease.Common.SHARED_PREFERENCES_NAME
13
13
import com.programminghoch10.VolumeStepsIncrease.Common.STREAMS
14
- import com.programminghoch10.VolumeStepsIncrease.Common.STREAM_NAMES
15
14
import com.programminghoch10.VolumeStepsIncrease.Common.getModuleDefaultVolumeSteps
16
15
import com.programminghoch10.VolumeStepsIncrease.Common.getModuleMaxVolumeSteps
17
16
import com.programminghoch10.VolumeStepsIncrease.Common.getModuleMinVolumeSteps
@@ -38,22 +37,21 @@ class SettingsActivity : FragmentActivity() {
38
37
preferenceManager.sharedPreferencesName = SHARED_PREFERENCES_NAME
39
38
preferenceManager.sharedPreferencesMode = MODE_WORLD_READABLE
40
39
41
- for (stream in STREAM_NAMES ) {
42
- val streamInt = STREAMS [stream]!!
40
+ for (stream in STREAMS ) {
43
41
val preference = SeekBarPreference (requireContext())
44
- preference.key = getPreferenceKey(streamInt )
45
- preference.title = stream.replace(" STREAM_" , " " )
46
- preference.min = getModuleMinVolumeSteps(streamInt )
47
- preference.max = getModuleMaxVolumeSteps(streamInt )
48
- preference.setDefaultValue(getModuleDefaultVolumeSteps(streamInt ))
42
+ preference.key = getPreferenceKey(stream.value )
43
+ preference.title = stream.key. replace(" STREAM_" , " " )
44
+ preference.min = getModuleMinVolumeSteps(stream.value )
45
+ preference.max = getModuleMaxVolumeSteps(stream.value )
46
+ preference.setDefaultValue(getModuleDefaultVolumeSteps(stream.value ))
49
47
preference.showSeekBarValue = true
50
48
preference.updatesContinuously = true
51
49
preference.setOnPreferenceChangeListener { preference, newValue ->
52
- val factor = (newValue as Int ).toDouble() / getSystemMaxVolumeSteps(streamInt )
50
+ val factor = (newValue as Int ).toDouble() / getSystemMaxVolumeSteps(stream.value )
53
51
preference.summary = arrayOf(
54
52
" factor=${factor.round(1 )} x " ,
55
- // "systemMin=${getSystemMinVolumeSteps(streamInt )} ",
56
- " systemMax=${getSystemMaxVolumeSteps(streamInt )} " ,
53
+ // "systemMin=${getSystemMinVolumeSteps(stream.value )} ",
54
+ " systemMax=${getSystemMaxVolumeSteps(stream.value )} " ,
57
55
).joinToString(" " )
58
56
true
59
57
}
0 commit comments