add: auto() function and two mode of fetching rootInActiveWindow

This commit is contained in:
hyb1996
2017-07-31 10:15:39 +08:00
parent dc9f8f417a
commit 33cdef21c6
13 changed files with 163 additions and 104 deletions

View File

@@ -1,18 +1,17 @@
__runtime__.init();
if(__engine_name__ == "rhino"){
__importClass__ = importClass;
var importClass = function(pack){
__importClass__ = importClass;
var importClass = function(pack){
if(typeof(pack) == "string"){
__importClass__(Packages[pack]);
}else{
__importClass__(pack);
}
}
var loadJar = function(path){
}
var loadJar = function(path){
__runtime__.loadJar(path);
}
}
__runtime__.bridges.setFunctionCaller(function(func, target, args){

View File

@@ -97,12 +97,28 @@ module.exports = function(__runtime__, scope){
}
automator.input = function(a, b){
if(arguments.length == 1){
return __runtime__.automator.appendText(__runtime__.automator.editable(-1), a);
}else{
return __runtime__.automator.appendText(__runtime__.automator.editable(a), b);
}
if(arguments.length == 1){
return __runtime__.automator.appendText(__runtime__.automator.editable(-1), a);
}else{
return __runtime__.automator.appendText(__runtime__.automator.editable(a), b);
}
}
var modes = {
"normal": 0,
"fast": 1
}
scope.auto = function(mode){
if(mode){
if(typeof(mode) !== "string"){
throw new TypeError("mode should be a string");
}
mode = modes[mode.toLowerCase()];
}
mode = mode || 0;
__runtime__.accessibilityBridge.setMode(mode);
}
scope.__asGlobal__(__runtime__.automator, ['back', 'home', 'powerDialog', 'notifications', 'quickSettings', 'recents', 'splitScreen']);
scope.__asGlobal__(automator, ['click', 'longClick', 'press', 'swipe', 'gesture', 'gestures', 'gestureAsync', 'gesturesAsync', 'scrollDown', 'scrollUp', 'input', 'setText']);

View File

@@ -16,7 +16,8 @@ module.exports = function(__runtime__, scope){
}
return function(){
return __runtime__.selector(scope.__engine__);
var s = __runtime__.selector(scope.__engine__);
return s;
};
}