From 92b261e00078ec8ad492f4a0d38b9c0a9f7de057 Mon Sep 17 00:00:00 2001 From: DevEmperor <56255079+devemperor@users.noreply.github.com> Date: Fri, 5 Jul 2024 17:11:11 +0200 Subject: [PATCH] feature: long-click on switch button opens InputMethodPicker (#1) --- .../net/devemperor/dictate/DictateInputMethodService.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/net/devemperor/dictate/DictateInputMethodService.java b/app/src/main/java/net/devemperor/dictate/DictateInputMethodService.java index 77fd09d..0142035 100644 --- a/app/src/main/java/net/devemperor/dictate/DictateInputMethodService.java +++ b/app/src/main/java/net/devemperor/dictate/DictateInputMethodService.java @@ -22,6 +22,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.inputmethod.InputConnection; +import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.TextView; @@ -212,6 +213,12 @@ public void run() { } }); + switchButton.setOnLongClickListener(v -> { + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + if (imm != null) imm.showInputMethodPicker(); + return true; + }); + spaceButton.setOnClickListener(v -> { vibrate();