Hey Dumby is now the one app: the wake-word listener (with the
pre-roll + double-check trick from Hey Claude, so a stray word
doesn't trigger it) branches into three things depending on what
it hears.
- The full phrase ("hey dummy take a note" by default) drops
straight into dictation, unchanged from before.
- The bare phrase alone ("hey dummy"/"hey dumby"/"okay dummy")
beeps and listens for one command: open an app, call, text,
directions, or falls through to the Claude app. This is Hey
Claude's CommandRouter/AppMatcher/ContactMatcher/Comms, ported
over basically unchanged (package renamed, Hey Claude branding
swapped for Hey Dumby).
- Driving mode (DrivingMode.kt, new): speaks command results out
loud with TextToSpeech instead of only showing them. Can be
switched on by voice ("hey dummy, driving mode on") or, if
Bluetooth permission is granted, auto-arms when the phone
connects to something that reports itself as an audio/video
Bluetooth device (the closest thing Android has to "this is a
car"), and disarms on disconnect.
Kept Hey Dumby's bundled-in-the-apk speech model (ModelFiles) over
Hey Claude's download-on-first-run one, so the no-network claim on
the landing page stays true and the INTERNET permission goes away.
Still TODO, not done in this pass:
- Settings screen doesn't expose the new toggles yet (driving
mode, auto-arm, call/text direct, aliases, strict wake). They
all have working Prefs getters/setters, just no UI.
Quick Settings tile and the Claude-app fallback aren't wired
into a Settings toggle either, though they work.
- Not build-tested. No Android SDK in this workspace to compile
against; needs a real build on Elessar before it installs.
50 lines
1.4 KiB
Kotlin
50 lines
1.4 KiB
Kotlin
package space.bloggin.scribe
|
|
|
|
import android.content.Context
|
|
import android.media.AudioManager
|
|
import android.media.ToneGenerator
|
|
import android.os.Handler
|
|
import android.os.Looper
|
|
import android.os.VibrationEffect
|
|
import android.os.Vibrator
|
|
import android.os.VibratorManager
|
|
|
|
object Sounds {
|
|
private val main = Handler(Looper.getMainLooper())
|
|
|
|
private fun tone(type: Int, ms: Int) {
|
|
try {
|
|
val tg = ToneGenerator(AudioManager.STREAM_NOTIFICATION, 85)
|
|
tg.startTone(type, ms)
|
|
main.postDelayed({ tg.release() }, ms + 300L)
|
|
} catch (_: Exception) {
|
|
}
|
|
}
|
|
|
|
private fun buzz(ctx: Context, ms: Long) {
|
|
try {
|
|
val v = (ctx.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as? VibratorManager)?.defaultVibrator
|
|
?: @Suppress("DEPRECATION") (ctx.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator)
|
|
v.vibrate(VibrationEffect.createOneShot(ms, VibrationEffect.DEFAULT_AMPLITUDE))
|
|
} catch (_: Exception) {
|
|
}
|
|
}
|
|
|
|
/** "I'm listening" */
|
|
fun wake(ctx: Context) {
|
|
if (Prefs.beep(ctx)) tone(ToneGenerator.TONE_PROP_BEEP, 140)
|
|
buzz(ctx, 40)
|
|
}
|
|
|
|
/** Got it */
|
|
fun done(ctx: Context) {
|
|
if (Prefs.beep(ctx)) tone(ToneGenerator.TONE_PROP_ACK, 120)
|
|
}
|
|
|
|
/** Didn't work */
|
|
fun error(ctx: Context) {
|
|
if (Prefs.beep(ctx)) tone(ToneGenerator.TONE_PROP_NACK, 250)
|
|
buzz(ctx, 120)
|
|
}
|
|
}
|