2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 21:55:10 +00:00

refactor: mark getIcon() as notnull, add @DrawableRes to toDrawableId()

This commit is contained in:
ShellWen Chen
2024-04-05 20:36:16 +08:00
committed by Albert Vaca Cintora
parent 4c0acbb71c
commit 5151ed3d96

View File

@@ -9,6 +9,7 @@ package org.kde.kdeconnect
import android.content.Context
import android.content.SharedPreferences
import android.util.Base64
import androidx.annotation.DrawableRes
import androidx.core.content.ContextCompat
import org.kde.kdeconnect.Helpers.DeviceHelper
import org.kde.kdeconnect.Helpers.SecurityHelpers.SslHelper
@@ -120,8 +121,9 @@ enum class DeviceType {
}
fun getIcon(context: Context) =
ContextCompat.getDrawable(context, toDrawableId())
ContextCompat.getDrawable(context, toDrawableId())!!
@DrawableRes
private fun toDrawableId() =
when (this) {
PHONE -> R.drawable.ic_device_phone_32dp