Skip to content

Commit 471d0c5

Browse files
ErikChevalierFlintWaveclaude
authored
fix(settings): make whole toggle row tappable; clarify OEM keep-alive button (#22)
Two phone-only UX fixes that the on-device test surfaced. 1. The Material3 Switch widget is small on a real phone, and the surrounding ToggleRow had no click handler of its own. Tapping the label area did nothing, so the suggestions, network, and update-check toggles all felt "stuck in their default position" even though the wiring underneath was fine. Use the canonical Compose pattern: Modifier.toggleable on the Row (role = Role.Switch), with the inner Switch as a visual indicator (onCheckedChange = null) so there are no competing click handlers. The whole row is now a single, accessible click target. 2. Rename the "Keep it alive on your phone" button to "Open OEM keep-alive guide (web)". The old text implied the app could do it itself; in reality the button opens the dontkillmyapp.com page in a browser. The new label says what it actually does. Co-authored-by: FlintWave <flintwave@tuta.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 3b0b34d commit 471d0c5

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

app/src/main/java/org/searchmob/ui/settings/SettingsScreen.kt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
1111
import androidx.compose.foundation.layout.padding
1212
import androidx.compose.foundation.rememberScrollState
1313
import androidx.compose.foundation.selection.selectable
14+
import androidx.compose.foundation.selection.toggleable
1415
import androidx.compose.foundation.verticalScroll
1516
import androidx.compose.material.icons.Icons
1617
import androidx.compose.material.icons.automirrored.filled.ArrowBack
@@ -43,6 +44,7 @@ import androidx.compose.ui.Modifier
4344
import androidx.compose.ui.platform.LocalClipboardManager
4445
import androidx.compose.ui.platform.LocalContext
4546
import androidx.compose.ui.platform.testTag
47+
import androidx.compose.ui.semantics.Role
4648
import androidx.compose.ui.text.AnnotatedString
4749
import androidx.compose.ui.text.input.PasswordVisualTransformation
4850
import androidx.compose.ui.unit.dp
@@ -324,8 +326,20 @@ private fun ToggleRow(
324326
tag: String,
325327
onCheckedChange: (Boolean) -> Unit,
326328
) {
329+
// The whole row is the click target: a phone-finger tap on the label or supporting text flips the
330+
// switch, not just a hit on the small Material3 Switch widget. The inner Switch is purely visual
331+
// (onCheckedChange = null) so we do not register two competing click handlers on the same row.
327332
Row(
328-
modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp),
333+
modifier =
334+
Modifier
335+
.fillMaxWidth()
336+
.toggleable(
337+
value = checked,
338+
role = Role.Switch,
339+
onValueChange = onCheckedChange,
340+
)
341+
.padding(vertical = 4.dp)
342+
.testTag(tag),
329343
verticalAlignment = Alignment.CenterVertically,
330344
horizontalArrangement = Arrangement.SpaceBetween,
331345
) {
@@ -339,7 +353,7 @@ private fun ToggleRow(
339353
)
340354
}
341355
}
342-
Switch(checked = checked, onCheckedChange = onCheckedChange, modifier = Modifier.testTag(tag))
356+
Switch(checked = checked, onCheckedChange = null)
343357
}
344358
}
345359

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<string name="battery_allow">Allow always-on</string>
2626

2727
<!-- OEM guidance -->
28-
<string name="oem_guidance_button">Keep it alive on your phone</string>
28+
<string name="oem_guidance_button">Open OEM keep-alive guide (web)</string>
2929
<string name="oem_guidance_warning">Heads up: some manufacturers reset these settings after a firmware/OS update, so you may need to re-apply them.</string>
3030

3131
<!-- Common -->

0 commit comments

Comments
 (0)