mirror of
https://github.com/sui-feng-cb/AzurLaneAutoScript1.git
synced 2026-07-13 19:05:16 +08:00
Chore: abstract set_fastinput_ime method for EquipmentCodeHandler
This commit is contained in:
@@ -159,6 +159,14 @@ class EquipmentCodeHandler(StorageHandler):
|
|||||||
|
|
||||||
self.device.adb_shell(['input', 'keyevent', '4'])
|
self.device.adb_shell(['input', 'keyevent', '4'])
|
||||||
|
|
||||||
|
def set_fastinput_ime(self):
|
||||||
|
d = self.device.u2
|
||||||
|
try:
|
||||||
|
d.set_fastinput_ime(True)
|
||||||
|
except Exception:
|
||||||
|
logger.warning("FastInputIME not enabled, trying to enable it")
|
||||||
|
self.fastinput_ime_enable()
|
||||||
|
|
||||||
def _code_input(self, code):
|
def _code_input(self, code):
|
||||||
logger.info(f"Code input: {code}")
|
logger.info(f"Code input: {code}")
|
||||||
d = self.device.u2
|
d = self.device.u2
|
||||||
@@ -167,12 +175,7 @@ class EquipmentCodeHandler(StorageHandler):
|
|||||||
name, shown = d.current_ime()
|
name, shown = d.current_ime()
|
||||||
if shown:
|
if shown:
|
||||||
if name != 'com.github.uiautomator/.FastInputIME':
|
if name != 'com.github.uiautomator/.FastInputIME':
|
||||||
try:
|
self.set_fastinput_ime()
|
||||||
d.set_fastinput_ime(True)
|
|
||||||
continue
|
|
||||||
except Exception:
|
|
||||||
logger.warning("FastInputIME not enabled, trying to enable it")
|
|
||||||
self.fastinput_ime_enable()
|
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user