Skip to content

Commit

Permalink
build,refactor(ime,ui,util): eliminate warnings during build
Browse files Browse the repository at this point in the history
- Suppress unchecked casts
- Eliminate implicit casts
- Remove redundant parameters
  • Loading branch information
WhiredPlanck committed Jan 9, 2023
1 parent 3002abd commit ca0f87b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ object KeyboardSwitcher {
newOrReset()
}

@Suppress("UNCHECKED_CAST")
@JvmStatic
fun newOrReset() {
Timber.d("Refreshing keyboard padding ...")
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/java/com/osfans/trime/ui/setup/SetupPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ enum class SetupPage {
}
)

fun getButtonAction(context: Context) = when (this) {
Enable -> InputMethodUtils.showImeEnablerActivity(context)
Select -> InputMethodUtils.showImePicker(context)
fun getButtonAction(context: Context) {
when (this) {
Enable -> InputMethodUtils.showImeEnablerActivity(context)
Select -> InputMethodUtils.showImePicker()
}
}

fun isDone() = when (this) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/osfans/trime/util/CollectionUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ object CollectionUtils {
@JvmStatic
fun <K, V> getOrDefault(map: Map<K, V>, key: K, defaultValue: V): V = map[key] ?: defaultValue

@Suppress("UNCHECKED_CAST")
@JvmStatic
fun obtainValue(map: Map<String?, Any?>?, vararg: String?): Any? {
if (map.isNullOrEmpty() || vararg == null) return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object InputMethodUtils {
fun showImeEnablerActivity(context: Context) =
context.startActivity(Intent(Settings.ACTION_INPUT_METHOD_SETTINGS))

fun showImePicker(context: Context): Boolean {
fun showImePicker(): Boolean {
inputMethodManager.showInputMethodPicker()
return true
}
Expand Down

0 comments on commit ca0f87b

Please sign in to comment.