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 Tracked
).joinToString("") { it.value.toString() } ).joinToString("") { it.value.toString() }
fun filterOf(char: Char): Filters? { fun filterOf(char: Char) = values().find { it.value == char }
return Filters::class.java.enumConstants?.find { it.value == char }
}
} }
} }
} }

View File

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