Skip to content

Commit

Permalink
chore: init convert map with enum values
Browse files Browse the repository at this point in the history
  • Loading branch information
Bambooin committed Nov 26, 2023
1 parent 4df3368 commit 7e9b4ef
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.osfans.trime.ime.landscapeinput

import java.util.Locale
import kotlin.collections.HashMap

enum class LandscapeInputUIMode {
AUTO_SHOW,
Expand All @@ -10,12 +9,7 @@ enum class LandscapeInputUIMode {
;

companion object {
private val convertMap: HashMap<String, LandscapeInputUIMode> =
hashMapOf(
Pair("AUTO_SHOW", AUTO_SHOW),
Pair("ALWAYS_SHOW", ALWAYS_SHOW),
Pair("NEVER_SHOW", NEVER_SHOW),
)
private val convertMap: Map<String, LandscapeInputUIMode> = LandscapeInputUIMode.values().associateBy { it.name }

fun fromString(mode: String): LandscapeInputUIMode {
val type = convertMap[mode.uppercase(Locale.getDefault())]
Expand Down

0 comments on commit 7e9b4ef

Please sign in to comment.