Skip to content

Commit b94d20a

Browse files
inline redundant variable
1 parent af4c1c8 commit b94d20a

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

VolumeStepsIncrease/src/main/java/com/programminghoch10/VolumeStepsIncrease/Common.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ object Common {
1212

1313
val STREAMS = StockValues::class.java.declaredFields.filter { it.name.startsWith("STREAM_") }.associate { it.name to it.getInt(null) }
1414

15-
val STREAM_NAMES = STREAMS.keys
16-
1715
val systemPropertyToStream = mapOf(
1816
"ro.config.vc_call_vol_steps" to STREAM_VOICE_CALL,
1917
"ro.config.media_vol_steps" to STREAM_MUSIC,

VolumeStepsIncrease/src/main/java/com/programminghoch10/VolumeStepsIncrease/SettingsActivity.kt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import androidx.preference.SeekBarPreference
1111
import androidx.preference.children
1212
import com.programminghoch10.VolumeStepsIncrease.Common.SHARED_PREFERENCES_NAME
1313
import com.programminghoch10.VolumeStepsIncrease.Common.STREAMS
14-
import com.programminghoch10.VolumeStepsIncrease.Common.STREAM_NAMES
1514
import com.programminghoch10.VolumeStepsIncrease.Common.getModuleDefaultVolumeSteps
1615
import com.programminghoch10.VolumeStepsIncrease.Common.getModuleMaxVolumeSteps
1716
import com.programminghoch10.VolumeStepsIncrease.Common.getModuleMinVolumeSteps
@@ -38,22 +37,21 @@ class SettingsActivity : FragmentActivity() {
3837
preferenceManager.sharedPreferencesName = SHARED_PREFERENCES_NAME
3938
preferenceManager.sharedPreferencesMode = MODE_WORLD_READABLE
4039

41-
for (stream in STREAM_NAMES) {
42-
val streamInt = STREAMS[stream]!!
40+
for (stream in STREAMS) {
4341
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))
4947
preference.showSeekBarValue = true
5048
preference.updatesContinuously = true
5149
preference.setOnPreferenceChangeListener { preference, newValue ->
52-
val factor = (newValue as Int).toDouble() / getSystemMaxVolumeSteps(streamInt)
50+
val factor = (newValue as Int).toDouble() / getSystemMaxVolumeSteps(stream.value)
5351
preference.summary = arrayOf(
5452
"factor=${factor.round(1)}x ",
55-
//"systemMin=${getSystemMinVolumeSteps(streamInt)} ",
56-
"systemMax=${getSystemMaxVolumeSteps(streamInt)} ",
53+
//"systemMin=${getSystemMinVolumeSteps(stream.value)} ",
54+
"systemMax=${getSystemMaxVolumeSteps(stream.value)} ",
5755
).joinToString(" ")
5856
true
5957
}

0 commit comments

Comments
 (0)