Quellcode durchsuchen

adb mirror design update

Milan Jurkulak vor 3 Monaten
Ursprung
Commit
d6a87cc3da

+ 0 - 8
shared/src/commonMain/kotlin/org/mjdev/desktop/components/adb/AdbScreenMirror.kt

@@ -4,9 +4,6 @@ import androidx.compose.foundation.Image
 import androidx.compose.foundation.gestures.detectTapGestures
 import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.fillMaxHeight
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.material3.CircularProgressIndicator
-import androidx.compose.material3.Text
 import androidx.compose.runtime.*
 import androidx.compose.runtime.mutableStateOf
 import androidx.compose.ui.Alignment
@@ -40,7 +37,6 @@ fun AdbScreenMirror(
         ),
 ) = withDesktopContext {
     if (isAndroid()) return@withDesktopContext
-    // Hide the whole view unless a device is connected and actually streaming frames.
     val image = deviceState.imageBitmap
     if (image != null) {
         Box(
@@ -92,8 +88,6 @@ class DeviceState(
         if (job?.isActive == true) return
         job =
             scope.launch {
-                // Outer loop keeps (re)connecting: discover -> stream -> on any loss
-                // clean up (which hides the view) and retry, until the job is cancelled.
                 while (isActive) {
                     val dadb =
                         try {
@@ -103,7 +97,6 @@ class DeviceState(
                             null
                         }
                     if (dadb == null) {
-                        // no device connected — clear state so the view hides, then retry
                         dadbInstance = null
                         imageBitmap = null
                         isConnecting = false
@@ -129,7 +122,6 @@ class DeviceState(
                             delay(refreshInterval)
                         }
                     } catch (e: Exception) {
-                        // device disconnected / stream broke — fall through and reconnect
                         error = e.message
                     } finally {
                         runCatching { dadb.close() }

+ 11 - 1
shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktop/Desktop.kt

@@ -6,9 +6,11 @@ import androidx.compose.foundation.layout.fillMaxHeight
 import androidx.compose.foundation.layout.fillMaxSize
 import androidx.compose.foundation.layout.padding
 import androidx.compose.foundation.layout.wrapContentWidth
+import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.runtime.Composable
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.unit.DpOffset
 import androidx.compose.ui.unit.dp
@@ -101,7 +103,15 @@ fun Desktop(
                     Modifier
                         .align(Alignment.TopEnd)
                         .fillMaxHeight()
-                        .wrapContentWidth(),
+                        .wrapContentWidth()
+                        .clip(
+                            RoundedCornerShape(
+                                16.dp,
+                                16.dp,
+                                16.dp,
+                                16.dp
+                            )
+                        ),
             )
         }
     }