remove java.enumConstants where unneeded

This commit is contained in:
Jays2Kings 2021-04-26 01:25:53 -04:00
parent 4fa4953a7e
commit 20f8fac479
2 changed files with 4 additions and 6 deletions

View File

@ -522,9 +522,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
Tracked
).joinToString("") { it.value.toString() }
fun filterOf(char: Char): Filters? {
return Filters::class.java.enumConstants?.find { it.value == char }
}
fun filterOf(char: Char) = values().find { it.value == char }
}
}
}

View File

@ -94,9 +94,9 @@ class SettingsReaderController : SettingsController() {
intListPreference(activity) {
key = Keys.rotation
titleRes = R.string.rotation
val enumConstants = OrientationType::class.java.enumConstants
entriesRes = enumConstants?.map { it.stringRes }.orEmpty().toTypedArray()
entryRange = 1..(enumConstants?.size ?: 5)
val enumConstants = OrientationType.values()
entriesRes = enumConstants.map { it.stringRes }.toTypedArray()
entryRange = 1..enumConstants.size
defaultValue = 1
}
intListPreference(activity) {