Exemple #1
0
class YosemiteIme(CustomIme):
    """
    Yosemite Input Method Class Object
    """
    def __init__(self, adb):
        super(YosemiteIme, self).__init__(adb, None, YOSEMITE_IME_SERVICE)
        self.yosemite = Yosemite(adb)

    def text(self, value):
        """
        Input text with Yosemite input method

        Args:
            value: text to be inputted

        Returns:
            output form `adb shell` command

        """
        self.yosemite.get_ready()
        if not self.started:
            self.start()
        # 更多的输入用法请见 https://github.com/macacajs/android-unicode#use-in-adb-shell
        value = ensure_unicode(value)
        self.adb.shell(
            u"am broadcast -a ADB_INPUT_TEXT --es msg '{}'".format(value))
Exemple #2
0
class YosemiteIme(CustomIme):
    """
    Yosemite Input Method Class Object
    """
    def __init__(self, adb):
        super(YosemiteIme, self).__init__(adb, None, YOSEMITE_IME_SERVICE)
        self.yosemite = Yosemite(adb)

    def start(self):
        self.yosemite.get_ready()
        super(YosemiteIme, self).start()

    def text(self, value):
        """
        Input text with Yosemite input method

        Args:
            value: text to be inputted

        Returns:
            output form `adb shell` command

        """
        if not self.started:
            self.start()
        # 更多的输入用法请见 https://github.com/macacajs/android-unicode#use-in-adb-shell
        value = ensure_unicode(value)
        self.adb.shell(
            u"am broadcast -a ADB_INPUT_TEXT --es msg '{}'".format(value))

    def code(self, code):
        """
        Sending editor action

        Args:
            code: editor action code, e.g., 2 = IME_ACTION_GO, 3 = IME_ACTION_SEARCH
                Editor Action Code Ref: http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html

        Returns:
            output form `adb shell` command

        """
        if not self.started:
            self.start()
        self.adb.shell("am broadcast -a ADB_EDITOR_CODE --ei code {}".format(
            str(code)))
Exemple #3
0
 def __init__(self, adb):
     super(YosemiteIme, self).__init__(adb, None, YOSEMITE_IME_SERVICE)
     self.yosemite = Yosemite(adb)