Skip to content

Commit ba27052

Browse files
authored
Merge pull request #2343 from switchifyapp/fix/reduce-control-pc-tap-flicker-2342
Reduce Control PC tap flicker
2 parents 2c8a5ae + e7f813d commit ba27052

2 files changed

Lines changed: 1 addition & 18 deletions

File tree

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

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@ data class PcMouseControlSpec(
3030
fun PcMouseCommandGrid(
3131
connected: Boolean,
3232
movementStep: Int,
33-
busyCommand: PcMouseCommand?,
3433
onCommandSelected: (PcMouseCommand) -> Unit,
3534
modifier: Modifier = Modifier
3635
) {
3736
PcMouseCommandSections(
3837
connected = connected,
3938
movementStep = movementStep,
40-
busyCommand = busyCommand,
4139
onCommandSelected = onCommandSelected,
4240
modifier = modifier
4341
)
@@ -92,7 +90,6 @@ fun PcMovementSizeSection(
9290
fun PcMouseCommandSections(
9391
connected: Boolean,
9492
movementStep: Int,
95-
busyCommand: PcMouseCommand?,
9693
onCommandSelected: (PcMouseCommand) -> Unit,
9794
modifier: Modifier = Modifier
9895
) {
@@ -103,21 +100,18 @@ fun PcMouseCommandSections(
103100
PcMovementCommandSection(
104101
connected = connected,
105102
movementStep = movementStep,
106-
busyCommand = busyCommand,
107103
onCommandSelected = onCommandSelected
108104
)
109105
PcButtonCommandSection(
110106
titleResId = R.string.pc_mouse_section_clicks,
111107
specs = pcClickControlSpecs(),
112108
connected = connected,
113-
busyCommand = busyCommand,
114109
onCommandSelected = onCommandSelected
115110
)
116111
PcButtonCommandSection(
117112
titleResId = R.string.pc_mouse_section_scroll,
118113
specs = pcScrollControlSpecs(),
119114
connected = connected,
120-
busyCommand = busyCommand,
121115
onCommandSelected = onCommandSelected
122116
)
123117
}
@@ -127,7 +121,6 @@ fun PcMouseCommandSections(
127121
private fun PcMovementCommandSection(
128122
connected: Boolean,
129123
movementStep: Int,
130-
busyCommand: PcMouseCommand?,
131124
onCommandSelected: (PcMouseCommand) -> Unit
132125
) {
133126
val controls = pcMovementControlSpecs(movementStep)
@@ -136,7 +129,6 @@ private fun PcMovementCommandSection(
136129
PcCommandButtonRow(
137130
specs = controls.take(3),
138131
connected = connected,
139-
busyCommand = busyCommand,
140132
onCommandSelected = onCommandSelected,
141133
minHeightDp = 76
142134
)
@@ -147,7 +139,6 @@ private fun PcMovementCommandSection(
147139
PcCommandButton(
148140
spec = controls[3],
149141
connected = connected,
150-
busyCommand = busyCommand,
151142
onCommandSelected = onCommandSelected,
152143
minHeightDp = 76,
153144
modifier = Modifier.weight(1f)
@@ -156,7 +147,6 @@ private fun PcMovementCommandSection(
156147
PcCommandButton(
157148
spec = controls[4],
158149
connected = connected,
159-
busyCommand = busyCommand,
160150
onCommandSelected = onCommandSelected,
161151
minHeightDp = 76,
162152
modifier = Modifier.weight(1f)
@@ -165,7 +155,6 @@ private fun PcMovementCommandSection(
165155
PcCommandButtonRow(
166156
specs = controls.drop(5),
167157
connected = connected,
168-
busyCommand = busyCommand,
169158
onCommandSelected = onCommandSelected,
170159
minHeightDp = 76
171160
)
@@ -177,15 +166,13 @@ private fun PcButtonCommandSection(
177166
@StringRes titleResId: Int,
178167
specs: List<PcMouseControlSpec>,
179168
connected: Boolean,
180-
busyCommand: PcMouseCommand?,
181169
onCommandSelected: (PcMouseCommand) -> Unit
182170
) {
183171
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
184172
PcCommandSectionTitle(titleResId)
185173
PcCommandButtonRow(
186174
specs = specs,
187175
connected = connected,
188-
busyCommand = busyCommand,
189176
onCommandSelected = onCommandSelected,
190177
minHeightDp = 72
191178
)
@@ -205,7 +192,6 @@ private fun PcCommandSectionTitle(@StringRes titleResId: Int) {
205192
private fun PcCommandButtonRow(
206193
specs: List<PcMouseControlSpec>,
207194
connected: Boolean,
208-
busyCommand: PcMouseCommand?,
209195
onCommandSelected: (PcMouseCommand) -> Unit,
210196
minHeightDp: Int
211197
) {
@@ -217,7 +203,6 @@ private fun PcCommandButtonRow(
217203
PcCommandButton(
218204
spec = spec,
219205
connected = connected,
220-
busyCommand = busyCommand,
221206
onCommandSelected = onCommandSelected,
222207
minHeightDp = minHeightDp,
223208
modifier = Modifier.weight(1f)
@@ -230,14 +215,13 @@ private fun PcCommandButtonRow(
230215
private fun PcCommandButton(
231216
spec: PcMouseControlSpec,
232217
connected: Boolean,
233-
busyCommand: PcMouseCommand?,
234218
onCommandSelected: (PcMouseCommand) -> Unit,
235219
minHeightDp: Int,
236220
modifier: Modifier = Modifier
237221
) {
238222
Button(
239223
onClick = { onCommandSelected(spec.command) },
240-
enabled = connected && busyCommand == null,
224+
enabled = connected,
241225
modifier = modifier
242226
.fillMaxWidth()
243227
.heightIn(min = minHeightDp.dp)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ private fun PcMouseControlScreen(
115115
PcMouseCommandSections(
116116
connected = uiState.connectedDisplayName != null,
117117
movementStep = uiState.movementStep,
118-
busyCommand = uiState.busyCommand,
119118
onCommandSelected = viewModel::send
120119
)
121120
}

0 commit comments

Comments
 (0)