diff --git a/CHANGELOG b/CHANGELOG index 82d04f75..cb893c64 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -17,6 +17,7 @@ Watch app: * Ambient mode: the watch no longer blurs when idle * Fix flicker on waking the watch * Tapping the idle watch to wake it counts as a tap on the pad +* Remove a number of unfinished prototype features ## 0.6.3 - 2026-09-01 * Update custom firmware base version from 2.2.6 to 2.2.9 diff --git a/wear/README.md b/wear/README.md index c8c594a8..bce0c2c7 100644 --- a/wear/README.md +++ b/wear/README.md @@ -14,12 +14,10 @@ the phone it only tells you to install it. | tap | select | | double-tap, or a two-finger tap | **back**, everywhere: closes menus, leaves a settings column, leaves a folder or the launcher grid, returns to the sidebar (and from the sidebar turns the display off, as the ring does) | | press and hold | the app's context menu (a long press, held until you lift your finger) | -| swipe ↑ ↓ ← → | **spatial navigation, with no mode to enter first**: the launcher highlights one app and the swipe moves it by a row or a column; the settings panel moves between its columns and down its lists; the sidebar moves up and down; Music skips to the previous / next track. Right goes *into* things (sidebar → window, section → items) and left comes back *out* (first column → sidebar). Anywhere without a spatial meaning, up/down scroll, right selects and left goes back. One step per swipe (long swipes used to repeat, which overshot lists whenever the display lagged); use repeated flicks, the crown, or a two-finger page swipe to cover distance. "Natural swipe" flips the vertical sense; left/right can be remapped in settings. | +| swipe ↑ ↓ ← → | **spatial navigation, with no mode to enter first**: the launcher highlights one app and the swipe moves it by a row or a column; the settings panel moves between its columns and down its lists; the sidebar moves up and down; Music skips to the previous / next track. Right goes *into* things (sidebar → window, section → items) and left comes back *out* (first column → sidebar). Anywhere without a spatial meaning, up/down scroll, right selects and left goes back. One step per swipe (long swipes used to repeat, which overshot lists whenever the display lagged); use repeated flicks, the crown, or a two-finger page swipe to cover distance. | | rotate the crown | previous / next (one step per detent-ish, sensitivity adjustable) — clockwise is previous by default; reverse it in the on-glasses Settings > Watch section | | two-finger swipe up / down | scroll a page (3 steps) | -| **twist the wrist twice** (two brisk flicks, either direction) | back — from the gyroscope; on by default, sensitivity adjustable | -| **tip taps** — tap your index finger against your thumb | select; two quick taps = back. From the accelerometer; **off by default** (experimental): on a wrist, ordinary hand movement produced phantom selects in testing. Turn on in Watch settings; needs ~¼ s of stillness before a tap counts, and both motion gestures are ignored while the watch is off the wrist or buzzing. | -| **Tap zones** mode | tap the top / bottom third to scroll, the middle to select — for when swiping is awkward | +| **tip taps** — tap your index finger against your thumb | select; two quick taps = back. From the accelerometer; **off by default** (experimental): on a wrist, ordinary hand movement produced phantom selects in testing. Turn on in Watch settings; needs ~¼ s of stillness before a tap counts, and taps are ignored while the watch is off the wrist or buzzing. | The R1 ring's scheme is untouched: the ring only has up/down, tap, double-tap and hold, so on the glasses it still works in the stock two-step way (pick a @@ -46,8 +44,7 @@ down beginning in the button tray to hide them. full launcher, including installed EvenHub apps. - **Status** — connection and battery, display on/off, lock/unlock, connect / disconnect, and whether Faceclaw is running on the phone; watch settings - (haptics, keep screen on, swipe direction, tap zones, horizontal swipe - actions, tip taps and their sensitivity, crown sensitivity). + (haptics, keep screen on, tip taps and their sensitivity, crown sensitivity). The pad keeps the watch display awake while it is showing (Watch settings > "Keep screen on", default on). Wear OS otherwise dozes within seconds of the diff --git a/wear/app/src/main/kotlin/com/faceclaw/wear/OnBodyMonitor.kt b/wear/app/src/main/kotlin/com/faceclaw/wear/OnBodyMonitor.kt index 609d888b..c77cd41a 100644 --- a/wear/app/src/main/kotlin/com/faceclaw/wear/OnBodyMonitor.kt +++ b/wear/app/src/main/kotlin/com/faceclaw/wear/OnBodyMonitor.kt @@ -11,7 +11,7 @@ import android.util.Log /** * Whether the watch is on a wrist, from the low-latency off-body sensor. - * The motion-sensor gestures (tip taps, wrist twists) only make sense on a + * The motion-sensor gestures (tip taps) only make sense on a * wrist: on a desk, a buzzing phone next to the watch reads as a fingertip * tap. Watches without the sensor are assumed worn. */ diff --git a/wear/app/src/main/kotlin/com/faceclaw/wear/WatchPrefs.kt b/wear/app/src/main/kotlin/com/faceclaw/wear/WatchPrefs.kt index 2cb19e25..b53483c1 100644 --- a/wear/app/src/main/kotlin/com/faceclaw/wear/WatchPrefs.kt +++ b/wear/app/src/main/kotlin/com/faceclaw/wear/WatchPrefs.kt @@ -13,20 +13,6 @@ enum class CrownSensitivity(val label: String, val pixelsPerStep: Float) { fun next(): CrownSensitivity = entries[(ordinal + 1) % entries.size] } -/** What a horizontal swipe on the pad does. */ -enum class SwipeAction(val label: String) { - /** Sent as directional input; the glasses UI decides (see Gesture.SWIPE_LEFT). */ - NAVIGATE("Navigate"), - SIDEBAR("Sidebar"), - DOUBLE_CLICK("Double-click"), - CLICK("Click"), - LONG_PRESS("Long press"), - WAKEWORD("“Hey Even”"), - NONE("Nothing"); - - fun next(): SwipeAction = entries[(ordinal + 1) % entries.size] -} - /** Watch-local preferences (nothing here is synced to the phone). */ data class Prefs( /** Buzz on every gesture sent. */ @@ -37,13 +23,7 @@ data class Prefs( * exactly when a remote wants to stay ready. */ val keepScreenOn: Boolean = true, - /** Swipe direction follows the content (touch-scroll style) instead of the ring. */ - val naturalScroll: Boolean = false, - /** Tap the top/bottom of the pad to scroll instead of swiping. */ - val tapZones: Boolean = false, val crownSensitivity: CrownSensitivity = CrownSensitivity.NORMAL, - val swipeLeft: SwipeAction = SwipeAction.NAVIGATE, - val swipeRight: SwipeAction = SwipeAction.NAVIGATE, /** * Fingertip (pinch) taps from the motion sensors; see FingerTapDetector. * Off by default: on a wrist, ordinary hand movement produced phantom @@ -51,9 +31,6 @@ data class Prefs( */ val fingerTaps: Boolean = false, val tapSensitivity: TapSensitivity = TapSensitivity.NORMAL, - /** Two quick wrist twists = back (double-click); see WristTwistDetector. */ - val wristTwist: Boolean = true, - val twistSensitivity: TwistSensitivity = TwistSensitivity.NORMAL, ) class WatchPrefs(context: Context) { @@ -64,25 +41,13 @@ class WatchPrefs(context: Context) { private fun load(): Prefs = Prefs( haptics = store.getBoolean(KEY_HAPTICS, true), keepScreenOn = store.getBoolean(KEY_KEEP_SCREEN_ON, true), - naturalScroll = store.getBoolean(KEY_NATURAL_SCROLL, false), - tapZones = store.getBoolean(KEY_TAP_ZONES, false), crownSensitivity = store.getString(KEY_CROWN, null) ?.let { stored -> CrownSensitivity.entries.firstOrNull { it.name == stored } } ?: CrownSensitivity.NORMAL, - swipeLeft = store.getString(KEY_SWIPE_LEFT, null) - ?.let { stored -> SwipeAction.entries.firstOrNull { it.name == stored } } - ?: SwipeAction.NAVIGATE, - swipeRight = store.getString(KEY_SWIPE_RIGHT, null) - ?.let { stored -> SwipeAction.entries.firstOrNull { it.name == stored } } - ?: SwipeAction.NAVIGATE, fingerTaps = store.getBoolean(KEY_FINGER_TAPS, false), tapSensitivity = store.getString(KEY_TAP_SENSITIVITY, null) ?.let { stored -> TapSensitivity.entries.firstOrNull { it.name == stored } } ?: TapSensitivity.NORMAL, - wristTwist = store.getBoolean(KEY_WRIST_TWIST, true), - twistSensitivity = store.getString(KEY_TWIST_SENSITIVITY, null) - ?.let { stored -> TwistSensitivity.entries.firstOrNull { it.name == stored } } - ?: TwistSensitivity.NORMAL, ) fun update(transform: (Prefs) -> Prefs) { @@ -91,29 +56,17 @@ class WatchPrefs(context: Context) { store.edit() .putBoolean(KEY_HAPTICS, next.haptics) .putBoolean(KEY_KEEP_SCREEN_ON, next.keepScreenOn) - .putBoolean(KEY_NATURAL_SCROLL, next.naturalScroll) - .putBoolean(KEY_TAP_ZONES, next.tapZones) .putString(KEY_CROWN, next.crownSensitivity.name) - .putString(KEY_SWIPE_LEFT, next.swipeLeft.name) - .putString(KEY_SWIPE_RIGHT, next.swipeRight.name) .putBoolean(KEY_FINGER_TAPS, next.fingerTaps) .putString(KEY_TAP_SENSITIVITY, next.tapSensitivity.name) - .putBoolean(KEY_WRIST_TWIST, next.wristTwist) - .putString(KEY_TWIST_SENSITIVITY, next.twistSensitivity.name) .apply() } private companion object { const val KEY_HAPTICS = "haptics" const val KEY_KEEP_SCREEN_ON = "keepScreenOn" - const val KEY_NATURAL_SCROLL = "naturalScroll" - const val KEY_TAP_ZONES = "tapZones" const val KEY_CROWN = "crownSensitivity" - const val KEY_SWIPE_LEFT = "swipeLeft" - const val KEY_SWIPE_RIGHT = "swipeRight" const val KEY_FINGER_TAPS = "fingerTaps" const val KEY_TAP_SENSITIVITY = "tapSensitivity" - const val KEY_WRIST_TWIST = "wristTwist" - const val KEY_TWIST_SENSITIVITY = "twistSensitivity" } } diff --git a/wear/app/src/main/kotlin/com/faceclaw/wear/WristTwistDetector.kt b/wear/app/src/main/kotlin/com/faceclaw/wear/WristTwistDetector.kt deleted file mode 100644 index 82d134df..00000000 --- a/wear/app/src/main/kotlin/com/faceclaw/wear/WristTwistDetector.kt +++ /dev/null @@ -1,137 +0,0 @@ -package com.faceclaw.wear - -import android.content.Context -import android.hardware.Sensor -import android.hardware.SensorEvent -import android.hardware.SensorEventListener -import android.hardware.SensorManager -import android.os.Handler -import android.os.Looper -import android.os.SystemClock -import android.util.Log -import kotlin.math.abs - -/** How fast the wrist has to turn before a twist counts. */ -enum class TwistSensitivity(val label: String, val threshold: Float) { - /** Only a brisk flick; rad/s about the forearm. */ - LOW("Low", 5.0f), - NORMAL("Normal", 3.6f), - HIGH("High", 2.6f); - - fun next(): TwistSensitivity = entries[(ordinal + 1) % entries.size] -} - -/** - * "Twist the wrist twice" = back. The gyroscope's x axis runs along the - * forearm on a watch, so a wrist twist (pronation / supination) is a burst of - * angular velocity about x. Two brisk twists in the same direction, each - * short and separated by 120–900 ms, fire the gesture; the wrist coming back - * between them spins the other way and is ignored. The direction is not - * fixed (away or toward), so it works on either wrist, and the twists must be - * quick: a slow arm rotation never crosses the rate threshold. - * - * Same status as FingerTapDetector: a heuristic with a toggle, not a - * classifier. - */ -class WristTwistDetector( - context: Context, - private val sensitivity: () -> TwistSensitivity, - /** elapsedRealtime before which samples are ignored (the watch's own haptics). */ - private val quietUntil: () -> Long, - /** False while the watch is off the wrist; twists then never fire. */ - private val onBody: () -> Boolean, - private val onDoubleTwist: () -> Unit, -) : SensorEventListener { - private val sensorManager: SensorManager? = context.getSystemService(SensorManager::class.java) - private val sensor: Sensor? = sensorManager?.getDefaultSensor(Sensor.TYPE_GYROSCOPE) - private val handler = Handler(Looper.getMainLooper()) - - private var inBurst = false - /** Slow average of |rate| outside bursts: how much the arm is rotating anyway. */ - private var activity = 0f - private var lastMotionNs = 0L - private var burstStartNs = 0L - private var burstSign = 0 - private var firstTwistNs = 0L - private var firstTwistSign = 0 - private var running = false - - val available: Boolean get() = sensor != null - - fun start(): Boolean { - val manager = sensorManager ?: return false - val target = sensor ?: return false - if (running) return true - running = manager.registerListener(this, target, SAMPLING_PERIOD_US, handler) - Log.i(TAG, "wrist-twist detector ${if (running) "started" else "failed to start"}") - return running - } - - fun stop() { - if (!running) return - running = false - sensorManager?.unregisterListener(this) - inBurst = false - firstTwistNs = 0L - } - - override fun onSensorChanged(event: SensorEvent) { - val rate = event.values[0] - val now = event.timestamp - if (SystemClock.elapsedRealtime() < quietUntil() || !onBody()) { - inBurst = false - firstTwistNs = 0L - return - } - val threshold = sensitivity().threshold - - if (!inBurst) { - val magnitude = abs(rate) - // A twist pair only starts from a still-ish wrist: general arm - // rotation (reaching, gesturing) produced same-sign burst pairs - // that read as the gesture. - val still = activity < threshold * ACTIVITY_FRACTION && now - lastMotionNs > STILLNESS_BEFORE_TWIST_NS - if (magnitude > threshold && (still || firstTwistNs != 0L)) { - inBurst = true - burstStartNs = now - burstSign = if (rate > 0) 1 else -1 - } else { - activity += (magnitude - activity) * ACTIVITY_ALPHA - if (magnitude > threshold * ACTIVITY_FRACTION) lastMotionNs = now - } - return - } - // In a burst: wait for the rate to drop back under the threshold. - if (abs(rate) > threshold * BURST_END_FRACTION && (if (rate > 0) 1 else -1) == burstSign) return - inBurst = false - val duration = now - burstStartNs - if (duration > MAX_BURST_NS) return // a slow sweep, not a flick - - val sinceFirst = now - firstTwistNs - if (firstTwistNs != 0L && burstSign == firstTwistSign && sinceFirst in MIN_GAP_NS..MAX_GAP_NS) { - firstTwistNs = 0L - onDoubleTwist() - } else if (firstTwistNs == 0L || sinceFirst > MAX_GAP_NS || burstSign != firstTwistSign) { - // The return twist (opposite sign) does not start a new pair; a - // fresh same-direction twist does. - if (firstTwistNs == 0L || sinceFirst > MAX_GAP_NS) { - firstTwistNs = now - firstTwistSign = burstSign - } - } - } - - override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) = Unit - - private companion object { - const val TAG = "FaceclawWear" - const val SAMPLING_PERIOD_US = 10_000 - const val MAX_BURST_NS = 350_000_000L - const val MIN_GAP_NS = 120_000_000L - const val MAX_GAP_NS = 900_000_000L - const val BURST_END_FRACTION = 0.5f - const val ACTIVITY_ALPHA = 0.04f - const val ACTIVITY_FRACTION = 0.35f - const val STILLNESS_BEFORE_TWIST_NS = 300_000_000L - } -} diff --git a/wear/app/src/main/kotlin/com/faceclaw/wear/ui/FaceclawWearApp.kt b/wear/app/src/main/kotlin/com/faceclaw/wear/ui/FaceclawWearApp.kt index a244554b..4b0209d3 100644 --- a/wear/app/src/main/kotlin/com/faceclaw/wear/ui/FaceclawWearApp.kt +++ b/wear/app/src/main/kotlin/com/faceclaw/wear/ui/FaceclawWearApp.kt @@ -18,7 +18,6 @@ import androidx.wear.compose.navigation.rememberSwipeDismissableNavController import com.faceclaw.wear.AmbientMode import com.faceclaw.wear.Haptics import com.faceclaw.wear.PhoneLink -import com.faceclaw.wear.Prefs import com.faceclaw.wear.Wake import com.faceclaw.wear.WatchPrefs import kotlinx.coroutines.flow.StateFlow @@ -58,14 +57,13 @@ fun FaceclawWearApp( ambient: StateFlow, wakes: StateFlow, ) { - val prefs by prefsStore.prefs.collectAsStateWithLifecycle() val ambientMode by ambient.collectAsStateWithLifecycle() val navController = rememberSwipeDismissableNavController() MaterialTheme(colors = FaceclawColors) { CompositionLocalProvider(LocalAmbientMode provides ambientMode) { Box(modifier = Modifier.fillMaxSize()) { - Screens(navController, link, prefs, prefsStore, haptics, wakes) + Screens(navController, link, prefsStore, haptics, wakes) if (ambientMode.active) AmbientScreen(link = link, ambient = ambientMode) } } @@ -76,13 +74,16 @@ fun FaceclawWearApp( private fun Screens( navController: NavHostController, link: PhoneLink, - prefs: Prefs, prefsStore: WatchPrefs, haptics: Haptics, wakes: StateFlow, ) { + // Prefs are collected inside each destination rather than passed in as a + // value: the nav host keeps the content lambda it composed, so a value + // captured by the builder would stay stale until the screen is re-entered. SwipeDismissableNavHost(navController = navController, startDestination = Routes.REMOTE) { composable(Routes.REMOTE) { + val prefs by prefsStore.prefs.collectAsStateWithLifecycle() RemoteScreen( link = link, prefs = prefs, @@ -103,6 +104,7 @@ private fun Screens( StatusScreen(link = link, haptics = haptics, onOpenSettings = { navController.navigate(Routes.SETTINGS) }) } composable(Routes.SETTINGS) { + val prefs by prefsStore.prefs.collectAsStateWithLifecycle() SettingsScreen(prefs = prefs, store = prefsStore) } } diff --git a/wear/app/src/main/kotlin/com/faceclaw/wear/ui/RemoteScreen.kt b/wear/app/src/main/kotlin/com/faceclaw/wear/ui/RemoteScreen.kt index b6d72bff..471fd45c 100644 --- a/wear/app/src/main/kotlin/com/faceclaw/wear/ui/RemoteScreen.kt +++ b/wear/app/src/main/kotlin/com/faceclaw/wear/ui/RemoteScreen.kt @@ -50,7 +50,6 @@ import androidx.wear.compose.material.ButtonDefaults import androidx.wear.compose.material.Icon import androidx.wear.compose.material.MaterialTheme import androidx.wear.compose.material.Text -import com.faceclaw.wear.Command import com.faceclaw.wear.FingerTapDetector import com.faceclaw.wear.Gesture import com.faceclaw.wear.Haptics @@ -58,9 +57,7 @@ import com.faceclaw.wear.OnBodyMonitor import com.faceclaw.wear.PhoneLink import com.faceclaw.wear.Prefs import com.faceclaw.wear.R -import com.faceclaw.wear.SwipeAction import com.faceclaw.wear.Wake -import com.faceclaw.wear.WristTwistDetector import kotlinx.coroutines.delay import kotlinx.coroutines.flow.StateFlow import java.util.Date @@ -81,10 +78,10 @@ private const val SCREEN_ON_SECOND_TAP_WINDOW_MS = 600L /** * The touchpad. The whole screen is the pad: tap = select, double-tap = * back, hold = long press (released when the finger lifts), two-finger tap = - * the hold menu ("right click"), swipes in four directions = spatial + * back as well, swipes in four directions = spatial * navigation (crown and two-finger vertical swipes = plain scrolling, a page * at a time for the latter). Fingertip pinch-taps from the motion sensors - * select / go back, and two quick wrist twists go back. An upward swipe that + * select / go back. An upward swipe that * begins at the bottom edge reveals the otherwise-hidden action buttons. * * A tap that wakes the display never reaches the pad (the system eats it), @@ -134,7 +131,7 @@ fun RemoteScreen( onDispose { lifecycleOwner.lifecycle.removeObserver(observer) } } var crownAccumulator by remember { mutableStateOf(0f) } - // Pad height in px, for the tap zones; written by onSizeChanged, read by + // Pad height in px, for the edge-reveal zone; written by onSizeChanged, read by // the gesture callbacks (plain holder: the callbacks are remembered once). val padHeight = remember { floatArrayOf(1f) } @@ -166,47 +163,15 @@ fun RemoteScreen( link.sendGesture(Gesture.DOUBLE_CLICK) } - /** Run a horizontal-swipe action; `left` says which way the finger went. */ - fun perform(action: SwipeAction, left: Boolean) { - when (action) { - SwipeAction.NAVIGATE -> { - val gesture = if (left) Gesture.SWIPE_LEFT else Gesture.SWIPE_RIGHT - if (gestureAllowed(gesture)) { haptics.click(); link.sendGesture(gesture) } - } - SwipeAction.SIDEBAR -> if (!glassesScreenIsOff()) { - haptics.click() - link.sendCommand(Command.SIDEBAR, "source" to "gesture") - } - SwipeAction.DOUBLE_CLICK -> doubleClick() - SwipeAction.CLICK -> click() - SwipeAction.LONG_PRESS -> if (!glassesScreenIsOff()) { haptics.heavy(); link.sendGesture(Gesture.LONG_PRESS) } - SwipeAction.WAKEWORD -> if (!glassesScreenIsOff()) { haptics.click(); link.sendGesture(Gesture.WAKEWORD) } - SwipeAction.NONE -> Unit - } - } - - /** Whether a vertical swipe means "up", honouring the natural-scroll preference. */ - fun swipeIsUp(dy: Float): Boolean { - // Ring convention: swiping up means up. "Natural" flips it so the - // content follows the finger like a touch screen. - return if (currentPrefs.naturalScroll) dy > 0 else dy < 0 + /** A horizontal swipe is spatial input; the glasses UI decides what it means. */ + fun navigate(left: Boolean) { + val gesture = if (left) Gesture.SWIPE_LEFT else Gesture.SWIPE_RIGHT + if (gestureAllowed(gesture)) { haptics.click(); link.sendGesture(gesture) } } val callbacks = remember(link, haptics) { TouchpadCallbacks( - onTap = { position -> - if (currentPrefs.tapZones) { - // Top third scrolls up, bottom third down, the middle clicks. - val zone = position.y / padHeight[0].coerceAtLeast(1f) - when { - zone < 1f / 3f -> scroll(Gesture.SCROLL_UP, 1) - zone > 2f / 3f -> scroll(Gesture.SCROLL_DOWN, 1) - else -> click() - } - } else { - click() - } - }, + onTap = { _ -> click() }, onDoubleTap = { _ -> doubleClick() }, onShortThenLongPress = { if (!glassesScreenIsOff()) { haptics.heavy(); link.sendGesture(Gesture.SHORT_THEN_LONG_PRESS) } @@ -215,9 +180,9 @@ fun RemoteScreen( onTwoFingerTap = { doubleClick() }, onTwoFingerSwipe = { dx, dy -> if (abs(dy) >= abs(dx)) { - scroll(if (swipeIsUp(dy)) Gesture.SCROLL_UP else Gesture.SCROLL_DOWN, TWO_FINGER_SWIPE_STEPS) + scroll(if (dy < 0) Gesture.SCROLL_UP else Gesture.SCROLL_DOWN, TWO_FINGER_SWIPE_STEPS) } else { - perform(if (dx < 0) currentPrefs.swipeLeft else currentPrefs.swipeRight, left = dx < 0) + navigate(left = dx < 0) } }, onLongPressStart = { @@ -252,10 +217,9 @@ fun RemoteScreen( // whenever the display lagged the finger. Fast repeated // swiping, the crown, or a two-finger page swipe cover // long distances instead. - val up = swipeIsUp(dy) - scroll(if (up) Gesture.SWIPE_UP else Gesture.SWIPE_DOWN, 1) + scroll(if (dy < 0) Gesture.SWIPE_UP else Gesture.SWIPE_DOWN, 1) } - else -> perform(if (dx < 0) currentPrefs.swipeLeft else currentPrefs.swipeRight, left = dx < 0) + else -> navigate(left = dx < 0) } }, ) @@ -294,18 +258,6 @@ fun RemoteScreen( ) } WhileStartedEffect(fingerTapDetector, enabled = !ambientActive, start = { fingerTapDetector?.start() }, stop = { fingerTapDetector?.stop() }) - // Two quick wrist twists = back, from the gyroscope, only while the pad is up. - val wristTwistEnabled = prefs.wristTwist - val wristTwistDetector = remember(wristTwistEnabled, link, haptics) { - if (!wristTwistEnabled) null else WristTwistDetector( - context = view.context, - sensitivity = { currentPrefs.twistSensitivity }, - quietUntil = { haptics.quietUntil() }, - onBody = { onBody.onBody }, - onDoubleTwist = { doubleClick() }, - ) - } - WhileStartedEffect(wristTwistDetector, enabled = !ambientActive, start = { wristTwistDetector?.start() }, stop = { wristTwistDetector?.stop() }) // A refused or unanswered gesture gets a distinct buzz, so the wrist knows // without looking (the notice pill says why). diff --git a/wear/app/src/main/kotlin/com/faceclaw/wear/ui/SettingsScreen.kt b/wear/app/src/main/kotlin/com/faceclaw/wear/ui/SettingsScreen.kt index 60a9283d..c7b33464 100644 --- a/wear/app/src/main/kotlin/com/faceclaw/wear/ui/SettingsScreen.kt +++ b/wear/app/src/main/kotlin/com/faceclaw/wear/ui/SettingsScreen.kt @@ -50,44 +50,6 @@ fun SettingsScreen(prefs: Prefs, store: WatchPrefs) { modifier = Modifier.fillMaxWidth(), ) } - item { - ToggleChip( - checked = prefs.naturalScroll, - onCheckedChange = { on -> store.update { it.copy(naturalScroll = on) } }, - label = { Text("Natural swipe") }, - secondaryLabel = { Text(if (prefs.naturalScroll) "content follows finger" else "swipe up = scroll up (ring)") }, - toggleControl = { Switch(checked = prefs.naturalScroll) }, - modifier = Modifier.fillMaxWidth(), - ) - } - item { - ToggleChip( - checked = prefs.tapZones, - onCheckedChange = { on -> store.update { it.copy(tapZones = on) } }, - label = { Text("Tap zones") }, - secondaryLabel = { Text("tap top/bottom to scroll") }, - toggleControl = { Switch(checked = prefs.tapZones) }, - modifier = Modifier.fillMaxWidth(), - ) - } - item { - Chip( - onClick = { store.update { it.copy(swipeLeft = it.swipeLeft.next()) } }, - label = { Text("Swipe left") }, - secondaryLabel = { Text(prefs.swipeLeft.label) }, - colors = ChipDefaults.secondaryChipColors(), - modifier = Modifier.fillMaxWidth(), - ) - } - item { - Chip( - onClick = { store.update { it.copy(swipeRight = it.swipeRight.next()) } }, - label = { Text("Swipe right") }, - secondaryLabel = { Text(prefs.swipeRight.label) }, - colors = ChipDefaults.secondaryChipColors(), - modifier = Modifier.fillMaxWidth(), - ) - } item { ListHeader { Text("Tip taps") } } item { ToggleChip( @@ -117,27 +79,6 @@ fun SettingsScreen(prefs: Prefs, store: WatchPrefs) { textAlign = TextAlign.Center, ) } - item { ListHeader { Text("Wrist twist") } } - item { - ToggleChip( - checked = prefs.wristTwist, - onCheckedChange = { on -> store.update { it.copy(wristTwist = on) } }, - label = { Text("Twist twice = back") }, - secondaryLabel = { Text("two quick wrist flicks") }, - toggleControl = { Switch(checked = prefs.wristTwist) }, - modifier = Modifier.fillMaxWidth(), - ) - } - item { - Chip( - onClick = { store.update { it.copy(twistSensitivity = it.twistSensitivity.next()) } }, - label = { Text("Twist sensitivity") }, - secondaryLabel = { Text(prefs.twistSensitivity.label) }, - colors = ChipDefaults.secondaryChipColors(), - modifier = Modifier.fillMaxWidth(), - enabled = prefs.wristTwist, - ) - } item { ListHeader { Text("Crown") } } item { Chip(