Skip to content

Commit 6ce3631

Browse files
committed
build,refactor(ime,ui,util): eliminate warnings during build
- Suppress unchecked casts - Eliminate implicit casts - Remove redundant parameters
1 parent 4b6f8ac commit 6ce3631

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardSwitcher.kt

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ object KeyboardSwitcher {
2727
newOrReset()
2828
}
2929

30+
@Suppress("UNCHECKED_CAST")
3031
@JvmStatic
3132
fun newOrReset() {
3233
Timber.d("Refreshing keyboard padding ...")

app/src/main/java/com/osfans/trime/ui/setup/SetupPage.kt

+5-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ enum class SetupPage {
2828
}
2929
)
3030

31-
fun getButtonAction(context: Context) = when (this) {
32-
Enable -> InputMethodUtils.showImeEnablerActivity(context)
33-
Select -> InputMethodUtils.showImePicker(context)
31+
fun getButtonAction(context: Context) {
32+
when (this) {
33+
Enable -> InputMethodUtils.showImeEnablerActivity(context)
34+
Select -> InputMethodUtils.showImePicker()
35+
}
3436
}
3537

3638
fun isDone() = when (this) {

app/src/main/java/com/osfans/trime/util/CollectionUtils.kt

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ object CollectionUtils {
44
@JvmStatic
55
fun <K, V> getOrDefault(map: Map<K, V>, key: K, defaultValue: V): V = map[key] ?: defaultValue
66

7+
@Suppress("UNCHECKED_CAST")
78
@JvmStatic
89
fun obtainValue(map: Map<String?, Any?>?, vararg: String?): Any? {
910
if (map.isNullOrEmpty() || vararg == null) return null

app/src/main/java/com/osfans/trime/util/InputMethodUtils.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ object InputMethodUtils {
3333
fun showImeEnablerActivity(context: Context) =
3434
context.startActivity(Intent(Settings.ACTION_INPUT_METHOD_SETTINGS))
3535

36-
fun showImePicker(context: Context): Boolean {
36+
fun showImePicker(): Boolean {
3737
inputMethodManager.showInputMethodPicker()
3838
return true
3939
}

0 commit comments

Comments
 (0)