save works

This commit is contained in:
hyb1996
2018-05-29 20:26:21 +08:00
parent aa770b2ffb
commit 22185346e8
12 changed files with 177 additions and 20 deletions

View File

@@ -9,6 +9,8 @@ module.exports = function (runtime, global) {
var ui = {};
ui.__view_cache__ = {};
ui.__defineGetter__("emitter", ()=> activity ? activity.getEventEmitter() : null);
ui.layout = function (xml) {
if(!activity){
throw new Error("需要在ui模式下运行才能使用该函数");
@@ -152,6 +154,7 @@ module.exports = function (runtime, global) {
return false;
},
beforeApplyAttribute: function (inflater, view, ns, attrName, value, parent, attrs) {
log("beforeApplyAttribute:", view, attrName, value);
var isDynamic = layoutInflater.isDynamicValue(value);
if ((isDynamic && layoutInflater.getInflateFlags() == layoutInflater.FLAG_IGNORES_DYNAMIC_ATTRS)
|| (!isDynamic && layoutInflater.getInflateFlags() == layoutInflater.FLAG_JUST_DYNAMIC_ATTRS)) {
@@ -194,7 +197,9 @@ module.exports = function (runtime, global) {
}
function decorate(view) {
var androidView = view;
var view = global.events.__asEmitter__(Object.create(view));
view.__androidView__ = androidView;
if (view.getClass().getName() == "com.stardust.autojs.core.ui.widget.JsListView"
|| view.getClass().getName() == "com.stardust.autojs.core.ui.widget.JsGridView") {
view = decorateList(view);