refactor: move some classes in package api to package core

This commit is contained in:
hyb1996
2017-10-27 19:46:31 +08:00
parent 19bbbe9fe1
commit 2c990e1966
53 changed files with 81 additions and 148 deletions

View File

@@ -47,4 +47,4 @@ require("__general__")(__runtime__, this);
})(__that__);
__importClass__(android.view.KeyEvent);
__importClass__(com.stardust.autojs.runtime.api.Shell);
__importClass__(com.stardust.autojs.core.util.Shell);

View File

@@ -1,6 +1,6 @@
module.exports = function(__runtime__, scope){
function RootAutomator(){
this.__ra__ = Object.create(new com.stardust.autojs.runtime.api.RootAutomator(scope.context));
this.__ra__ = Object.create(new com.stardust.autojs.core.inputevent.RootAutomator(scope.context));
var methods = ["sendEvent", "touch", "setScreenMetrics", "touchX", "touchY", "sendSync", "sendMtSync", "tap",
"swipe", "press", "longPress", "touchDown", "touchUp", "touchMove", "getDefaultId", "setDefaultId", "exit"];
for(var i = 0; i < methods.length; i++){

View File

@@ -70,15 +70,15 @@ module.exports = function(__runtime__, scope){
function getColorDetector(color, algorithm, threshold){
switch(algorithm){
case "rgb":
return new com.stardust.autojs.runtime.api.image.ColorDetector.RGBDistanceDetector(color, threshold);
return new com.stardust.autojs.core.image.ColorDetector.RGBDistanceDetector(color, threshold);
case "equal":
return new com.stardust.autojs.runtime.api.image.ColorDetector.EqualityDetector(color);
return new com.stardust.autojs.core.image.ColorDetector.EqualityDetector(color);
case "diff":
return new com.stardust.autojs.runtime.api.image.ColorDetector.DifferenceDetector(color, threshold);
return new com.stardust.autojs.core.image.ColorDetector.DifferenceDetector(color, threshold);
case "rgb+":
return new com.stardust.autojs.runtime.api.image.ColorDetector.WeightedRGBDistanceDetector(color, threshold);
return new com.stardust.autojs.core.image.ColorDetector.WeightedRGBDistanceDetector(color, threshold);
case "hs":
return new com.stardust.autojs.runtime.api.image.ColorDetector.HSDistanceDetector(color, threshold);
return new com.stardust.autojs.core.image.ColorDetector.HSDistanceDetector(color, threshold);
}
throw new Error("Unknown algorithm: " + algorithm);
}

View File

@@ -52,7 +52,7 @@ module.exports = function(__runtime__, scope){
}
ui.findViewByStringId = function(view, id){
return com.stardust.autojs.runtime.api.ui.JsViewHelper.findViewByStringId(view, id);
return com.stardust.autojs.core.ui.JsViewHelper.findViewByStringId(view, id);
}
function decorate(view){

View File

@@ -2,11 +2,11 @@
module.exports = function(__runtime__, scope){
scope.newInjectableWebClient = function(){
return new com.stardust.autojs.runtime.api.InjectableWebClient(org.mozilla.javascript.Context.getCurrentContext(), scope);
return new com.stardust.autojs.core.web.InjectableWebClient(org.mozilla.javascript.Context.getCurrentContext(), scope);
}
scope.newInjectableWebView = function(activity){
return new com.stardust.autojs.runtime.api.InjectableWebView(scope.activity, org.mozilla.javascript.Context.getCurrentContext(), scope);
return new com.stardust.autojs.core.web.InjectableWebView(scope.activity, org.mozilla.javascript.Context.getCurrentContext(), scope);
}
}