From 6cd799130e8c15ed0222f1da51e3d1817045e306 Mon Sep 17 00:00:00 2001 From: darken Date: Sun, 23 Jan 2022 20:16:29 +0100 Subject: [PATCH] Clean up strings --- .../cards/pods/DualApplePodsCardVH.kt | 4 +-- .../capod/pods/core/apple/DualApplePods.kt | 35 +++++++++---------- app/src/main/res/values/strings.xml | 17 --------- 3 files changed, 18 insertions(+), 38 deletions(-) diff --git a/app/src/main/java/eu/darken/capod/main/ui/overview/cards/pods/DualApplePodsCardVH.kt b/app/src/main/java/eu/darken/capod/main/ui/overview/cards/pods/DualApplePodsCardVH.kt index 47682b37..76c25759 100644 --- a/app/src/main/java/eu/darken/capod/main/ui/overview/cards/pods/DualApplePodsCardVH.kt +++ b/app/src/main/java/eu/darken/capod/main/ui/overview/cards/pods/DualApplePodsCardVH.kt @@ -25,8 +25,8 @@ class DualApplePodsCardVH(parent: ViewGroup) : val device = item.device name.apply { val sb = StringBuilder(device.getLabel(context)) - if (device.deviceColor != DeviceColor.UNKNOWN) { - sb.append(" (${device.getDeviceColorLabel(context)})") + if (!listOf(DeviceColor.WHITE, DeviceColor.UNKNOWN).contains(device.deviceColor)) { + sb.append(" (${device.deviceColor.name})") } text = sb if (item.isMainPod) setTypeface(typeface, Typeface.BOLD) diff --git a/app/src/main/java/eu/darken/capod/pods/core/apple/DualApplePods.kt b/app/src/main/java/eu/darken/capod/pods/core/apple/DualApplePods.kt index 7b718a9b..4a2d4de1 100644 --- a/app/src/main/java/eu/darken/capod/pods/core/apple/DualApplePods.kt +++ b/app/src/main/java/eu/darken/capod/pods/core/apple/DualApplePods.kt @@ -118,27 +118,24 @@ interface DualApplePods : ApplePods, HasDualPods, HasEarDetection, HasCase { val deviceColor: DeviceColor get() = DeviceColor.values().firstOrNull { it.raw == rawDeviceColor } ?: DeviceColor.UNKNOWN + enum class DeviceColor(val raw: UByte?) { - fun getDeviceColorLabel(context: Context): String = context.getString(deviceColor.labelRes) + WHITE(0x00), + BLACK(0x01), + RED(0x02), + BLUE(0x03), + PINK(0x04), + GRAY(0x05), + SILVER(0x06), + GOLD(0x07), + ROSE_GOLD(0x08), + SPACE_GRAY(0x09), + DARK_BLUE(0x0a), + LIGHT_BLUE(0x0b), + YELLOW(0x0c), + UNKNOWN(null); - enum class DeviceColor(val raw: UByte?, @StringRes val labelRes: Int) { - - WHITE(0x00, R.string.pods_device_color_white_label), - BLACK(0x01, R.string.pods_device_color_black_label), - RED(0x02, R.string.pods_device_color_red_label), - BLUE(0x03, R.string.pods_device_color_blue_label), - PINK(0x04, R.string.pods_device_color_pink_label), - GRAY(0x05, R.string.pods_device_color_gray_label), - SILVER(0x06, R.string.pods_device_color_silver_label), - GOLD(0x07, R.string.pods_device_color_gold_label), - ROSE_GOLD(0x08, R.string.pods_device_color_rose_gold_label), - SPACE_GRAY(0x09, R.string.pods_device_color_space_gray_label), - DARK_BLUE(0x0a, R.string.pods_device_color_dark_blue_label), - LIGHT_BLUE(0x0b, R.string.pods_device_color_light_blue_label), - YELLOW(0x0c, R.string.pods_device_color_yellow_label), - UNKNOWN(null, R.string.general_value_unknown_label); - - constructor(raw: Int, @StringRes labelRes: Int) : this(raw.toUByte(), labelRes) + constructor(raw: Int) : this(raw.toUByte()) } val connectionState: ConnectionState diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4fb2157d..743afb83 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -35,27 +35,11 @@ Disable battery optimizations Battery optimizations prevent this app from reliably receiving Bluetooth data while the app is in the background. - Headphones: %1$s - Headphones Left pod Right pod Case Open Closed - Reception %s - White - Yellow - Light blue - Dark blue - Space gray - Rose gold - Gold - Silver - Gray - Pink - Blue - Red - Black Not connected to a device Connected to a device, but idle In music mode @@ -85,7 +69,6 @@ Acknowledgements Changelog - Documentation Email developer Install ID