Skip to content

Commit 0ef79c5

Browse files
committed
Move PC control close action
- Replace the PC control screen's left back arrow with a right-side close icon - Keep Android BackHandler wired to the same close behavior - Remove the left padding that compensated for the old back icon 🤖 Auto-generated
1 parent 751f858 commit 0ef79c5

2 files changed

Lines changed: 35 additions & 8 deletions

File tree

app/src/main/java/com/enaboapps/switchify/screens/pc/PcControlSurfaceSwitcher.kt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import androidx.compose.foundation.layout.height
99
import androidx.compose.foundation.layout.heightIn
1010
import androidx.compose.foundation.layout.padding
1111
import androidx.compose.foundation.layout.size
12+
import androidx.compose.foundation.layout.width
1213
import androidx.compose.foundation.shape.RoundedCornerShape
1314
import androidx.compose.material.icons.Icons
15+
import androidx.compose.material.icons.filled.Close
1416
import androidx.compose.material.icons.filled.Keyboard
1517
import androidx.compose.material.icons.filled.TouchApp
1618
import androidx.compose.material.icons.rounded.Computer
@@ -31,6 +33,7 @@ fun PcControlSurfaceSwitcher(
3133
selectedSurface: PcControlSurface,
3234
onSurfaceSelected: (PcControlSurface) -> Unit,
3335
enabled: Boolean = true,
36+
onClose: (() -> Unit)? = null,
3437
modifier: Modifier = Modifier
3538
) {
3639
Surface(
@@ -88,6 +91,35 @@ fun PcControlSurfaceSwitcher(
8891
}
8992
}
9093
}
94+
onClose?.let { close ->
95+
val contentColor = if (enabled) {
96+
MaterialTheme.colorScheme.onSurface
97+
} else {
98+
MaterialTheme.colorScheme.onSurfaceVariant
99+
}
100+
Box(
101+
modifier = Modifier
102+
.width(56.dp)
103+
.heightIn(min = 48.dp)
104+
.padding(4.dp)
105+
) {
106+
IconButton(
107+
onClick = close,
108+
enabled = enabled,
109+
modifier = Modifier
110+
.fillMaxWidth()
111+
.height(40.dp)
112+
.semantics { contentDescription = "Close PC controls" }
113+
) {
114+
Icon(
115+
imageVector = Icons.Default.Close,
116+
contentDescription = null,
117+
modifier = Modifier.size(22.dp),
118+
tint = contentColor
119+
)
120+
}
121+
}
122+
}
91123
}
92124
}
93125
}

app/src/main/java/com/enaboapps/switchify/screens/pc/PcMouseControlActivity.kt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,12 @@ private fun PcMouseControlScreen(
104104
selectedSurface = uiState.activeSurface,
105105
onSurfaceSelected = viewModel::selectControlSurface,
106106
enabled = !uiState.isBusy,
107-
modifier = Modifier
108-
.fillMaxWidth()
109-
.padding(start = 22.dp)
110-
)
111-
PcConnectionStatusDot(
112-
connectedDisplayName = uiState.connectedDisplayName
107+
onClose = onClose,
108+
modifier = Modifier.fillMaxWidth()
113109
)
114110
}
115111
},
116-
showBackButton = true,
117-
onBackPressed = onClose
112+
showBackButton = false
118113
)
119114
},
120115
bottomBar = {

0 commit comments

Comments
 (0)