Skip to content

Commit

Permalink
deal with spaces in input text
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchun-li committed Jul 12, 2023
1 parent a9fedcf commit c958a0b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion droidbot/adapter/droidbot_ime.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def input_text(self, text, mode=0):
:param text: text to input, can be unicode format
:param mode: 0 - set text; 1 - append text.
"""
input_cmd = "am broadcast -a DROIDBOT_INPUT_TEXT --es text \"%s\" --ei mode %d" % (text, mode)
text_nospace = text.replace(' ', '--')
input_cmd = 'am broadcast -a DROIDBOT_INPUT_TEXT --es text %s --ei mode %d' % (text_nospace, mode)
self.device.adb.shell(str(input_cmd))


Expand Down
2 changes: 1 addition & 1 deletion droidbot/device_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def get_possible_input(self):

for view_id in enabled_view_ids:
if self.__safe_dict_get(self.views[view_id], 'editable'):
possible_events.append(SetTextEvent(view=self.views[view_id], text="HelloWorld"))
possible_events.append(SetTextEvent(view=self.views[view_id], text="Hello World"))
touch_exclude_view_ids.add(view_id)
# TODO figure out what event can be sent to editable views
pass
Expand Down
Binary file modified droidbot/resources/droidbotApp.apk
Binary file not shown.

0 comments on commit c958a0b

Please sign in to comment.