diff --git a/app/src/main/java/de/qspool/clementineremote/ui/shell/OutputSheet.kt b/app/src/main/java/de/qspool/clementineremote/ui/shell/OutputSheet.kt
index c17ee1f5..bf4044d8 100644
--- a/app/src/main/java/de/qspool/clementineremote/ui/shell/OutputSheet.kt
+++ b/app/src/main/java/de/qspool/clementineremote/ui/shell/OutputSheet.kt
@@ -22,6 +22,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
@@ -99,7 +100,10 @@ internal fun OutputSheetContent(outputs: RemoteRepository.Outputs, onOutput: (St
val name = when {
output.id == RemoteRepository.LOCAL_OUTPUT ->
output.name.ifBlank { stringResource(R.string.fragment_title_connection) }
- output.isThisPhone -> stringResource(R.string.output_this_phone, output.name)
+ output.isThisPhone -> stringResource(
+ if (isTablet()) R.string.output_this_tablet else R.string.output_this_phone,
+ output.name,
+ )
else -> output.name
}
ListItem(
@@ -122,12 +126,17 @@ internal fun OutputSheetContent(outputs: RemoteRepository.Outputs, onOutput: (St
}
/**
- * What an output is, as an icon: Clementine's computer, this phone, or another device. Clementine
- * doesn't say what kind of device the others are, so they're shown as speakers.
+ * What an output is, as an icon: Clementine's computer, this phone or tablet, or another device.
+ * Clementine doesn't say what kind of device the others are, so they're shown as speakers.
*/
@DrawableRes
+@Composable
internal fun outputIcon(output: RemoteRepository.Output): Int = when {
output.id == RemoteRepository.LOCAL_OUTPUT -> R.drawable.ic_computer
- output.isThisPhone -> R.drawable.ic_smartphone
+ output.isThisPhone -> if (isTablet()) R.drawable.ic_tablet else R.drawable.ic_smartphone
else -> R.drawable.ic_speaker
}
+
+/** Whether this device is a tablet: at least 600dp wide whichever way it's held. */
+@Composable
+private fun isTablet(): Boolean = LocalConfiguration.current.smallestScreenWidthDp >= 600
diff --git a/app/src/main/res/drawable/ic_tablet.xml b/app/src/main/res/drawable/ic_tablet.xml
new file mode 100644
index 00000000..c6f28ba3
--- /dev/null
+++ b/app/src/main/res/drawable/ic_tablet.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 561a8bd3..7a459016 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -98,6 +98,7 @@
Pick another computer on your network
Play on
%1$s (this phone)
+ %1$s (this tablet)
Switching…
Playing on %1$s
Choose where to play
diff --git a/app/src/test/java/de/qspool/clementineremote/ui/shell/OutputSheetTest.kt b/app/src/test/java/de/qspool/clementineremote/ui/shell/OutputSheetTest.kt
index ab70245f..101d7b1d 100644
--- a/app/src/test/java/de/qspool/clementineremote/ui/shell/OutputSheetTest.kt
+++ b/app/src/test/java/de/qspool/clementineremote/ui/shell/OutputSheetTest.kt
@@ -21,6 +21,7 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
+import org.robolectric.annotation.Config
/** The output sheet lists where Clementine can play, and moves playback when one is picked. */
@RunWith(RobolectricTestRunner::class)
@@ -67,6 +68,18 @@ class OutputSheetTest {
compose.onNodeWithText("Clementine").assertExists()
}
+ @Test
+ @Config(qualifiers = "sw600dp")
+ fun aTabletIsCalledATablet() {
+ compose.setContent {
+ ClementineTheme(dynamicColor = false) {
+ OutputSheetContent(outputs(RemoteRepository.LOCAL_OUTPUT), onOutput = {})
+ }
+ }
+
+ compose.onNodeWithText("Pixel 9 (this tablet)").assertExists()
+ }
+
@Test
fun theButtonSaysWhereClementinePlays() {
var outputs by mutableStateOf(outputs(RemoteRepository.LOCAL_OUTPUT))