mirror of
https://github.com/TonyJiangWJ/Auto.js.git
synced 2026-06-21 21:01:43 +08:00
* change rhino to 1.7.7.2
* fix: wrap java.lang.String to native string
This commit is contained in:
parent
e8110c76a2
commit
43263a62ff
@ -2,8 +2,8 @@
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Auto.js.iml" filepath="$PROJECT_DIR$/Auto.js.iml" />
|
||||
<module fileurl="file://E:\YiBin\AndroidStudioProjects\NoRootScriptDroid\Auto.js.iml" filepath="E:\YiBin\AndroidStudioProjects\NoRootScriptDroid\Auto.js.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/NoRootScriptDroid.iml" filepath="$PROJECT_DIR$/NoRootScriptDroid.iml" />
|
||||
<module fileurl="file://C:\Users\Stardust\Documents\AndroidProjects\Auto.js\NoRootScriptDroid.iml" filepath="C:\Users\Stardust\Documents\AndroidProjects\Auto.js\NoRootScriptDroid.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/autojs/autojs.iml" filepath="$PROJECT_DIR$/autojs/autojs.iml" />
|
||||
|
||||
@ -49,6 +49,7 @@ dependencies {
|
||||
compile(name: 'libtermexec-release', ext: 'aar')
|
||||
compile(name: 'emulatorview-release', ext: 'aar')
|
||||
compile(name: 'term-debug', ext: 'aar')
|
||||
compile files('libs/rhino-1.7.7.2.jar')
|
||||
compile project(path: ':common')
|
||||
compile project(path: ':automator')
|
||||
}
|
||||
|
||||
Binary file not shown.
@ -39,6 +39,9 @@ __runtime__.bridges.setBridges({
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
},
|
||||
toString: function(o){
|
||||
return String(o);
|
||||
}
|
||||
});
|
||||
|
||||
@ -67,3 +70,4 @@ require("__general__")(__runtime__, this);
|
||||
|
||||
__importClass__(android.view.KeyEvent);
|
||||
__importClass__(com.stardust.autojs.core.util.Shell);
|
||||
|
||||
|
||||
@ -184,7 +184,7 @@ public class RhinoJavaScriptEngine extends JavaScriptEngine {
|
||||
@Override
|
||||
public Object wrap(Context cx, Scriptable scope, Object obj, Class<?> staticType) {
|
||||
if (staticType == String.class) {
|
||||
return createNativeString(obj);
|
||||
return getRuntime().bridges.toString(obj);
|
||||
}
|
||||
if (staticType == UiObjectCollection.class ) {
|
||||
return getRuntime().bridges.toArray(obj);
|
||||
|
||||
@ -8,6 +8,7 @@ import com.stardust.autojs.core.accessibility.UiCollection;
|
||||
|
||||
public class ScriptBridges {
|
||||
|
||||
|
||||
public interface Bridges {
|
||||
|
||||
Object[] NO_ARGUMENTS = new Object[0];
|
||||
@ -15,6 +16,8 @@ public class ScriptBridges {
|
||||
Object call(Object func, Object target, Object[] arg);
|
||||
|
||||
Object toArray(Object o);
|
||||
|
||||
Object toString(Object obj);
|
||||
}
|
||||
|
||||
private Bridges mBridges;
|
||||
@ -38,4 +41,10 @@ public class ScriptBridges {
|
||||
checkBridges();
|
||||
return mBridges.toArray(c);
|
||||
}
|
||||
|
||||
|
||||
public Object toString(Object obj) {
|
||||
checkBridges();
|
||||
return mBridges.toString(obj);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user