2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-22 01:51:47 +00:00

Add "laptop" as a device type

For consistency with the other implementations, which distinguish the
two kinds of computers.
This commit is contained in:
Albert Vaca Cintora 2023-09-18 04:06:01 +02:00
parent 3baa9fa14e
commit 7c649be2ce
3 changed files with 14 additions and 5 deletions

View File

@ -0,0 +1,5 @@
<vector android:height="32dp" android:tint="?attr/colorControlNormal"
android:viewportHeight="24" android:viewportWidth="24"
android:width="32dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M21,2L3,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h7v2L8,20v2h8v-2h-2v-2h7c1.1,0 2,-0.9 2,-2L23,4c0,-1.1 -0.9,-2 -2,-2zM21,16L3,16L3,4h18v12z"/>
</vector>

View File

@ -102,13 +102,14 @@ class DeviceInfo(
}
enum class DeviceType {
PHONE, TABLET, COMPUTER, TV;
PHONE, TABLET, DESKTOP, LAPTOP, TV;
override fun toString() =
when (this) {
TABLET -> "tablet"
PHONE -> "phone"
TV -> "tv"
LAPTOP -> "laptop"
else -> "desktop"
}
@ -120,7 +121,8 @@ enum class DeviceType {
PHONE -> R.drawable.ic_device_phone_32dp
TABLET -> R.drawable.ic_device_tablet_32dp
TV -> R.drawable.ic_device_tv_32dp
else -> R.drawable.ic_device_laptop_32dp
LAPTOP -> R.drawable.ic_device_laptop_32dp
else -> R.drawable.ic_device_desktop_32dp
}
companion object {
@ -130,7 +132,8 @@ enum class DeviceType {
"phone" -> PHONE
"tablet" -> TABLET
"tv" -> TV
else -> COMPUTER
"laptop" -> LAPTOP
else -> DESKTOP
}
}
}

View File

@ -133,9 +133,10 @@ public class DeviceTest {
public void testDeviceType() {
assertEquals(DeviceType.PHONE, DeviceType.fromString(DeviceType.PHONE.toString()));
assertEquals(DeviceType.TABLET, DeviceType.fromString(DeviceType.TABLET.toString()));
assertEquals(DeviceType.COMPUTER, DeviceType.fromString(DeviceType.COMPUTER.toString()));
assertEquals(DeviceType.DESKTOP, DeviceType.fromString(DeviceType.DESKTOP.toString()));
assertEquals(DeviceType.LAPTOP, DeviceType.fromString(DeviceType.LAPTOP.toString()));
assertEquals(DeviceType.TV, DeviceType.fromString(DeviceType.TV.toString()));
assertEquals(DeviceType.COMPUTER, DeviceType.fromString("invalid"));
assertEquals(DeviceType.DESKTOP, DeviceType.fromString("invalid"));
}
// Basic paired device testing