From cbef64ae55e5ce66547362611da545636d8a1d28 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 30 May 2020 21:04:37 -0400 Subject: [PATCH] Incorporate icon into TetherType defn --- .../be/mygod/vpnhotspot/net/TetherType.kt | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/TetherType.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/TetherType.kt index 3811fa8e..05bfabad 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/TetherType.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/TetherType.kt @@ -1,6 +1,7 @@ package be.mygod.vpnhotspot.net import android.content.res.Resources +import androidx.annotation.DrawableRes import androidx.annotation.RequiresApi import androidx.core.os.BuildCompat import be.mygod.vpnhotspot.App.Companion.app @@ -8,20 +9,18 @@ import be.mygod.vpnhotspot.R import be.mygod.vpnhotspot.util.Event0 import java.util.regex.Pattern -enum class TetherType { - NONE, WIFI_P2P, USB, WIFI, WIMAX, BLUETOOTH, NCM, ETHERNET; +enum class TetherType(@DrawableRes val icon: Int) { + NONE(R.drawable.ic_device_wifi_tethering), + WIFI_P2P(R.drawable.ic_action_settings_input_antenna), + USB(R.drawable.ic_device_usb), + WIFI(R.drawable.ic_device_network_wifi), + WIMAX(R.drawable.ic_action_contactless), + BLUETOOTH(R.drawable.ic_device_bluetooth), + // if you have an issue with these Ethernet icon namings, blame Google + NCM(R.drawable.ic_action_settings_ethernet), + ETHERNET(R.drawable.ic_content_inbox), + ; - val icon get() = when (this) { - USB -> R.drawable.ic_device_usb - WIFI_P2P -> R.drawable.ic_action_settings_input_antenna - WIFI -> R.drawable.ic_device_network_wifi - WIMAX -> R.drawable.ic_action_contactless - BLUETOOTH -> R.drawable.ic_device_bluetooth - // if you have an issue with these Ethernet icon namings, blame Google - NCM -> R.drawable.ic_action_settings_ethernet - ETHERNET -> R.drawable.ic_content_inbox - else -> R.drawable.ic_device_wifi_tethering - } val isWifi get() = when (this) { WIFI_P2P, WIFI, WIMAX -> true else -> false