From 86044c5b69dc43a0733331b650b7767307b980ee Mon Sep 17 00:00:00 2001 From: guoh064 <50830808+guoh064@users.noreply.github.com> Date: Fri, 24 May 2024 16:09:17 +0800 Subject: [PATCH] Fix: ime not shown when enter input mode --- module/device/input.py | 4 ++++ module/device/method/uiautomator_2.py | 3 +++ module/equipment/equipment_code.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/module/device/input.py b/module/device/input.py index 02700d9f77..57bc2add75 100644 --- a/module/device/input.py +++ b/module/device/input.py @@ -3,6 +3,10 @@ class Input(Uiautomator2): + def ime_shown(self) -> bool: + _, shown = self.u2_current_ime() + return shown + def text_input_and_confirm(self, text: str, clear: bool=False): for fail_count in range(3): try: diff --git a/module/device/method/uiautomator_2.py b/module/device/method/uiautomator_2.py index 426f8ee680..6de8147cab 100644 --- a/module/device/method/uiautomator_2.py +++ b/module/device/method/uiautomator_2.py @@ -328,6 +328,9 @@ def u2_shell_background(self, cmdline, timeout=10) -> ShellBackgroundResponse: def u2_set_fastinput_ime(self, enable: bool): self.u2.set_fastinput_ime(enable) + def u2_current_ime(self): + return self.u2.current_ime() + def u2_send_keys(self, text: str, clear: bool=False): self.u2.send_keys(text=text, clear=clear) diff --git a/module/equipment/equipment_code.py b/module/equipment/equipment_code.py index 4d4925ff9b..7763b34327 100644 --- a/module/equipment/equipment_code.py +++ b/module/equipment/equipment_code.py @@ -171,7 +171,7 @@ def enter_equip_code_input_mode(self, skip_first_screenshot=True): continue # End - if not self.appear(EQUIPMENT_CODE_ENTER): + if self.device.ime_shown(): break def confirm_equip_code(self, skip_first_screenshot=False):