add: module floaty; events.on('exit')

This commit is contained in:
hyb1996
2017-12-06 13:18:36 +08:00
parent 346487b0ef
commit e33ce733d5
12 changed files with 448 additions and 25 deletions

View File

@@ -65,7 +65,7 @@ require("__general__")(__runtime__, this);
(function(scope){
var modules = ['app', 'automator', 'console', 'dialogs', 'io', 'selector', 'shell', 'web', 'ui',
"images", "timers", "events", "engines", "RootAutomator", "http", "storages"];
"images", "timers", "events", "engines", "RootAutomator", "http", "storages", "floaty"];
var len = modules.length;
for(var i = 0; i < len; i++) {
var m = modules[i];

View File

@@ -0,0 +1,37 @@
module.exports = function(__runtime__, scope){
var floaty = {};
floaty.window = function(layout){
if(typeof(layout) == 'xml'){
layout = layout.toString();
}
return wrap(__runtime__.floaty.window(layout));
}
function wrap(window){
var proxyObject = new com.stardust.autojs.rhino.ProxyJavaObject(scope, window, window.getClass());
proxyObject.__proxy__ = {
set: function(name, value){
window[name] = value;
},
get: function(name) {
var value = window[name];
if(typeof(value) == 'undefined'){
value = window.getView(name);
if(!value){
value = undefined;
}else{
value = scope.ui.__decorate__(value);
}
}
return value;
}
};
return proxyObject;
}
return floaty;
}

View File

@@ -83,6 +83,8 @@ module.exports = function(__runtime__, scope){
return view;
}
ui.__decorate__ = decorate;
var proxy = __runtime__.ui;
proxy.__proxy__ = {
set: function(name, value){