summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorTom Pratt <tom.pratt@outlook.com>2026-05-18 21:35:13 +0200
committerTom Pratt <tompratt@squareup.com>2026-05-19 12:03:02 +0200
commit8d565e0331cf198dddc6d26d8308f8f582e80b13 (patch)
tree78e5833c1fb2b8f9fe960dc1d6c6aec0a29b2c9e /Source
parent4d1e74997749bca7744c1bbe78225e76f57a260c (diff)
Use the dual pane netplay screen layout only if the width is sufficient
To avoid using dual pane layout on very small devices, ensure that the current width available for display is at least medium (600dp). It also has to be landscape, the dual pane mode looks weird on a tablet in portrait mode since there's not that much content.
Diffstat (limited to 'Source')
-rw-r--r--Source/Android/app/build.gradle.kts1
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/netplay/ui/NetplayScreen.kt10
-rw-r--r--Source/Android/gradle/libs.versions.toml1
3 files changed, 11 insertions, 1 deletions
diff --git a/Source/Android/app/build.gradle.kts b/Source/Android/app/build.gradle.kts
index 27f76b22a2..11433e8160 100644
--- a/Source/Android/app/build.gradle.kts
+++ b/Source/Android/app/build.gradle.kts
@@ -166,6 +166,7 @@ dependencies {
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.compose.material.icons)
implementation(libs.androidx.compose.material3)
+ implementation(libs.androidx.compose.material3.adaptive)
implementation(libs.androidx.compose.runtime.livedata)
implementation(libs.androidx.compose.ui)
debugImplementation(libs.androidx.compose.ui.tooling)
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/netplay/ui/NetplayScreen.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/netplay/ui/NetplayScreen.kt
index 8150f0b8e7..34958176f7 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/netplay/ui/NetplayScreen.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/netplay/ui/NetplayScreen.kt
@@ -61,6 +61,7 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.SheetValue
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
+import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@@ -87,6 +88,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
+import androidx.window.core.layout.WindowSizeClass
import coil.compose.AsyncImage
import coil.request.ImageRequest
import kotlinx.coroutines.flow.Flow
@@ -171,7 +173,13 @@ fun NetplayScreen(
mutableStateOf(joinAddresses.keys.firstOrNull() ?: JoinInfoType.EXTERNAL)
}
- if (LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE) {
+ val isLandscape =
+ LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE
+ val isWidthAtLeastMedium = currentWindowAdaptiveInfo().windowSizeClass
+ .isWidthAtLeastBreakpoint(WindowSizeClass.WIDTH_DP_MEDIUM_LOWER_BOUND)
+ val useWideLayout = isLandscape && isWidthAtLeastMedium
+
+ if (useWideLayout) {
LandscapeContent(
isHosting = isHosting,
messages = messages,
diff --git a/Source/Android/gradle/libs.versions.toml b/Source/Android/gradle/libs.versions.toml
index 0f91ab31b7..f9c4992ccd 100644
--- a/Source/Android/gradle/libs.versions.toml
+++ b/Source/Android/gradle/libs.versions.toml
@@ -35,6 +35,7 @@ androidx-cardview = { group = "androidx.cardview", name = "cardview", version.re
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" }
androidx-compose-material-icons = { group = "androidx.compose.material", name = "material-icons-extended" }
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
+androidx-compose-material3-adaptive = { group = "androidx.compose.material3.adaptive", name = "adaptive" }
androidx-compose-runtime-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata" }
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }