From 6060f2288ff0929cf96f891e9b88582847d4b480 Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Fri, 6 Nov 2026 12:17:37 -0500 Subject: [PATCH] feat(wow): voice type and keyboard chat bar for World of Warcraft (#2171) * Add voice and keyboard chat input for World of Warcraft Open a chat bar with an editable text field when a WoW client focuses a text box (reported by Proton's winex11 IME context hook through agent/wine-ime.json). First use asks for Voice type or Android keyboard with a remember toggle; the choice is also in the side menu's Keyboard group while a WoW client runs. Voice type uses the device's speech recognition service. On dual-screen devices the bar and keyboard open on the second screen. Send types the text and presses Enter; Cancel presses Escape. * Cover the Arm64 WoW client in the chat match test * Give the second-screen chat bar the session's result and back owners * Open the WoW chat bar with the game field's current text When the bar opens, select and copy the game's text field and fill the bar with it through the session clipboard bridge, then put the guest clipboard back. Send selects the field first, so the bar's text replaces what was there instead of being appended. * Keep WoW chat consistent across screen changes and failed field reads Close the bar when the game field closes even after the program name is cleared, move the bar to the top screen when the second screen drops it, and drop any pending second-screen keyboard request when the bar opens. A field read that gets no copy of its own leaves the game text unselected and Send then types without replacing it. Ctrl is only pressed and released when nothing else holds it, and a pending read ends when the clipboard bridge stops. * fix(session): Close WoW chat for other programs and keep the game cursor on cancelled reads --- .../com/droiddeck/launcher/SessionActivity.kt | 116 ++++++++- .../droiddeck/launcher/agent/AgentGuest.kt | 19 +- .../droiddeck/launcher/input/KeyboardHost.kt | 42 ++-- .../launcher/input/SessionClipboard.kt | 28 ++- .../launcher/session/SessionPrefs.kt | 9 + .../launcher/ui/BottomScreenTyping.kt | 23 +- .../droiddeck/launcher/ui/FrontEndWidgets.kt | 22 ++ .../launcher/ui/SecondScreenPresentation.kt | 37 ++- .../droiddeck/launcher/ui/SessionOverlay.kt | 12 + .../droiddeck/launcher/ui/SlowUsbDialog.kt | 29 +-- .../java/com/droiddeck/launcher/ui/WowChat.kt | 230 ++++++++++++++++++ app/src/main/res/values-ar/strings.xml | 8 + app/src/main/res/values-b+es+419/strings.xml | 8 + app/src/main/res/values-bg/strings.xml | 8 + app/src/main/res/values-cs/strings.xml | 8 + app/src/main/res/values-da/strings.xml | 8 + app/src/main/res/values-de/strings.xml | 8 + app/src/main/res/values-el/strings.xml | 8 + app/src/main/res/values-es/strings.xml | 8 + app/src/main/res/values-fi/strings.xml | 8 + app/src/main/res/values-fr/strings.xml | 8 + app/src/main/res/values-hi/strings.xml | 8 + app/src/main/res/values-hu/strings.xml | 8 + app/src/main/res/values-in/strings.xml | 8 + app/src/main/res/values-it/strings.xml | 8 + app/src/main/res/values-ja/strings.xml | 8 + app/src/main/res/values-ko/strings.xml | 8 + app/src/main/res/values-ms/strings.xml | 8 + app/src/main/res/values-nb/strings.xml | 8 + app/src/main/res/values-nl/strings.xml | 8 + app/src/main/res/values-pl/strings.xml | 8 + app/src/main/res/values-pt-rPT/strings.xml | 8 + app/src/main/res/values-pt/strings.xml | 8 + app/src/main/res/values-ro/strings.xml | 8 + app/src/main/res/values-ru/strings.xml | 8 + app/src/main/res/values-sv/strings.xml | 8 + app/src/main/res/values-th/strings.xml | 8 + app/src/main/res/values-tr/strings.xml | 8 + app/src/main/res/values-uk/strings.xml | 8 + app/src/main/res/values-vi/strings.xml | 8 + app/src/main/res/values-zh-rCN/strings.xml | 8 + app/src/main/res/values-zh-rHK/strings.xml | 8 + app/src/main/res/values-zh-rTW/strings.xml | 8 + app/src/main/res/values/strings.xml | 8 + .../com/droiddeck/launcher/ui/WowChatTest.kt | 21 ++ 45 files changed, 785 insertions(+), 67 deletions(-) create mode 100644 app/src/main/java/com/droiddeck/launcher/ui/WowChat.kt create mode 100644 app/src/test/java/com/droiddeck/launcher/ui/WowChatTest.kt diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index 2363b8beb5..1647647147 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -4,6 +4,7 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.imePadding import android.hardware.input.InputManager import android.hardware.display.DisplayManager import android.content.Intent @@ -233,6 +234,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { private var screenKeyBind: List? = null private var screenKeyDir: Int? = null private var screenKeyTextFocus = false + private val appTextFocus get() = screenKeyTextFocus || wowChat.request != null + private val wowChat by lazy { com.droiddeck.launcher.ui.WowChat(this, ::sendWowChat, ::cancelWowChat, ::readGameField) } + private var wowChatBottom: SecondScreenPresentation? = null + private var wowChatOnTop by mutableStateOf(false) private var screenKeyEdit by mutableStateOf(null) private var screenLayoutsOpen by mutableStateOf(false) private var screenKeysShown by mutableStateOf(true) @@ -910,6 +915,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { } androidx.compose.runtime.LaunchedEffect(AgentGuest.steamKeyboard) { updateOnScreenControls() } androidx.compose.runtime.LaunchedEffect(AgentGuest.desktopTextField) { onDesktopTextField(AgentGuest.desktopTextField) } + androidx.compose.runtime.LaunchedEffect(AgentGuest.gameTextField, AgentGuest.gameProgram) { onGameTextField(AgentGuest.gameTextField) } + androidx.compose.runtime.LaunchedEffect(wowChat.request) { placeWowChat() } androidx.compose.runtime.LaunchedEffect(pipUi, pcKeyboardOpen) { updateDesktopKeyboardButton() } val keyboardRequestsSeen = androidx.compose.runtime.remember { intArrayOf(AgentGuest.keyboardRequests) } androidx.compose.runtime.LaunchedEffect(AgentGuest.keyboardRequests) { @@ -1033,6 +1040,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { } } } + if (wowChat.asking) com.droiddeck.launcher.ui.WowChatChoiceDialog(wowChat) + if (wowChatOnTop && wowChat.request != null) androidx.compose.foundation.layout.Box( + Modifier.fillMaxSize().imePadding(), contentAlignment = androidx.compose.ui.Alignment.BottomCenter, + ) { com.droiddeck.launcher.ui.WowChatPanel(wowChat) } if (gestureSettingsOpen) com.droiddeck.launcher.ui.TouchGestureDialog( game = gestureGame, onDismiss = { gestureSettingsOpen = false }, @@ -1310,6 +1321,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { }, onKeyboard = { drawerOpen = false; pcKeyboardOpen = false; keyboard?.toggle() }, onHardwareKeyboard = ::togglePcKeyboard, + wowChatShown = com.droiddeck.launcher.ui.WowChat.isWow(AgentGuest.gameProgram), + wowChat = wowChat.remembered, + onWowChat = wowChat::choose, controller = controllerSettings, onRumble = { on -> updateControllerPrefs { ControllerPrefs.setRumble(this@SessionActivity, on) } }, onSteamButton = { on -> updateControllerPrefs { ControllerPrefs.setSteamButton(this@SessionActivity, on) } }, @@ -2642,7 +2656,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { SessionState.mode == SessionService.MODE_STEAM && SessionState.running && SessionState.firstFrameSeen && !SessionState.suspended && !ended && !pipUi && !drawerOpen && !pcKeyboardOpen && !achievementsOpen && - !gestureSettingsOpen && !screenKeyTextFocus && window.decorView.hasWindowFocus() + !gestureSettingsOpen && !appTextFocus && window.decorView.hasWindowFocus() if (steamVolume) { val audio = getSystemService(android.media.AudioManager::class.java) if (com.droiddeck.launcher.input.SteamVolumeKeys.dispatch(event, !audio.isVolumeFixed) { direction -> @@ -2656,10 +2670,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { Log.i(TAG, String.format(java.util.Locale.ROOT, "back key device=%d (%s) source=0x%x flags=0x%x", event.deviceId, event.device?.name, event.source, event.flags)) } - val mouseToGuest = !pipUi && !screenKeyTextFocus && !drawerOpen && !pcKeyboardOpen && !achievementsOpen && !gestureSettingsOpen && + val mouseToGuest = !pipUi && !appTextFocus && !drawerOpen && !pcKeyboardOpen && !achievementsOpen && !gestureSettingsOpen && !SessionState.suspended && !(::loading.isInitialized && (loading.visible || loading.ended)) if (mouseBackInput.onKeyEvent(event, mouseToGuest)) return true - val backToQam = !pipUi && !screenKeyTextFocus && !drawerOpen && !pcKeyboardOpen && !achievementsOpen && + val backToQam = !pipUi && !appTextFocus && !drawerOpen && !pcKeyboardOpen && !achievementsOpen && SessionState.mode == SessionService.MODE_STEAM && SessionState.running && SessionState.firstFrameSeen && !SessionState.suspended && padBridge?.canHoldQam() == true if (backQamInput.onKeyEvent(event, backToQam)) { @@ -2668,7 +2682,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { return true } if (pipUi) return true - if (screenKeyTextFocus) return super.dispatchKeyEvent(event) + if (appTextFocus) return super.dispatchKeyEvent(event) if (physicalShortcuts.onKey( event, enabled = SessionState.running && !SessionState.suspended && @@ -3552,20 +3566,96 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { showCursor(px, py) } - private fun openBottomKeyboard() { - if (!started) return + private fun bottomKeyboardPresentation(): SecondScreenPresentation? { + if (!started) return null if (secondScreenPresentation?.showsKeyboard != true && dockDrawer()) { - val target = com.droiddeck.launcher.input.DualScreen.sessionDisplay(this, displayManager, shownOnDisplayId) ?: return + val target = com.droiddeck.launcher.input.DualScreen.sessionDisplay(this, displayManager, shownOnDisplayId) ?: return null if (drawerOpen || drawerPinned) drawerOpen = false typingReturnMode = secondScreenMode selectedSecondScreenDisplay = target.displayId selectSecondScreenMode(SecondScreenMode.KEYBOARD_TRACKPAD) } - val presentation = secondScreenPresentation ?: return - if (!presentation.showsKeyboard) return - val display = presentation.display?.displayId ?: return + return secondScreenPresentation?.takeIf { it.showsKeyboard && it.display != null } + } + + private fun openBottomKeyboard() { + val presentation = bottomKeyboardPresentation() ?: return presentation.requestKeyboard(forField = true) - com.droiddeck.launcher.ui.SessionTyping.focusDisplay(this, display) + com.droiddeck.launcher.ui.SessionTyping.focusDisplay(this, presentation.display.displayId) + } + + private fun onGameTextField(focused: Boolean) { + if (!focused || !com.droiddeck.launcher.ui.WowChat.isWow(AgentGuest.gameProgram)) wowChat.chatClosed() + else if (resumed && !pipUi && !pcKeyboardOpen && + resources.configuration.hardKeyboardHidden != android.content.res.Configuration.HARDKEYBOARDHIDDEN_NO) { + keyboard?.takeIf { it.shown }?.hide() + wowChat.chatOpened() + } + } + + private fun placeWowChat() { + val open = wowChat.request != null + val shown = wowChatBottom + wowChatOnTop = false + if (open && shown == null) { + val presentation = bottomKeyboardPresentation() + if (presentation == null) { + wowChatOnTop = true + return + } + wowChatBottom = presentation + presentation.showChat(onLost = { + if (wowChatBottom === presentation) { + wowChatBottom = null + wowChatOnTop = wowChat.request != null + } + }) { + androidx.compose.runtime.CompositionLocalProvider( + androidx.activity.compose.LocalActivityResultRegistryOwner provides this, + androidx.activity.compose.LocalOnBackPressedDispatcherOwner provides this, + ) { DroidDeckTheme { com.droiddeck.launcher.ui.WowChatPanel(wowChat) } } + } + com.droiddeck.launcher.ui.SessionTyping.focusDisplay(this, presentation.display.displayId) + } else if (!open && shown != null) { + wowChatBottom = null + shown.hideChat() + if (secondScreenPresentation === shown) bottomKeyboardClosed() + } + } + + private fun sendWowChat(text: String, replace: Boolean) { + val host = keyboard ?: return + if (replace) { + selectGameField() + if (text.isEmpty()) host.tap(KeyEvent.KEYCODE_DEL) + } else { + WaylandCompositor.nativeSendKey(KEY_END, 1) + WaylandCompositor.nativeSendKey(KEY_END, 0) + } + host.type(text) + host.tap(KeyEvent.KEYCODE_ENTER) + } + + private fun selectGameField(vararg then: Int) { + val held = KEY_LEFTCTRL in guestKeysDown || KEY_LEFTCTRL in gestureKeysDown + if (!held) WaylandCompositor.nativeSendKey(KEY_LEFTCTRL, 1) + for (key in intArrayOf(KEY_A) + then) { + WaylandCompositor.nativeSendKey(key, 1) + WaylandCompositor.nativeSendKey(key, 0) + } + if (!held) WaylandCompositor.nativeSendKey(KEY_LEFTCTRL, 0) + } + + private fun readGameField(done: (String?) -> Unit) { + sessionClipboard.captureGuest(FIELD_READ_MS, onTimeout = { + WaylandCompositor.nativeSendKey(KEY_END, 1) + WaylandCompositor.nativeSendKey(KEY_END, 0) + }, onText = done) + selectGameField(KEY_C) + } + + private fun cancelWowChat() { + keyboard?.tap(KeyEvent.KEYCODE_ESCAPE) } private fun bottomKeyboardClosed() { @@ -5199,6 +5289,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { private const val AXIS_UNITS_PER_PIXEL = 3f private const val KEY_LEFTCTRL = 29 private const val KEY_RIGHTCTRL = 97 + private const val KEY_A = 30 + private const val KEY_C = 46 + private const val KEY_END = 107 + private const val FIELD_READ_MS = 600L private const val BTN_SIDE = 0x113 private const val BTN_EXTRA = 0x114 private const val DESKTOP_GRAB_TAP_MS = 500L diff --git a/app/src/main/java/com/droiddeck/launcher/agent/AgentGuest.kt b/app/src/main/java/com/droiddeck/launcher/agent/AgentGuest.kt index a89c14c66a..eaa2bbc0f7 100644 --- a/app/src/main/java/com/droiddeck/launcher/agent/AgentGuest.kt +++ b/app/src/main/java/com/droiddeck/launcher/agent/AgentGuest.kt @@ -26,6 +26,10 @@ object AgentGuest { private set var keyboardRequests by mutableIntStateOf(0) private set + var gameTextField by mutableStateOf(false) + private set + var gameProgram by mutableStateOf(null) + private set var keyboardDismissals by mutableIntStateOf(0) private set @Volatile private var keyboardRoute = false @@ -43,7 +47,7 @@ object AgentGuest { observer?.stopWatching() observer = null lastFocusKey = null - main.post { steamKeyboard = false; desktopTextField = false } + main.post { steamKeyboard = false; desktopTextField = false; gameTextField = false; gameProgram = null } val dir = dir(context) dir.deleteRecursively() dir.mkdirs() @@ -59,6 +63,7 @@ object AgentGuest { "focus.json" -> readJson(File(dir, path))?.let(::recordFocus) "keyboard.json" -> readJson(File(dir, path))?.let { recordKeyboard(this, it) } "ime.json" -> readJson(File(dir, path))?.let { recordTextField(this, it) } + "wine-ime.json" -> readJson(File(dir, path))?.let { recordGameTextField(this, it) } "keyboard-request.json" -> readJson(File(dir, path))?.let { recordKeyboardRequest(this) } "keyboard-dismiss.json" -> readJson(File(dir, path))?.let { recordKeyboardDismiss(this) } } @@ -71,7 +76,7 @@ object AgentGuest { synchronized(lock) { observer?.stopWatching() observer = null - main.post { steamKeyboard = false; desktopTextField = false } + main.post { steamKeyboard = false; desktopTextField = false; gameTextField = false; gameProgram = null } } } @@ -129,6 +134,16 @@ object AgentGuest { SessionEvents.record("ime.changed", mapOf("textField" to focused, "seq" to snapshot.optInt("seq"))) } + private fun recordGameTextField(source: FileObserver, snapshot: JSONObject) { + val focused = snapshot.optBoolean("textField") + val program = snapshot.optString("program").takeIf { it.isNotEmpty() } + synchronized(lock) { + if (source !== observer) return + main.post { gameProgram = program; gameTextField = focused } + } + SessionEvents.record("game.ime.changed", mapOf("textField" to focused, "program" to program, "seq" to snapshot.optInt("seq"))) + } + private fun recordFocus(snapshot: JSONObject) { val fields = linkedMapOf( "focusedApp" to snapshot.opt("focusedApp"), diff --git a/app/src/main/java/com/droiddeck/launcher/input/KeyboardHost.kt b/app/src/main/java/com/droiddeck/launcher/input/KeyboardHost.kt index ab2550a4a8..6656b7697f 100644 --- a/app/src/main/java/com/droiddeck/launcher/input/KeyboardHost.kt +++ b/app/src/main/java/com/droiddeck/launcher/input/KeyboardHost.kt @@ -89,21 +89,31 @@ class KeyboardHost( clearFocus() } + fun type(text: CharSequence?) { + if (text.isNullOrEmpty()) return + val events = map.getEvents(text.toString().toCharArray()) + if (events != null) { + for (event in events) sendKeyEvent(event) + } else { + for (ch in text) { + val t = System.currentTimeMillis() + val down = KeyEvent(t, t, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_UNKNOWN, 0, 0, + KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, 0) + sendKeyEvent(CharKeyEvent(down, ch)) + sendKeyEvent(CharKeyEvent(KeyEvent.changeAction(down, KeyEvent.ACTION_UP), ch)) + } + } + } + + fun tap(keyCode: Int) { + val t = System.currentTimeMillis() + sendKeyEvent(KeyEvent(t, t, KeyEvent.ACTION_DOWN, keyCode, 0)) + sendKeyEvent(KeyEvent(t, t, KeyEvent.ACTION_UP, keyCode, 0)) + } + private inner class KeyConnection : BaseInputConnection(this, false) { override fun commitText(text: CharSequence?, newCursorPosition: Int): Boolean { - if (text.isNullOrEmpty()) return true - val events = map.getEvents(text.toString().toCharArray()) - if (events != null) { - for (event in events) sendKeyEvent(event) - } else { - for (ch in text) { - val t = System.currentTimeMillis() - val down = KeyEvent(t, t, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_UNKNOWN, 0, 0, - KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, 0) - sendKeyEvent(CharKeyEvent(down, ch)) - sendKeyEvent(CharKeyEvent(KeyEvent.changeAction(down, KeyEvent.ACTION_UP), ch)) - } - } + type(text) return true } @@ -123,12 +133,6 @@ class KeyboardHost( return true } - private fun tap(keyCode: Int) { - val t = System.currentTimeMillis() - sendKeyEvent(KeyEvent(t, t, KeyEvent.ACTION_DOWN, keyCode, 0)) - sendKeyEvent(KeyEvent(t, t, KeyEvent.ACTION_UP, keyCode, 0)) - } - override fun getTextBeforeCursor(n: Int, flags: Int): CharSequence = "" override fun getTextAfterCursor(n: Int, flags: Int): CharSequence = "" override fun getSelectedText(flags: Int): CharSequence? = null diff --git a/app/src/main/java/com/droiddeck/launcher/input/SessionClipboard.kt b/app/src/main/java/com/droiddeck/launcher/input/SessionClipboard.kt index c29c772112..a32ba0c4e6 100644 --- a/app/src/main/java/com/droiddeck/launcher/input/SessionClipboard.kt +++ b/app/src/main/java/com/droiddeck/launcher/input/SessionClipboard.kt @@ -19,11 +19,20 @@ class SessionClipboard(context: Context, private val hasFocus: () -> Boolean) { private var published = false private var shared: String? = null private var echo: String? = null + private var capture: ((String?) -> Unit)? = null + private var captureBefore: String? = null + private var captureLate: (() -> Unit)? = null private val androidListener = ClipboardManager.OnPrimaryClipChangedListener { refresh(changed = true) } private val guestListener = object : WaylandCompositor.ClipboardListener { override fun onGuestClipboardText(text: String) { handler.post { - if (active && hasFocus() && WaylandCompositor.isClipboardListener(this)) { + val taken = capture?.takeIf { text != captureBefore } + if (taken != null && WaylandCompositor.isClipboardListener(this)) { + capture = null + handler.removeCallbacks(captureTimeout) + WaylandCompositor.setClipboardText(shared) + taken(text) + } else if (active && hasFocus() && WaylandCompositor.isClipboardListener(this)) { val current = clipboard.primaryClip?.takeIf { it.itemCount > 0 }?.getItemAt(0)?.text shared = text published = true @@ -36,6 +45,21 @@ class SessionClipboard(context: Context, private val hasFocus: () -> Boolean) { } } + private val captureTimeout = Runnable { + val taken = capture ?: return@Runnable + capture = null + captureLate?.invoke() + taken(null) + } + + fun captureGuest(timeoutMs: Long, onTimeout: () -> Unit = {}, onText: (String?) -> Unit) { + capture?.let { handler.removeCallbacks(captureTimeout); it(null) } + capture = onText + captureLate = onTimeout + captureBefore = shared + handler.postDelayed(captureTimeout, timeoutMs) + } + fun start() { if (active) return active = true @@ -47,6 +71,8 @@ class SessionClipboard(context: Context, private val hasFocus: () -> Boolean) { fun stop() { if (!active) return active = false + handler.removeCallbacks(captureTimeout) + capture?.let { capture = null; it(null) } clipboard.removePrimaryClipChangedListener(androidListener) WaylandCompositor.clearClipboardListener(guestListener) handler.removeCallbacksAndMessages(null) diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt index a7541e2619..9c314ade25 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt @@ -351,6 +351,8 @@ object SessionPrefs { } const val PC_KEYBOARD_SIZE_DEFAULT = 47 + const val WOW_CHAT_VOICE = "voice" + const val WOW_CHAT_KEYBOARD = "keyboard" val PC_KEYBOARD_SIZE_RANGE = 25..70 const val PC_KEYBOARD_OPACITY_DEFAULT = 100 val PC_KEYBOARD_OPACITY_RANGE = 30..100 @@ -362,6 +364,13 @@ object SessionPrefs { prefs(context).edit().putInt("pcKeyboardSize", percent.coerceIn(PC_KEYBOARD_SIZE_RANGE)).apply() } + fun wowChatInput(context: Context): String? = + prefs(context).getString("wowChatInput", null)?.takeIf { it == WOW_CHAT_VOICE || it == WOW_CHAT_KEYBOARD } + + fun setWowChatInput(context: Context, mode: String?) { + prefs(context).edit().apply { if (mode == null) remove("wowChatInput") else putString("wowChatInput", mode) }.apply() + } + fun pcKeyboardOpacity(context: Context): Int = prefs(context).getInt("pcKeyboardOpacity", PC_KEYBOARD_OPACITY_DEFAULT).takeIf { it in PC_KEYBOARD_OPACITY_RANGE } ?: PC_KEYBOARD_OPACITY_DEFAULT diff --git a/app/src/main/java/com/droiddeck/launcher/ui/BottomScreenTyping.kt b/app/src/main/java/com/droiddeck/launcher/ui/BottomScreenTyping.kt index 50f62b8cfd..faac0ed580 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/BottomScreenTyping.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/BottomScreenTyping.kt @@ -11,6 +11,7 @@ import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Button import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedButton import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -110,7 +111,16 @@ internal class BottomScreenTextInput(private val fallback: TextInputService) : P } @Composable -internal fun TypingPanel(request: TypingRequest, onDone: () -> Unit) { +internal fun TypingPanel( + request: TypingRequest, + modifier: Modifier = Modifier.fillMaxSize(), + title: String = stringResource(R.string.dual_typing_title), + done: String = stringResource(R.string.dual_typing_done), + onCancel: (() -> Unit)? = null, + leading: (@Composable () -> Unit)? = null, + showKeyboard: Boolean = true, + onDone: () -> Unit, +) { val colors = MaterialTheme.colorScheme var field by remember(request) { mutableStateOf(request.value) } LaunchedEffect(request.value) { @@ -120,19 +130,22 @@ internal fun TypingPanel(request: TypingRequest, onDone: () -> Unit) { val keyboard = LocalSoftwareKeyboardController.current LaunchedEffect(request) { kotlinx.coroutines.delay(120) + if (!showKeyboard) return@LaunchedEffect runCatching { focus.requestFocus() } keyboard?.show() } val options = request.imeOptions val secret = options.keyboardType == KeyboardType.Password || options.keyboardType == KeyboardType.NumberPassword Column( - Modifier.fillMaxSize().background(colors.background).padding(horizontal = 20.dp, vertical = 14.dp), + modifier.background(colors.background).padding(horizontal = 20.dp, vertical = 14.dp), verticalArrangement = Arrangement.spacedBy(10.dp), ) { - Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) { - Text(stringResource(R.string.dual_typing_title), fontSize = 15.sp, fontWeight = FontWeight.SemiBold, + Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { + leading?.invoke() + Text(title, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant, modifier = Modifier.weight(1f)) - Button(onClick = onDone, modifier = Modifier.testTag("dual-typing-done")) { Text(stringResource(R.string.dual_typing_done)) } + if (onCancel != null) OutlinedButton(onClick = onCancel, modifier = Modifier.testTag("dual-typing-cancel")) { Text(stringResource(R.string.common_cancel)) } + Button(onClick = onDone, modifier = Modifier.testTag("dual-typing-done")) { Text(done) } } OutlinedTextField( value = field, diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndWidgets.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndWidgets.kt index 2ec816eb12..f12ad81ddb 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndWidgets.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndWidgets.kt @@ -56,6 +56,7 @@ import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.rotate import androidx.compose.ui.graphics.Brush +import androidx.compose.ui.focus.focusProperties import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.semantics.Role @@ -150,6 +151,27 @@ internal fun Chip(t: String, ok: Boolean) { @Composable internal fun rememberHot(src: MutableInteractionSource): Boolean = src.collectIsFocusedAsState().value || src.collectIsHoveredAsState().value +@Composable +internal fun DialogToggleRow(label: String, checked: Boolean, onChange: (Boolean) -> Unit) { + val pal = LocalPalette.current + val src = remember { MutableInteractionSource() } + val hot = rememberHot(src) + val flip = { onChange(!checked) } + Row( + verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp), + modifier = Modifier.fillMaxWidth().clip(Shape12) + .background(if (hot) pal.signal.copy(alpha = 0.12f) else Color.Transparent) + .border(if (hot) 2.dp else 1.dp, if (hot) pal.signal else pal.line, Shape12) + .hoverable(src) + .clickable(interactionSource = src, indication = null, role = Role.Switch, onClick = flip) + .controllerConfirm(onClick = flip) + .padding(start = 14.dp, end = 4.dp), + ) { + Text(label, fontSize = 14.sp, color = MaterialTheme.colorScheme.onBackground, modifier = Modifier.weight(1f)) + ToggleSwitch(checked, label = label, modifier = Modifier.focusProperties { canFocus = false }) { onChange(it) } + } +} + @Composable internal fun PrimaryButton( text: String, diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SecondScreenPresentation.kt b/app/src/main/java/com/droiddeck/launcher/ui/SecondScreenPresentation.kt index 4e738716fc..bd89179663 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SecondScreenPresentation.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SecondScreenPresentation.kt @@ -46,6 +46,8 @@ class SecondScreenPresentation( private val frame = FrameLayout(context) private var menuView: androidx.compose.ui.platform.ComposeView? = null private var dashboardView: androidx.compose.ui.platform.ComposeView? = null + private var chatView: androidx.compose.ui.platform.ComposeView? = null + private var chatLost: (() -> Unit)? = null var menuShown = false private set private val root = LinearLayout(context).apply { @@ -78,7 +80,7 @@ class SecondScreenPresentation( if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { root.setOnApplyWindowInsetsListener { view, insets -> if (insets.isVisible(WindowInsets.Type.ime())) imeSeen = true - else if (imeSeen) keyboardClosed() + else if (imeSeen && chatView == null) keyboardClosed() view.onApplyWindowInsets(insets) } } @@ -128,6 +130,37 @@ class SecondScreenPresentation( if (created && isShowing && currentMode == SecondScreenMode.TERMINAL && terminalPanel?.ready != true) renderMode() } + fun showChat(onLost: () -> Unit, content: @androidx.compose.runtime.Composable () -> Unit) { + if (!showsKeyboard || chatView != null) return + keyboardHost?.takeIf { it.shown }?.hide() + keyboardShown.value = false + keyboardPending = false + fieldKeyboard = false + chatLost = onLost + ownComposeViews() + val view = androidx.compose.ui.platform.ComposeView(context).apply { + isFocusable = true + isFocusableInTouchMode = true + setContent { content() } + } + chatView = view + root.addView(view, 1.coerceAtMost(root.childCount), LinearLayout.LayoutParams(-1, -2)) + } + + fun hideChat() { + chatLost = null + dropChat() + } + + private fun dropChat() { + val view = chatView ?: return + chatView = null + chatLost?.let { lost -> chatLost = null; sessionActivity.runOnUiThread(lost) } + imeSeen = false + root.removeView(view) + view.disposeComposition() + } + val showsKeyboard: Boolean get() = isShowing && !menuShown && currentMode == SecondScreenMode.KEYBOARD_TRACKPAD val showsControls: Boolean get() = isShowing && currentMode != SecondScreenMode.NONE @@ -178,6 +211,7 @@ class SecondScreenPresentation( showMenu(false) closeDashboard() closeTerminal() + dropChat() keyboardHost?.hide() keyboardHost = null dismiss() @@ -212,6 +246,7 @@ class SecondScreenPresentation( } private fun renderMode() { + dropChat() fieldKeyboard = false keyboardHost?.hide() keyboardHost = null diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt b/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt index 92074c314e..17409c85bc 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt @@ -264,6 +264,9 @@ class DrawerActions( val onImportLossless: () -> Unit, val onKeyboard: () -> Unit, val onHardwareKeyboard: () -> Unit, + val wowChatShown: Boolean = false, + val wowChat: String? = null, + val onWowChat: (String?) -> Unit = {}, val onSteamMenu: (() -> Unit)?, val onQam: (() -> Unit)?, val onAchievements: (() -> Unit)? = null, @@ -698,6 +701,15 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont host.open = null; a.onKeyboard() } } + if (a.wowChatShown) ChoiceRow( + host, "wow-chat", stringResource(R.string.wow_chat_title), null, + listOf( + null to stringResource(R.string.wow_chat_ask), + SessionPrefs.WOW_CHAT_VOICE to stringResource(R.string.wow_chat_voice), + SessionPrefs.WOW_CHAT_KEYBOARD to stringResource(R.string.pckb_android), + ), + a.wowChat, chipModifier = focus.track(page, "wow-chat"), onPick = a.onWowChat, + ) val keyboardContext = LocalContext.current remember { PcKeyboardPrefs.load(keyboardContext) } SliderRow( diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SlowUsbDialog.kt b/app/src/main/java/com/droiddeck/launcher/ui/SlowUsbDialog.kt index 6ba15e324c..6c86d5589b 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SlowUsbDialog.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SlowUsbDialog.kt @@ -1,14 +1,8 @@ package com.droiddeck.launcher.ui -import androidx.compose.foundation.background -import androidx.compose.foundation.border -import androidx.compose.foundation.clickable -import androidx.compose.foundation.hoverable -import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Usb @@ -18,12 +12,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.remember -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.focus.focusProperties -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.semantics.Role import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.res.stringResource @@ -48,23 +37,7 @@ internal fun SlowUsbDialog(drive: UsbLink.SlowDrive, never: Boolean, onNever: (B stringResource(message, drive.name, UsbLink.generation(drive.mbps), speed, UsbLink.megabytesPerSecond(drive.mbps)), fontSize = 13.sp, lineHeight = 18.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, ) - val pal = LocalPalette.current - val src = remember { MutableInteractionSource() } - val hot = rememberHot(src) - val flip = { onNever(!never) } - Row( - verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp), - modifier = Modifier.fillMaxWidth().clip(Shape12) - .background(if (hot) pal.signal.copy(alpha = 0.12f) else Color.Transparent) - .border(if (hot) 2.dp else 1.dp, if (hot) pal.signal else pal.line, Shape12) - .hoverable(src) - .clickable(interactionSource = src, indication = null, role = Role.Switch, onClick = flip) - .controllerConfirm(onClick = flip) - .padding(start = 14.dp, end = 4.dp), - ) { - Text(stringResource(R.string.slow_usb_never), fontSize = 14.sp, color = MaterialTheme.colorScheme.onBackground, modifier = Modifier.weight(1f)) - ToggleSwitch(never, label = stringResource(R.string.slow_usb_never), modifier = Modifier.focusProperties { canFocus = false }) { onNever(it) } - } + DialogToggleRow(stringResource(R.string.slow_usb_never), never, onNever) Row(horizontalArrangement = Arrangement.End, modifier = Modifier.fillMaxWidth()) { PrimaryButton(stringResource(R.string.slow_usb_dismiss), modifier = Modifier.focusRequester(focus), onClick = close) } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/WowChat.kt b/app/src/main/java/com/droiddeck/launcher/ui/WowChat.kt new file mode 100644 index 0000000000..b2a2dd3847 --- /dev/null +++ b/app/src/main/java/com/droiddeck/launcher/ui/WowChat.kt @@ -0,0 +1,230 @@ +package com.droiddeck.launcher.ui + +import android.Manifest +import android.content.Context +import android.content.Intent +import android.content.pm.PackageManager +import android.os.Bundle +import android.speech.RecognitionListener +import android.speech.RecognizerIntent +import android.speech.SpeechRecognizer +import android.widget.Toast +import androidx.activity.compose.BackHandler +import androidx.activity.compose.rememberLauncherForActivityResult +import androidx.activity.result.contract.ActivityResultContracts +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Mic +import androidx.compose.material3.FilledIconToggleButton +import androidx.compose.material3.Icon +import androidx.compose.runtime.Composable +import androidx.compose.runtime.DisposableEffect +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.testTag +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.TextRange +import androidx.compose.ui.text.input.ImeAction +import androidx.compose.ui.text.input.ImeOptions +import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.unit.dp +import com.droiddeck.launcher.R +import com.droiddeck.launcher.session.SessionPrefs + +class WowChat( + private val context: Context, + private val onSend: (String, Boolean) -> Unit, + private val onCancel: () -> Unit, + private val readField: ((String?) -> Unit) -> Unit = {}, +) { + var request by mutableStateOf(null) + private set + var asking by mutableStateOf(false) + private set + var listening by mutableStateOf(false) + private set + var voice by mutableStateOf(false) + private set + var remembered by mutableStateOf(SessionPrefs.wowChatInput(context)) + private set + private var recognizer: SpeechRecognizer? = null + private var spokenBase = "" + private var fieldRead = false + + val open: Boolean get() = request != null || asking + + fun chatOpened() { + if (open) return + when (val mode = remembered) { + null -> asking = true + else -> start(mode) + } + } + + fun chatClosed() { + asking = false + finish() + } + + fun pick(mode: String, remember: Boolean) { + asking = false + if (remember) choose(mode) + start(mode) + } + + fun choose(mode: String?) { + SessionPrefs.setWowChatInput(context, mode) + remembered = SessionPrefs.wowChatInput(context) + } + + fun dismissChoice() { + asking = false + onCancel() + } + + fun send() { + val text = request?.value?.text.orEmpty() + val replace = fieldRead + finish() + onSend(text, replace) + } + + fun cancel() { + finish() + onCancel() + } + + private fun start(mode: String) { + voice = mode == SessionPrefs.WOW_CHAT_VOICE && voiceAvailable(context) + if (mode == SessionPrefs.WOW_CHAT_VOICE && !voice) Toast.makeText(context, R.string.wow_chat_voice_unavailable, Toast.LENGTH_SHORT).show() + val opened = TypingRequest(TextFieldValue(""), ImeOptions(singleLine = true, imeAction = ImeAction.Send), {}, {}) + fieldRead = false + request = opened + readField { text -> + if (request === opened && !text.isNullOrEmpty() && opened.value.text.isEmpty()) { + fieldRead = true + opened.value = TextFieldValue(text, TextRange(text.length)) + if (recognizer != null) spokenBase = "${text.trimEnd()} " + } + } + } + + private fun finish() { + stopListening() + request = null + voice = false + } + + fun listen() { + val active = request ?: return + stopListening() + val speech = runCatching { SpeechRecognizer.createSpeechRecognizer(context) }.getOrNull() ?: return + recognizer = speech + spokenBase = active.value.text.trimEnd().let { if (it.isEmpty()) it else "$it " } + speech.setRecognitionListener(object : RecognitionListener { + override fun onReadyForSpeech(params: Bundle?) { listening = true } + override fun onBeginningOfSpeech() {} + override fun onRmsChanged(rmsdB: Float) {} + override fun onBufferReceived(buffer: ByteArray?) {} + override fun onEndOfSpeech() {} + override fun onError(error: Int) { if (recognizer === speech) stopListening() } + override fun onResults(results: Bundle?) { + if (recognizer !== speech) return + heard(results) + stopListening() + } + override fun onPartialResults(partialResults: Bundle?) { if (recognizer === speech) heard(partialResults) } + override fun onEvent(eventType: Int, params: Bundle?) {} + }) + val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH) + .putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM) + .putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true) + .putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.packageName) + runCatching { speech.startListening(intent) }.onFailure { stopListening() } + } + + private fun heard(results: Bundle?) { + val spoken = results?.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)?.firstOrNull()?.takeIf { it.isNotBlank() } ?: return + val text = spokenBase + spoken + request?.value = TextFieldValue(text, TextRange(text.length)) + } + + fun stopListening() { + listening = false + val speech = recognizer ?: return + recognizer = null + runCatching { speech.cancel() } + runCatching { speech.destroy() } + } + + companion object { + private val PROGRAM = Regex("wow[\\w-]*\\.exe", RegexOption.IGNORE_CASE) + + fun isWow(program: String?): Boolean = program != null && PROGRAM.matches(program) + + fun voiceAvailable(context: Context): Boolean = SpeechRecognizer.isRecognitionAvailable(context) + } +} + +@Composable +internal fun WowChatPanel(chat: WowChat, modifier: Modifier = Modifier.fillMaxWidth()) { + val request = chat.request ?: return + val context = LocalContext.current + val mic = rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) { granted -> + if (granted) chat.listen() else Toast.makeText(context, R.string.wow_chat_mic_denied, Toast.LENGTH_SHORT).show() + } + val listen = { + if (context.checkSelfPermission(Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED) chat.listen() + else mic.launch(Manifest.permission.RECORD_AUDIO) + } + LaunchedEffect(request) { if (chat.voice) listen() } + DisposableEffect(request) { onDispose { chat.stopListening() } } + BackHandler(onBack = chat::cancel) + TypingPanel( + request, modifier, + title = stringResource(if (chat.listening) R.string.wow_chat_listening else R.string.wow_chat_title), + done = stringResource(R.string.wow_chat_send), + onCancel = chat::cancel, + showKeyboard = !chat.voice, + leading = if (WowChat.voiceAvailable(context)) ({ + FilledIconToggleButton( + checked = chat.listening, + onCheckedChange = { on -> if (on) listen() else chat.stopListening() }, + modifier = Modifier.testTag("wow-chat-mic"), + ) { Icon(Icons.Filled.Mic, stringResource(R.string.wow_chat_voice)) } + }) else null, + onDone = chat::send, + ) +} + +@Composable +internal fun WowChatChoiceDialog(chat: WowChat) { + var remember by remember { mutableStateOf(true) } + var picked by remember { mutableStateOf(null) } + val shown = rememberShown { + val mode = picked + if (mode != null) chat.pick(mode, remember) else chat.dismissChoice() + } + val close = { shown.targetState = false } + val choose = { mode: String -> picked = mode; close() } + val focus = remember { FocusRequester() } + LaunchedEffect(Unit) { runCatching { focus.requestFocus() } } + AppDialog(shown, close, "wowChat", wide = false, maxWidth = 520.dp) { + DialogTitleRow(stringResource(R.string.wow_chat_title), close) + DialogToggleRow(stringResource(R.string.wow_chat_remember), remember) { remember = it } + Row(horizontalArrangement = Arrangement.spacedBy(10.dp, androidx.compose.ui.Alignment.End), modifier = Modifier.fillMaxWidth()) { + SecondaryButton(stringResource(R.string.pckb_android), modifier = Modifier.testTag("wow-chat-keyboard")) { choose(SessionPrefs.WOW_CHAT_KEYBOARD) } + PrimaryButton(stringResource(R.string.wow_chat_voice), icon = Icons.Filled.Mic, + modifier = Modifier.focusRequester(focus).testTag("wow-chat-voice")) { choose(SessionPrefs.WOW_CHAT_VOICE) } + } + } +} diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 16f0619db6..5b1426b750 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -3829,4 +3829,12 @@ الحالة الشركاء الألعاب المتابَعة + إدخال الدردشة + الكتابة بالصوت + تذكّر هذا الاختيار + السؤال في كل مرة + إرسال + جارٍ الاستماع… + الكتابة بالصوت غير متاحة على هذا الجهاز. + يلزم الوصول إلى الميكروفون للكتابة بالصوت. diff --git a/app/src/main/res/values-b+es+419/strings.xml b/app/src/main/res/values-b+es+419/strings.xml index 8b1721bc10..4b54a8daa2 100644 --- a/app/src/main/res/values-b+es+419/strings.xml +++ b/app/src/main/res/values-b+es+419/strings.xml @@ -3685,4 +3685,12 @@ Estado Socios Juegos seguidos + Entrada del chat + Dictado por voz + Recordar esta selección + Preguntar cada vez + Enviar + Escuchando… + El dictado por voz no está disponible en este dispositivo. + Se necesita acceso al micrófono para el dictado por voz. diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 358d75a9aa..f3cadc899b 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -3673,4 +3673,12 @@ Статус Партньори Следвани игри + Въвеждане в чата + Гласово въвеждане + Запомни този избор + Питай всеки път + Изпрати + Слушане… + Гласовото въвеждане не е налично на това устройство. + За гласово въвеждане е нужен достъп до микрофона. diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 6754288b86..c6e35ae37a 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -3751,4 +3751,12 @@ Stav Partneři Sledované hry + Zadávání do chatu + Hlasové psaní + Zapamatovat tuto volbu + Pokaždé se zeptat + Odeslat + Poslouchám… + Hlasové psaní není na tomto zařízení k dispozici. + Pro hlasové psaní je potřeba přístup k mikrofonu. diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index ea071e368d..e93dd58db8 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -3673,4 +3673,12 @@ Status Partnere Fulgte spil + Chatinput + Stemmeindtastning + Husk dette valg + Spørg hver gang + Send + Lytter… + Stemmeindtastning er ikke tilgængelig på denne enhed. + Mikrofonadgang er nødvendig for stemmeindtastning. diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 80592b9cf9..e00048becf 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -3673,4 +3673,12 @@ Status Partner Gefolgte Spiele + Chat-Eingabe + Spracheingabe + Diese Auswahl merken + Jedes Mal fragen + Senden + Hört zu… + Spracheingabe ist auf diesem Gerät nicht verfügbar. + Für die Spracheingabe wird Mikrofonzugriff benötigt. diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index ed95ca732b..8c1f1f43ff 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -3673,4 +3673,12 @@ Κατάσταση Συνεργάτες Παιχνίδια που ακολουθείτε + Εισαγωγή συνομιλίας + Φωνητική πληκτρολόγηση + Απομνημόνευση αυτής της επιλογής + Ερώτηση κάθε φορά + Αποστολή + Ακρόαση… + Η φωνητική πληκτρολόγηση δεν είναι διαθέσιμη σε αυτή τη συσκευή. + Απαιτείται πρόσβαση στο μικρόφωνο για φωνητική πληκτρολόγηση. diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index ec88bde659..52be78eafb 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -3712,4 +3712,12 @@ Estado Socios Juegos seguidos + Entrada del chat + Dictado por voz + Recordar esta selección + Preguntar cada vez + Enviar + Escuchando… + El dictado por voz no está disponible en este dispositivo. + Se necesita acceso al micrófono para el dictado por voz. diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 99d8f2927e..a413c8d9ac 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -3673,4 +3673,12 @@ Tila Kumppanit Seuratut pelit + Chatin syöttö + Puhekirjoitus + Muista tämä valinta + Kysy joka kerta + Lähetä + Kuunnellaan… + Puhekirjoitus ei ole käytettävissä tällä laitteella. + Puhekirjoitus vaatii mikrofonin käyttöoikeuden. diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index c1f038b346..5009c3e5a6 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -3712,4 +3712,12 @@ Statut Partenaires Jeux suivis + Saisie du chat + Saisie vocale + Mémoriser ce choix + Demander à chaque fois + Envoyer + Écoute… + La saisie vocale n\'est pas disponible sur cet appareil. + L\'accès au micro est nécessaire pour la saisie vocale. diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index b93df883c4..edf039eeba 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -3673,4 +3673,12 @@ स्थिति पार्टनर फ़ॉलो किए गए गेम + चैट इनपुट + आवाज़ से टाइप करें + यह चुनाव याद रखें + हर बार पूछें + भेजें + सुन रहा है… + इस डिवाइस पर आवाज़ से टाइपिंग उपलब्ध नहीं है। + आवाज़ से टाइपिंग के लिए माइक्रोफ़ोन की अनुमति चाहिए। diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index c5c237894f..0ac1a8beca 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -3673,4 +3673,12 @@ Állapot Partnerek Követett játékok + Csevegés bevitele + Hangalapú gépelés + Választás megjegyzése + Kérdezzen minden alkalommal + Küldés + Figyelés… + A hangalapú gépelés nem érhető el ezen az eszközön. + A hangalapú gépeléshez mikrofon-hozzáférés szükséges. diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index ae21a832e2..a2db31f53e 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -3643,4 +3643,12 @@ Status Mitra Game yang diikuti + Input obrolan + Ketik dengan suara + Ingat pilihan ini + Tanya setiap kali + Kirim + Mendengarkan… + Ketik dengan suara tidak tersedia di perangkat ini. + Akses mikrofon diperlukan untuk mengetik dengan suara. diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 8b398a0bf0..d3d5045a05 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -3712,4 +3712,12 @@ Stato Partner Giochi seguiti + Input della chat + Digitazione vocale + Ricorda questa scelta + Chiedi ogni volta + Invia + In ascolto… + La digitazione vocale non è disponibile su questo dispositivo. + Per la digitazione vocale serve l\'accesso al microfono. diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index bc94884bc4..7c959249fa 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -3643,4 +3643,12 @@ ステータス パートナー フォロー中のゲーム + チャット入力 + 音声入力 + この選択を記憶する + 毎回確認する + 送信 + 聞き取り中… + このデバイスでは音声入力を使用できません。 + 音声入力にはマイクへのアクセスが必要です。 diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index a95aee40d6..3ecd46598f 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -3643,4 +3643,12 @@ 상태 파트너 팔로우한 게임 + 채팅 입력 + 음성 입력 + 이 선택 기억하기 + 매번 묻기 + 보내기 + 듣는 중… + 이 기기에서는 음성 입력을 사용할 수 없습니다. + 음성 입력을 하려면 마이크 접근 권한이 필요합니다. diff --git a/app/src/main/res/values-ms/strings.xml b/app/src/main/res/values-ms/strings.xml index 31ef4ac49a..12666f1644 100644 --- a/app/src/main/res/values-ms/strings.xml +++ b/app/src/main/res/values-ms/strings.xml @@ -3643,4 +3643,12 @@ Status Rakan kongsi Permainan diikuti + Input sembang + Taip dengan suara + Ingat pilihan ini + Tanya setiap kali + Hantar + Mendengar… + Taip dengan suara tidak tersedia pada peranti ini. + Akses mikrofon diperlukan untuk menaip dengan suara. diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index a043a54e44..191e8e54b5 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -3673,4 +3673,12 @@ Status Partnere Fulgte spill + Chatinndata + Taleinntasting + Husk dette valget + Spør hver gang + Send + Lytter… + Taleinntasting er ikke tilgjengelig på denne enheten. + Mikrofontilgang trengs for taleinntasting. diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 35c7869b43..47b574eb88 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -3673,4 +3673,12 @@ Status Partners Gevolgde games + Chatinvoer + Spraakinvoer + Deze keuze onthouden + Elke keer vragen + Verzenden + Luisteren… + Spraakinvoer is niet beschikbaar op dit apparaat. + Voor spraakinvoer is toegang tot de microfoon nodig. diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index d2a2215b0a..8982560cb1 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -3751,4 +3751,12 @@ Status Partnerzy Obserwowane gry + Wpisywanie na czacie + Pisanie głosowe + Zapamiętaj ten wybór + Pytaj za każdym razem + Wyślij + Słucham… + Pisanie głosowe nie jest dostępne na tym urządzeniu. + Pisanie głosowe wymaga dostępu do mikrofonu. diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index a9e731fdbf..38ab08a785 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -3712,4 +3712,12 @@ Estado Parceiros Jogos seguidos + Introdução no chat + Escrita por voz + Lembrar esta escolha + Perguntar sempre + Enviar + A ouvir… + A escrita por voz não está disponível neste dispositivo. + É necessário acesso ao microfone para a escrita por voz. diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index d7fbad21ab..7b5faee1fd 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -3712,4 +3712,12 @@ Status Parceiros Jogos seguidos + Entrada do chat + Digitação por voz + Lembrar esta escolha + Perguntar sempre + Enviar + Ouvindo… + A digitação por voz não está disponível neste dispositivo. + É preciso acesso ao microfone para a digitação por voz. diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index d1063b3e66..747948cc26 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -3712,4 +3712,12 @@ Stare Parteneri Jocuri urmărite + Introducere în chat + Tastare vocală + Ține minte această alegere + Întreabă de fiecare dată + Trimite + Se ascultă… + Tastarea vocală nu este disponibilă pe acest dispozitiv. + Pentru tastarea vocală este necesar accesul la microfon. diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index d439181311..65220e106a 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -3834,4 +3834,12 @@ Статус Партнёры Отслеживаемые игры + Ввод в чат + Голосовой ввод + Запомнить этот выбор + Спрашивать каждый раз + Отправить + Слушаю… + Голосовой ввод недоступен на этом устройстве. + Для голосового ввода нужен доступ к микрофону. diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 9974ee7e40..f2c4b11c2b 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -3673,4 +3673,12 @@ Status Partner Följda spel + Chattinmatning + Röstinmatning + Kom ihåg det här valet + Fråga varje gång + Skicka + Lyssnar… + Röstinmatning är inte tillgänglig på den här enheten. + Mikrofonåtkomst krävs för röstinmatning. diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 918e464e95..f05a5158e0 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -3643,4 +3643,12 @@ สถานะ พาร์ตเนอร์ เกมที่ติดตาม + การป้อนแชท + พิมพ์ด้วยเสียง + จดจำตัวเลือกนี้ + ถามทุกครั้ง + ส่ง + กำลังฟัง… + อุปกรณ์นี้ไม่รองรับการพิมพ์ด้วยเสียง + ต้องอนุญาตให้เข้าถึงไมโครโฟนเพื่อพิมพ์ด้วยเสียง diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index a216eba5c4..9e95d2f134 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -3673,4 +3673,12 @@ Durum Ortaklar Takip edilen oyunlar + Sohbet girişi + Sesle yazma + Bu seçimi hatırla + Her seferinde sor + Gönder + Dinleniyor… + Sesle yazma bu cihazda kullanılamıyor. + Sesle yazma için mikrofon erişimi gerekiyor. diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index ba1e2c40cd..2a82143256 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -3751,4 +3751,12 @@ Статус Партнери Ігри, за якими ви стежите + Введення в чат + Голосове введення + Запам\'ятати цей вибір + Питати щоразу + Надіслати + Слухаю… + Голосове введення недоступне на цьому пристрої. + Для голосового введення потрібен доступ до мікрофона. diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 67fce23953..8a4f6cc4c5 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -3643,4 +3643,12 @@ Trạng thái Đối tác Game đang theo dõi + Nhập trò chuyện + Nhập bằng giọng nói + Ghi nhớ lựa chọn này + Hỏi mỗi lần + Gửi + Đang nghe… + Thiết bị này không hỗ trợ nhập bằng giọng nói. + Cần quyền truy cập micrô để nhập bằng giọng nói. diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 3741cc7a20..d2b7610f8a 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -3647,4 +3647,12 @@ 状态 合作伙伴 已关注的游戏 + 聊天输入 + 语音输入 + 记住此选择 + 每次询问 + 发送 + 正在聆听… + 此设备不支持语音输入。 + 语音输入需要麦克风权限。 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 13d936163e..7b176d7c14 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -3646,4 +3646,12 @@ GPU 透過 Mali 橋接 透過 Mali 橋接執行,使用手機內建的 Vulkan 驅動程式 關閉 Mali 橋接時不受支援:Turnip 需要 Adreno(Snapdragon)GPU + 聊天輸入 + 語音輸入 + 記住此選擇 + 每次詢問 + 傳送 + 正在聆聽… + 此裝置不支援語音輸入。 + 語音輸入需要咪高峰權限。 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 36d9e27c97..d32c71feb4 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -3646,4 +3646,12 @@ GPU 透過 Mali 橋接 透過 Mali 橋接執行,使用手機內建的 Vulkan 驅動程式 關閉 Mali 橋接時不受支援:Turnip 需要 Adreno(Snapdragon)GPU + 聊天輸入 + 語音輸入 + 記住此選擇 + 每次詢問 + 傳送 + 正在聆聽… + 此裝置不支援語音輸入。 + 語音輸入需要麥克風權限。 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cc711e86e6..c1bcfd576c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3831,4 +3831,12 @@ Status Partners Followed games + Chat input + Voice type + Remember this selection + Ask each time + Send + Listening… + Voice typing is not available on this device. + Microphone access is needed for voice typing. diff --git a/app/src/test/java/com/droiddeck/launcher/ui/WowChatTest.kt b/app/src/test/java/com/droiddeck/launcher/ui/WowChatTest.kt new file mode 100644 index 0000000000..bb82e3ef89 --- /dev/null +++ b/app/src/test/java/com/droiddeck/launcher/ui/WowChatTest.kt @@ -0,0 +1,21 @@ +package com.droiddeck.launcher.ui + +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Test + +class WowChatTest { + @Test + fun everyWowClientMatches() { + listOf("wow.exe", "Wow.exe", "wowclassic.exe", "wowclassict.exe", "wowb.exe", "wow-64.exe", "wow-arm64.exe", "wowt.exe").forEach { + assertTrue(it, WowChat.isWow(it)) + } + } + + @Test + fun otherProgramsAreUnaffected() { + listOf(null, "", "battle.net.exe", "steam.exe", "notwow.exe", "wow.exe.bak", "wow", "cyberpunk2077.exe").forEach { + assertFalse(it.toString(), WowChat.isWow(it)) + } + } +}