You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by gu...@apache.org on 2017/10/10 04:12:42 UTC
[01/14] incubator-weex git commit: add apache license
Repository: incubator-weex
Updated Branches:
refs/heads/master d10be0bcf -> 428b0eadc
add apache license
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/428b0ead
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/428b0ead
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/428b0ead
Branch: refs/heads/master
Commit: 428b0eadca8708b7a0121190416db564bc44927e
Parents: 6d9be14
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Tue Oct 10 10:58:56 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
.../java/com/taobao/weex/dom/flex/CSSNode.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/428b0ead/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java
index 624c4c9..0818c15 100755
--- a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
/**
* Copyright (c) 2014, Facebook, Inc. All rights reserved. <p/> This source code is licensed under
* the BSD-cssstyle license found in the LICENSE file in the root directory of this source tree. An
[05/14] incubator-weex git commit: * [jsfm] upgrade weex-js-framework
to 0.22.5
Posted by gu...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ef1aad20/pre-build/native-bundle-main.js
----------------------------------------------------------------------
diff --git a/pre-build/native-bundle-main.js b/pre-build/native-bundle-main.js
index d43b6ec..c5d06cf 100644
--- a/pre-build/native-bundle-main.js
+++ b/pre-build/native-bundle-main.js
@@ -1,8 +1,8 @@
-(this.nativeLog||function(e){console.log(e)})("START JS FRAMEWORK 0.22.4, Build 2017-09-25 11:20."),this.getJSFMVersion=function(){return"0.22.4"};var global=this,process={env:{}},setTimeout=global.setTimeout;!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";function e(e){Hn.Document=e.Document,Hn.Element=e.Element,Hn.Comment=e.Comment,Hn.sendTasks=e.sendTasks}function t(e,t,n,r,o){void 0===n&&(n={}),void 0===r&&(r={}),void 0===o&&(o={});var i=new Hn.Document(e,n.bundleUrl),a={},s={id:e,data:r,document:i,callbacks:a},u=0;i.addCallback=function(e){return u++,a[u]=e,u},i.handleCallback=function(e,t,n){var r=a[e];return n&&delete a[e],r(t)},Gn[e]=s;var c=Object.assign({Document:Hn.Document,Element:Hn.Element,Comment:Hn.Comment,sendTasks:function(t){return Hn.sendTasks(e,t,-1)},options:n,document:i},o),l=[],f=[];for(var p in c)l.push(p),f.push(c[p]);return l.push(t),(new(Function.prototy
pe.bind.apply(Function,[null].concat(l)))).apply(void 0,f),Hn.sendTasks(e,[{module:"dom",method:"createFinish",args:[]}],-1),s}function n(e){delete Gn[e]}function r(e){return Gn[e].document.body.toJSON()}function o(e,t){var n={fireEvent:function(e,t,n,r,o){var i=Gn[e],a=i.document,s=a.getRef(t);return a.fireEvent(s,n,r,o)},callback:function(e,t,n,r){return Gn[e].document.handleCallback(t,n,r)}};if((Gn[e]||{}).document&&Array.isArray(t)){var r=[];return t.forEach(function(t){var o=n[t.method],i=[].concat(t.args);"function"==typeof o&&(i.unshift(e),r.push(o.apply(void 0,i)))}),r}}function i(e){return e&&e.__esModule?e.default:e}function a(e,t){return t={exports:{}},e(t,t.exports),t.exports}function s(e){console.warn("[JS Framework] Vm#$ is deprecated, please use Vm#$vm instead");var t=this._ids[e];if(t)return t.vm}function u(e){var t=this._ids[e];if(t)return t.el}function c(e){var t=this._ids[e];if(t)return t.vm}function l(e){return this._app.differ.then(function(){e()})}function f(e,
t){console.warn("[JS Framework] Vm#$scrollTo is deprecated, please use \"require('@weex-module/dom').scrollTo(el, options)\" instead");var n=this.$el(e);if(n){this._app.requireModule("dom").scrollToElement(n.ref,{offset:t})}}function p(e,t,n){var r=this,o=this.$el(e);if(o&&t&&t.styles){this._app.requireModule("animation").transition(o.ref,t,function(){for(var e=[],i=arguments.length;i--;)e[i]=arguments[i];r._setStyle(o,t.styles),n&&n.apply(void 0,e)})}}function d(e){var t=this._app.options;return"function"==typeof e&&(console.warn("[JS Framework] the callback of Vm#$getConfig(callback) is deprecated, this api now can directly RETURN config info."),e(t)),t}function h(e,t){console.warn("[JS Framework] Vm#$sendHttp is deprecated, please use \"require('@weex-module/stream').sendHttp(params, callback)\" instead"),this._app.requireModule("stream").sendHttp(e,t)}function v(e){console.warn("[JS Framework] Vm#$openURL is deprecated, please use \"require('@weex-module/event').openURL(url)\" i
nstead"),this._app.requireModule("event").openURL(e)}function y(e){console.warn("[JS Framework] Vm#$setTitle is deprecated, please use \"require('@weex-module/pageInfo').setTitle(title)\" instead"),this._app.requireModule("pageInfo").setTitle(e)}function m(e,t){for(var n=[],r=arguments.length-2;r-- >0;)n[r]=arguments[r+2];console.warn("[JS Framework] Vm#$call is deprecated, please use \"require('@weex-module/moduleName')\" instead");var o=this._app.requireModule(e);o&&o[t]&&o[t].apply(o,n)}function _(e){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];if("function"==typeof Object.assign)Object.assign.apply(Object,[e].concat(t));else{var r=t.shift();for(var o in r)e[o]=r[o];t.length&&_.apply(void 0,[e].concat(t))}return e}function g(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function b(e,t){if(e.length){var n=e.indexOf(t);if(n>-1)return e.splice(n,1)}}function w(e,t){return hr.call(e,t)}function x(e,t){return function(n){var
r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}}function E(e){return null!==e&&"object"==typeof e}function O(e){return vr.call(e)===yr}function S(e){var t=(e+"").charCodeAt(0);return 36===t||95===t}function C(){return"object"==typeof nativeSet?nativeSet.create():new Jn}function k(e){var t=Object.prototype.toString.call(e);return t.substring(8,t.length-1).toLowerCase()}function j(e){return e.replace(_r,"").replace(gr,"")}function A(e){return e.replace(wr,"")}function I(){this.id=Cr++,this.subs=[]}function T(e){I.target&&kr.push(I.target),I.target=e}function N(){I.target=kr.pop()}function P(){I.target=null,kr=[]}function M(e,t,n,r){r&&_(this,r);var o="function"==typeof t;this.vm=e,e._watchers.push(this),this.expression=t,this.cb=n,this.id=++jr,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=C(),this.newDepIds=C(),o&&(this.getter=t),this.value=this.lazy?void 0:this.get(),this.queued=this.shallow=!1}function $(e,t){var n,r,o,i;if(
t||(t=Ar,t.clear()),o=Array.isArray(e),i=E(e),o||i){if(e.__ob__){var a=e.__ob__.dep.id;if(t.has(a))return;t.add(a)}if(o)for(n=e.length;n--;)$(e[n],t);else if(i)for(r=Object.keys(e),n=r.length;n--;)$(e[r[n]],t)}}function R(e){if(this.value=e,this.dep=new I,g(e,"__ob__",this),Array.isArray(e)){(mr?D:F)(e,Tr,Nr),this.observeArray(e)}else this.walk(e)}function D(e,t){e.__proto__=t}function F(e,t,n){for(var r=0,o=n.length;r<o;r++){var i=n[r];g(e,i,t[i])}}function L(e,t){if(E(e)){var n;return w(e,"__ob__")&&e.__ob__ instanceof R?n=e.__ob__:(Array.isArray(e)||O(e))&&Object.isExtensible(e)&&!e._isVue&&(n=new R(e)),n&&t&&n.addVm(t),n}}function W(e,t,n){var r=new I,o=Object.getOwnPropertyDescriptor(e,t);if(!o||!1!==o.configurable){var i=o&&o.get,a=o&&o.set,s=L(n);Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var t=i?i.call(e):n;if(I.target&&(r.depend(),s&&s.dep.depend(),Array.isArray(t)))for(var o=void 0,a=0,u=t.length;a<u;a++)(o=t[a])&&o.__ob__&&o.__ob__.dep.depend(
);return t},set:function(t){t!==(i?i.call(e):n)&&(a?a.call(e,t):n=t,s=L(t),r.notify())}})}}function U(e,t,n){if(Array.isArray(e))return e.splice(t,1,n);if(w(e,t))return void(e[t]=n);if(e._isVue)return void U(e._data,t,n);var r=e.__ob__;if(!r)return void(e[t]=n);if(r.convert(t,n),r.dep.notify(),r.vms)for(var o=r.vms.length;o--;){var i=r.vms[o];B(i,t)}return n}function V(e,t){if(w(e,t)){delete e[t];var n=e.__ob__;if(!n)return void(e._isVue&&delete e._data[t]);if(n.dep.notify(),n.vms)for(var r=n.vms.length;r--;){var o=n.vms[r];q(o,t)}}}function B(e,t){(Pr.indexOf(t)>-1||!S(t))&&Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){return e._data[t]},set:function(n){e._data[t]=n}})}function q(e,t){S(t)||delete e[t]}function z(e){e._watchers=[],J(e),G(e),K(e)}function J(e){var t=e._data;O(t)||(t={});for(var n=Object.keys(t),r=n.length;r--;)B(e,n[r]);L(t,e)}function H(){}function G(e){var t=e._computed;if(t)for(var n in t){var r=t[n],o={enumerable:!0,configurable:!0};"fu
nction"==typeof r?(o.get=X(r,e),o.set=H):(o.get=r.get?!1!==r.cache?X(r.get,e):x(r.get,e):H,o.set=r.set?x(r.set,e):H),Object.defineProperty(e,n,o)}}function X(e,t){var n=new M(t,e,null,{lazy:!0});return function(){return n.dirty&&n.evaluate(),I.target&&n.depend(),n.value}}function K(e){var t=e._methods;if(t)for(var n in t)e[n]=t[n]}function Z(e){var t=e.type,n=$r[t];if("object"==typeof n)for(var r in n)if(null==e[r])e[r]=n[r];else if("object"===k(e[r])&&"object"===k(n[r]))for(var o in n[r])null==e[r][o]&&(e[r][o]=n[r][o])}function Q(e,t,n){oe(e,t,n.id,e),ie(e,t,n.attr),se(e,t,n.classList),ue(e,t,n.style),le(e,t,n.events)}function Y(e,t,n,r){t=t||{},n=n||{};var o=t._options||{},i=o.props;Array.isArray(i)&&(i=i.reduce(function(e,t){return e[t]=!0,e},{})),te(r,i,e,t),te(n.attr,i,e,t)}function ee(e,t,n,r){void 0===r&&(r={}),re(n.classList,e,t),ne(n.style,e,t),r.children?r.children[r.children.length-1]._vm=t:r._vm=t}function te(e,t,n,r){if(e){for(var o in e)!function(o){if(!t||t[o]){var i
=e[o];if("function"==typeof i){var a=de(n,i,function(e){r[o]=e});r[o]=a}else r[o]=i}}(o)}}function ne(e,t,n){for(var r in e)!function(r){var o=e[r];if("function"==typeof o){var i=de(t,o,function(e){n._rootEl&&n._rootEl.setStyle(r,e)});n._rootEl.setStyle(r,i)}else n._rootEl&&n._rootEl.setStyle(r,o)}(r)}function re(e,t,n){function r(e,t){"array"===k(e)&&e.unshift(t)}var o=t._options&&t._options.style||{};if(n._rootEl){var i="@originalRootEl";if(o[i]=n._rootEl.classStyle,"function"==typeof e){var a=de(t,e,function(e){r(e,i),ae(n._rootEl,o,e)});r(a,i),ae(n._rootEl,o,a)}else null!=e&&(r(e,i),ae(n._rootEl,o,e))}}function oe(e,t,n,r){var o=Object.create(null);if(Object.defineProperties(o,{vm:{value:r,writable:!1,configurable:!1},el:{get:function(){return t||r._rootEl},configurable:!1}}),"function"==typeof n){var i=n;n=i.call(e),(n||0===n)&&(e._ids[n]=o),de(e,i,function(t){t&&(e._ids[t]=o)})}else n&&"string"==typeof n&&(e._ids[n]=o)}function ie(e,t,n){fe(e,t,"attr",n)}function ae(e,t,n){"st
ring"==typeof n&&(n=n.split(/\s+/)),n.forEach(function(e,t){n.splice.apply(n,[t,1].concat(e.split(/\s+/)))});for(var r={},o=n.length,i=0;i<o;i++)!function(e){var o=t[n[e]];o&&Object.keys(o).forEach(function(e){r[e]=o[e]})}(i);e.setClassStyle(r)}function se(e,t,n){if("function"==typeof n||Array.isArray(n)){if(Array.isArray(n)&&!n.length)return void t.setClassStyle({});var r=e._options&&e._options.style||{};if("function"==typeof n){var o=de(e,n,function(e){ae(t,r,e)});ae(t,r,o)}else ae(t,r,n)}}function ue(e,t,n){fe(e,t,"style",n)}function ce(e,t,n,r){t.addEvent(n,x(r,e))}function le(e,t,n){if(n)for(var r=Object.keys(n),o=r.length;o--;){var i=r[o],a=n[i];"string"==typeof a&&((a=e[a])||console.warn('[JS Framework] The event handler "'+a+'" is not defined.')),ce(e,t,i,a)}}function fe(e,t,n,r){if(r)for(var o=Object.keys(r),i=o.length;i--;){var a=o[i],s=r[a];"function"==typeof s?pe(e,t,n,a,s):t[Rr[n]](a,s)}}function pe(e,t,n,r,o){var i=Rr[n],a=de(e,o,function(n){function o(){t[i](r,n)}var
a=e&&e._app&&e._app.differ;a?a.append("element",t.depth||0,t.ref,o):o()});t[i](r,a)}function de(e,t,n){return e._static?t.call(e,e):new M(e,t,function(e,t){"object"!=typeof e&&e===t||n(e)}).value}function he(e,t){return e._app.doc.createBody(t)}function ve(e,t){return e._app.doc.createElement(t)}function ye(e,t){var n=me(e),r=_e(e),o=Dr++;if(t.element){var i=t.updateMark;i?(i.element&&(i=i.end),t.element.insertAfter(r,i),t.element.insertAfter(n,i),t.updateMark=r):(t.element.insertBefore(n,t.end),t.element.insertBefore(r,t.end)),t=t.element}else t.appendChild(n),t.appendChild(r);return{start:n,end:r,element:t,blockId:o}}function me(e){return e._app.doc.createComment("start")}function _e(e){return e._app.doc.createComment("end")}function ge(e,t,n){if(n.element){var r=n.end,o=n.updateMark;if(n.children&&n.children.push(t),o){var i=be(e,t,o);return n.updateMark=t.element?t.end:t,i}if(!t.element)return n.element.insertBefore(t,r);n.element.insertBefore(t.start,r),n.element.insertBefore(t
.end,r)}else{if(!t.element)return n.appendChild(t);n.appendChild(t.start),n.appendChild(t.end)}}function be(e,t,n){return t.element?xe(t,n):we(t,n)}function we(e,t){var n=t.parentNode;if(n)return n.insertAfter(e,t)}function xe(e,t){var n=t.parentNode;if(n){for(var r,o=e.start,i=[o];o&&o!==e.end;)o=o.nextSibling,i.push(o);var a=t;return i.every(function(e){return r=n.insertAfter(e,a),a=e,-1!==r}),r}}function Ee(e,t,n){void 0===n&&(n=!1),t.element?Se(t,n):Oe(t),t._vm&&t._vm.$emit("hook:destroyed")}function Oe(e){var t=e.parentNode;t&&t.removeChild(e)}function Se(e,t){void 0===t&&(t=!1);for(var n=[],r=e.start.nextSibling;r&&r!==e.end;)n.push(r),r=r.nextSibling;t||Oe(e.start),n.forEach(function(e){Oe(e)}),t||Oe(e.end)}function Ce(e){var t=e._options||{},n=t.template||{};t.replace?n.children&&1===n.children.length?ke(e,n.children[0],e._parentEl):ke(e,n.children,e._parentEl):ke(e,n,e._parentEl),console.debug('[JS Framework] "ready" lifecycle in Vm('+e._type+")"),e.$emit("hook:ready"),e._r
eady=!0}function ke(e,t,n,r){if(-1!==(e._app||{}).lastSignal){if(t.attr&&t.attr.hasOwnProperty("static")&&(e._static=!0),je(t))return void Me(e,t,n,r);if(r=r||{},Ae(t))return console.debug('[JS Framework] compile "content" block by',t),void(e._content=ye(e,n));if(Ie(t,r))return console.debug('[JS Framework] compile "repeat" logic by',t),void("document"===n.type?console.warn("[JS Framework] The root element does't support `repeat` directive!"):$e(e,t,n));if(Te(t,r))return console.debug('[JS Framework] compile "if" logic by',t),void("document"===n.type?console.warn("[JS Framework] The root element does't support `if` directive!"):Re(e,t,n,r));var o=r.type||t.type;if(Ne(o,r))return void De(e,t,n,o,r);var i=o,a=Pe(e,t,i);if(a)return console.debug("[JS Framework] compile composed component by",t),void Fe(e,a,t,n,i,r);console.debug("[JS Framework] compile native component by",t),Le(e,t,n,i)}}function je(e){return Array.isArray(e)}function Ae(e){return"content"===e.type||"slot"===e.type}fu
nction Ie(e,t){return!t.hasOwnProperty("repeat")&&e.repeat}function Te(e,t){return!t.hasOwnProperty("shown")&&e.shown}function Ne(e,t){return"function"==typeof e&&!t.hasOwnProperty("type")}function Pe(e,t,n){var r;return e._app&&e._app.customComponentMap&&(r=e._app.customComponentMap[n]),e._options&&e._options.components&&(r=e._options.components[n]),t.component&&(r=r||{}),r}function Me(e,t,n,r){var o=ye(e,n);t.forEach(function(t){ke(e,t,o,r)})}function $e(e,t,n){var r=t.repeat,o="function"==typeof r,i=r.getter||r.expression||r;"function"!=typeof i&&(i=function(){return[]});var a=r.key||"$index",s=r.value||"$value",u=r.trackBy||t.trackBy||t.attr&&t.attr.trackBy,c=ye(e,n);c.children=[],c.data=[],c.vms=[],Ue(e,t,c,{getter:i,key:a,value:s,trackBy:u,oldStyle:o})}function Re(e,t,n,r){var o={shown:!0},i=ye(e,n);n.element&&n.children&&n.children.push(i),r.repeat&&(o.repeat=r.repeat),Ve(e,t,i,o)}function De(e,t,n,r,o){var i=r.call(e),a=_({type:i},o),s=ye(e,n);n.element&&n.children&&n.childr
en.push(s),de(e,r,function(n){var r=_({type:n},o);Ee(e,s,!0),ke(e,t,s,r)}),ke(e,t,s,a)}function Fe(e,t,n,r,o,i){var a=e.constructor,s=new a(o,t,e,r,void 0,{"hook:init":function(){e._static&&(this._static=e._static),oe(e,null,n.id,this),this._externalBinding={parent:e,template:n}},"hook:created":function(){Y(e,this,n,i.repeat)},"hook:ready":function(){this._content&&We(e,n,this._content)}});ee(e,s,n,r)}function Le(e,t,n,r){Z(t);var o;if("_documentElement"===n.ref?(console.debug("[JS Framework] compile to create body for "+r),o=he(e,r)):(console.debug("[JS Framework] compile to create element for "+r),o=ve(e,r)),!e._rootEl){e._rootEl=o;var i=e._externalBinding||{},a=i.template,s=i.parent;if(a&&a.events&&s&&o)for(var u in a.events){var c=s[a.events[u]];c&&o.addEvent(u,x(c,s))}}Q(e,o,t),t.attr&&t.attr.append&&(t.append=t.attr.append),t.append&&(o.attr=o.attr||{},o.attr.append=t.append);var l="tree"===t.append,f=e._app||{};-1===f.lastSignal||l||(console.debug("[JS Framework] compile to a
ppend single node for",o),f.lastSignal=ge(e,o,n)),-1!==f.lastSignal&&We(e,t,o),-1!==f.lastSignal&&l&&(console.debug("[JS Framework] compile to append whole tree for",o),f.lastSignal=ge(e,o,n))}function We(e,t,n){var r=e._app||{},o=t.children;o&&o.length&&o.every(function(t){return ke(e,t,n),-1!==r.lastSignal})}function Ue(e,t,n,r){function o(e,r,o){var a;c?(a=e,E(e)?(a[l]=r,a.hasOwnProperty("INDEX")||Object.defineProperty(a,"INDEX",{value:function(){console.warn('[JS Framework] "INDEX" in repeat is deprecated, please use "$index" instead')}})):(console.warn("[JS Framework] Each list item must be an object in old-style repeat, please use `repeat={{v in list}}` instead."),a={},a[l]=r,a[f]=e)):(a={},a[l]=r,a[f]=e);var s=qe(o,a);i.push(s),ke(s,t,n,{repeat:e})}var i=n.vms,a=n.children,s=r.getter,u=r.trackBy,c=r.oldStyle,l=r.key,f=r.value,p=Be(e,n,s,"repeat",function(t){if(console.debug('[JS Framework] the "repeat" item has changed',t),n&&t){var r=a.slice(),s=i.slice(),p=n.data.slice(),d=
{},h={};t.forEach(function(e,t){var n=u?e[u]:c?e[l]:t;null!=n&&""!==n&&(d[n]=e)});var v=[];p.forEach(function(t,n){var o=u?t[u]:c?t[l]:n;d.hasOwnProperty(o)?(h[o]={item:t,index:n,key:o,target:r[n],vm:s[n]},v.push(t)):Ee(e,r[n])}),a.length=0,i.length=0,n.data=t.slice(),n.updateMark=n.start,t.forEach(function(t,r){var s=u?t[u]:c?t[l]:r,p=h[s];p?(p.item===v[0]?v.shift():(v.$remove(p.item),be(e,p.target,n.updateMark,!0)),a.push(p.target),i.push(p.vm),c?p.vm=t:p.vm[f]=t,p.vm[l]=r,n.updateMark=p.target):o(t,r,e)}),delete n.updateMark}});n.data=p.slice(0),p.forEach(function(t,n){o(t,n,e)})}function Ve(e,t,n,r){var o=Be(e,n,t.shown,"shown",function(o){console.debug('[JS Framework] the "if" item was changed',o),n&&!!n.display!=!!o&&(n.display=!!o,o?ke(e,t,n,r):Ee(e,n,!0))});n.display=!!o,o&&ke(e,t,n,r)}function Be(e,t,n,r,o){var i=e&&e._app&&e._app.differ,a={},s=(t.element.depth||0)+1;return de(e,n,function(e){a.latestValue=e,i&&!a.recorded&&i.append(r,s,t.blockId,function(){var e=a.latestVa
lue;o(e),a.recorded=!1,a.latestValue=void 0}),a.recorded=!0})}function qe(e,t){var n=Object.create(e);return n._data=t,J(n),G(n),n._realParent=e,e._static&&(n._static=e._static),n}function ze(e,t){if(t instanceof ze)return t;this.timestamp=Date.now(),this.detail=t,this.type=e;var n=!1;this.stop=function(){n=!0},this.hasStopped=function(){return n}}function Je(e,t){var n=this,r=this._vmEvents,o=r[e];if(o){var i=new ze(e,t);o.forEach(function(e){e.call(n,i)})}}function He(e,t){var n=new ze(e,t);this.$emit(e,n),!n.hasStopped()&&this._parent&&this._parent.$dispatch&&this._parent.$dispatch(e,n)}function Ge(e,t){var n=new ze(e,t);this.$emit(e,n),!n.hasStopped()&&this._childrenVms&&this._childrenVms.forEach(function(t){t.$broadcast(e,n)})}function Xe(e,t){if(e&&"function"==typeof t){var n=this._vmEvents,r=n[e]||[];r.push(t),n[e]=r,"hook:ready"===e&&this._ready&&this.$emit("hook:ready")}}function Ke(e,t){if(e){var n=this._vmEvents;if(!t)return void delete n[e];var r=n[e];r&&r.$remove(t)}}fu
nction Ze(e,t){var n=e._options||{},r=n.events||{};for(var o in r)e.$on(o,r[o]);for(var i in t)e.$on(i,t[i]);Fr.forEach(function(t){e.$on("hook:"+t,n[t])})}function Qe(e,t,n,r,o,i){n=n||{},this._parent=n._realParent?n._realParent:n,this._app=n._app||{},n._childrenVms&&n._childrenVms.push(this),!t&&this._app.customComponentMap&&(t=this._app.customComponentMap[e]),t=t||{};var a=t.data||{};this._options=t,this._methods=t.methods||{},this._computed=t.computed||{},this._css=t.style||{},this._ids={},this._vmEvents={},this._childrenVms=[],this._type=e,Ze(this,i),console.debug('[JS Framework] "init" lifecycle in Vm('+this._type+")"),this.$emit("hook:init"),this._inited=!0,this._data="function"==typeof a?a():a,o&&_(this._data,o),z(this),console.debug('[JS Framework] "created" lifecycle in Vm('+this._type+")"),this.$emit("hook:created"),this._created=!0,t.methods&&t.methods.ready&&(console.warn('"exports.methods.ready" is deprecated, please use "exports.created" instead'),t.methods.ready.call
(this)),this._app.doc&&(this._parentEl=r||this._app.doc.documentElement,Ce(this))}function Ye(e,t){for(var n in e)!function(n){var r=Lr[n];r||(r={},Lr[n]=r),e[n].forEach(function(e){"string"==typeof e&&(e={name:e}),r[e.name]&&!t||(r[e.name]=e)})}(n)}function et(e,t){var n=e.prototype;for(var r in t)n.hasOwnProperty(r)||(n[r]=t[r])}function tt(e,t){var n=Lr[t],r={};for(var o in n)!function(n){Object.defineProperty(r,n,{configurable:!0,enumerable:!0,get:function(){return function(){for(var r=[],o=arguments.length;o--;)r[o]=arguments[o];return e.callTasks({module:t,method:n,args:r})}},set:function(r){if("function"==typeof r)return e.callTasks({module:t,method:n,args:[r]})}})}(o);return r}function nt(e,t){return e.customComponentMap[t]}function rt(e,t,n){var r=e.customComponentMap;if(r[t])return void console.error("[JS Framework] define a component("+t+") that already exists");r[t]=n}function ot(e){if(Wr.valid(e))return e;e="string"==typeof e?e:"";for(var t=e.split("."),n=0,r=[];n<3;){v
ar o="string"==typeof t[n]&&t[n]?t[n]:"0";r.push(o),n++}return r.join(".")}function it(e,t,n){var r={isDowngrade:!0,errorType:1,code:1e3},o=e.toLowerCase();return r.errorMessage=function(e,t,n){return"Downgrade["+e+"] :: deviceInfo "+t+" matched criteria "+n}(e,t,n),o.indexOf("osversion")>=0?r.code=1001:o.indexOf("appversion")>=0?r.code=1002:o.indexOf("weexversion")>=0?r.code=1003:o.indexOf("devicemodel")>=0&&(r.code=1004),r}function at(e,t){t=t||global.WXEnvironment,t=O(t)?t:{};var n={isDowngrade:!1};if("function"===k(e)){var r=e.call(this,t,{semver:Wr,normalizeVersion:ot});r=!!r,n=r?it("custom","","custom params"):n}else{e=O(e)?e:{};var o=t.platform||"unknow",i=o.toLowerCase(),a=e[i]||{};for(var s in t){var u=s,c=u.toLowerCase(),l=t[s],f=c.indexOf("version")>=0,p=c.indexOf("devicemodel")>=0,d=a[s];if(d&&f){var h=ot(d),v=ot(t[s]);if(Wr.satisfies(v,h)){n=it(u,l,d);break}}else if(p){var y="array"===k(d)?d:[d];if(y.indexOf(l)>=0){n=it(u,l,d);break}}}}return n}function st(e,t){if(void
0===t&&(t={}),e&&e.callTasks)return e.callTasks([{module:"meta",method:"setViewport",args:[t]}])}function ut(e,t,n,r){console.debug("[JS Framework] bootstrap for "+t);var o;if(xr(t))o=j(t);else{if(!Sr(t))return new Error("Wrong component name: "+t);if(o=A(t),!nt(e,o))return new Error("It's not a component: "+t)}if(n=O(n)?n:{},"string"==typeof n.transformerVersion&&"string"==typeof global.transformerVersion&&!Wr.satisfies(n.transformerVersion,global.transformerVersion))return new Error("JS Bundle version: "+n.transformerVersion+" not compatible with "+global.transformerVersion);var i=at(n.downgrade);if(i.isDowngrade)return e.callTasks([{module:"instanceWrap",method:"error",args:[i.errorType,i.code,i.errorMessage]}]),new Error("Downgrade["+i.code+"]: "+i.errorMessage);n.viewport&&st(e,n.viewport),e.vm=new Qe(o,null,{_app:e},null,r)}function ct(e,t,n){console.warn("[JS Framework] Register is deprecated, please install lastest transformer."),rt(e,t,n)}function lt(e,t){console.debug("[JS
Framework] Refresh with",t,"in instance["+e.id+"]");var n=e.vm;return n&&t?("function"==typeof n.refreshData?n.refreshData(t):_(n,t),e.differ.flush(),void e.doc.taskCenter.send("dom",{action:"refreshFinish"},[])):new Error('invalid data "'+t+'"')}function ft(e){console.debug("[JS Framework] Destory an instance("+e.id+")"),e.vm&&pt(e.vm),e.id="",e.options=null,e.blocks=null,e.vm=null,e.doc.taskCenter.destroyCallback(),e.doc.destroy(),e.doc=null,e.customComponentMap=null,e.commonModules=null}function pt(e){if(delete e._app,delete e._computed,delete e._css,delete e._data,delete e._ids,delete e._methods,delete e._options,delete e._parent,delete e._parentEl,delete e._rootEl,e._watchers){for(var t=e._watchers.length;t--;)e._watchers[t].teardown();delete e._watchers}if(e._childrenVms){for(var n=e._childrenVms.length;n--;)pt(e._childrenVms[n]);delete e._childrenVms}console.debug('[JS Framework] "destroyed" lifecycle in Vm('+e._type+")"),e.$emit("hook:destroyed"),delete e._type,delete e._vm
Events}function dt(e){var t=e.doc||{},n=t.body||{};return n.toJSON?n.toJSON():{}}function ht(e,t,n,r,o){if(console.debug('[JS Framework] Fire a "'+n+'" event on an element('+t+") in instance("+e.id+")"),Array.isArray(t))return void t.some(function(t){return!1!==ht(e,t,n,r)});var i=e.doc.getRef(t);if(i){var a=e.doc.fireEvent(i,n,r,o);return e.differ.flush(),e.doc.taskCenter.send("dom",{action:"updateFinish"},[]),a}return new Error('invalid element reference "'+t+'"')}function vt(e,t,n,r){console.debug("[JS Framework] Invoke a callback("+t+") with",n,"in instance("+e.id+")");var o=e.doc.taskCenter.callback(t,n,r);return yt(e),e.doc.taskCenter.send("dom",{action:"updateFinish"},[]),o}function yt(e){e.differ.flush()}function mt(e,t){var n;return"array"!==k(t)&&(t=[t]),t.forEach(function(t){n=e.doc.taskCenter.send("module",{module:t.module,method:t.method},t.args)}),n}function _t(e,t,n,r){console.debug("[JS Framework] Intialize an instance with:\n",n);var o,i=function(){for(var t=[],n=ar
guments.length;n--;)t[n]=arguments[n];return Ur.apply(void 0,[e].concat(t))},a=function(t,r,i){o=ut(e,t,r,i||n),yt(e),e.doc.listener.createFinish(),console.debug("[JS Framework] After intialized an instance("+e.id+")")},s=Qe,u=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return ct.apply(void 0,[e].concat(t))},c=function(t,n){o=ut(e,t,{},n)},l=function(t){return function(n){o=ut(e,t,{},n)}},f=e.doc,p=function(t){return e.requireModule(j(t))},d={config:e.options,define:i,bootstrap:a,requireModule:p,document:f,Vm:s};Object.freeze(d);var h;"function"==typeof t?h=t.toString().substr(12):t&&(h=t.toString()),h='(function(global){\n\n"use strict";\n\n '+h+" \n\n})(Object.create(this))";var v=global.WXEnvironment,y={};if(v&&"Web"!==v.platform){var m=e.requireModule("timer");Object.assign(y,{setTimeout:function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];var r=function(){t[0].apply(t,t.slice(2))};return m.setTimeout(r,t[1]),e.doc.taskCenter.callbackManager.la
stCallbackId.toString()},setInterval:function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];var r=function(){t[0].apply(t,t.slice(2))};return m.setInterval(r,t[1]),e.doc.taskCenter.callbackManager.lastCallbackId.toString()},clearTimeout:function(e){m.clearTimeout(e)},clearInterval:function(e){m.clearInterval(e)}})}var _=Object.assign({define:i,require:l,bootstrap:a,register:u,render:c,__weex_define__:i,__weex_bootstrap__:a,__weex_document__:f,__weex_require__:p,__weex_viewmodel__:s,weex:d},y,r);return bt(_,h)||gt(_,h),o}function gt(e,t){var n=[],r=[];for(var o in e)n.push(o),r.push(e[o]);return n.push(t),(new(Function.prototype.bind.apply(Function,[null].concat(n)))).apply(void 0,r)}function bt(e,t){if("function"!=typeof compileAndRunBundle)return!1;var n=void 0,r=!1,o="(function (",i=[],a=[];for(var s in e)i.push(s),a.push(e[s]);for(var u=0;u<i.length-1;++u)o+=i[u],o+=",";o+=i[i.length-1],o+=") {",o+=t,o+="} )";try{var c=e.weex||{},l=c.config||{};n=compileAndRunBundle(o,
l.bundleUrl,l.bundleDigest,l.codeCachePath),n&&"function"==typeof n&&(n.apply(void 0,a),r=!0)}catch(e){console.error(e)}return r}function wt(e,t){var n=e[t];for(var r in n)n[r]()}function xt(e,t){var n=e[t];for(var r in n){n[r].forEach(function(e){e()})}}function Et(e,t){this.id=e,this.options=t||{},this.vm=null,this.customComponentMap={},this.commonModules={},this.doc=new Mr.Document(e,this.options.bundleUrl,null,Mr.Listener),this.differ=new Vr(e)}function Ot(e,t,n,r,o){var i=o||{},a=i.services;P();var s=Br[e];n=n||{};var u;return s?u=new Error('invalid instance id "'+e+'"'):(s=new Et(e,n),Br[e]=s,u=_t(s,t,r,a)),u instanceof Error?u:s}function St(e){Mr.Document=e.Document,Mr.Element=e.Element,Mr.Comment=e.Comment,Mr.sendTasks=e.sendTasks,Mr.Listener=e.Listener}function Ct(e,t){var n=Br[e];return n?lt(n,t):new Error('invalid instance id "'+e+'"')}function kt(e){"function"==typeof markupState&&markupState(),P();var t=Br[e];if(!t)return new Error('invalid instance id "'+e+'"');ft(t),d
elete Br[e];var n=Math.round(e);if(n>0){n%18||"function"!=typeof notifyTrimMemory||notifyTrimMemory()}return Br}function jt(e){Array.isArray(e)&&e.forEach(function(e){e&&("string"==typeof e?qr[e]=!0:"object"==typeof e&&"string"==typeof e.type&&(qr[e.type]=e))})}function At(e){"object"==typeof e&&Ye(e)}function It(e){"object"==typeof e&&et(Qe,e)}function Tt(e,t){if(Br[e]&&Array.isArray(t)){var n=[];return t.forEach(function(t){var r=zr[t.method],o=[].concat(t.args);"function"==typeof r&&(o.unshift(e),n.push(r.apply(void 0,o)))}),n}return new Error('invalid instance id "'+e+'" or tasks')}function Nt(e){var t=Br[e];return t?dt(t):new Error('invalid instance id "'+e+'"')}function Pt(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=Hs(t),this.reject=Hs(n)}function Mt(){if(Rt(),global.WXEnvironment&&"Web"!==global.WXEnvironment.platform)global.console={debug:function(){for(var e=[],t=arguments.length;t-
-;)e[t]=arguments[t];Dt("debug")&&global.nativeLog.apply(global,Ft(e).concat(["__DEBUG"]))},log:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];Dt("log")&&global.nativeLog.apply(global,Ft(e).concat(["__LOG"]))},info:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];Dt("info")&&global.nativeLog.apply(global,Ft(e).concat(["__INFO"]))},warn:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];Dt("warn")&&global.nativeLog.apply(global,Ft(e).concat(["__WARN"]))},error:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];Dt("error")&&global.nativeLog.apply(global,Ft(e).concat(["__ERROR"]))}};else{var e=console.debug,t=console.log,n=console.info,r=console.warn,o=console.error;console.__ori__={debug:e,log:t,info:n,warn:r,error:o},console.debug=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];Dt("debug")&&console.__ori__.debug.apply(console,e)},console.log=function(){for(var e=[],t=arguments.length;t--;)e[t]=argumen
ts[t];Dt("log")&&console.__ori__.log.apply(console,e)},console.info=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];Dt("info")&&console.__ori__.info.apply(console,e)},console.warn=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];Dt("warn")&&console.__ori__.warn.apply(console,e)},console.error=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];Dt("error")&&console.__ori__.error.apply(console,e)}}}function $t(){Vu={},global.console=Bu}function Rt(){Uu.forEach(function(e){var t=Uu.indexOf(e);Vu[e]={},Uu.forEach(function(n){Uu.indexOf(n)<=t&&(Vu[e][n]=!0)})})}function Dt(e){var t=global.WXEnvironment&&global.WXEnvironment.logLevel||"log";return Vu[t]&&Vu[t][e]}function Ft(e){return e.map(function(e){return e="[object object]"===Object.prototype.toString.call(e).toLowerCase()?JSON.stringify(e):String(e)})}function Lt(){if(void 0===setTimeout&&"function"==typeof zu){var e={},t=0;global.setTimeout=function(n,r){e[++t]=n,zu(t.toString(),r)},
global.setTimeoutCallback=function(t){"function"==typeof e[t]&&(e[t](),delete e[t])}}}function Wt(){global.setTimeout=qu,global.setTimeoutCallback=null}function Ut(){Object.freeze(Object),Object.freeze(Array),Vt(),Object.freeze(Array.prototype),Object.freeze(String.prototype),Object.freeze(Number.prototype),Object.freeze(Boolean.prototype),Bt(),Object.freeze(Date.prototype),Object.freeze(RegExp.prototype)}function Vt(){var e=Object.prototype,t="Object.prototype";qt(e,"__defineGetter__",t),qt(e,"__defineSetter__",t),qt(e,"__lookupGetter__",t),qt(e,"__lookupSetter__",t),qt(e,"constructor",t),qt(e,"hasOwnProperty",t),qt(e,"isPrototypeOf",t),qt(e,"propertyIsEnumerable",t),qt(e,"toLocaleString",t),qt(e,"toString",t),qt(e,"valueOf",t),Object.seal(e)}function Bt(){var e=Error.prototype,t="Error.prototype";qt(e,"name",t),qt(e,"message",t),qt(e,"toString",t),qt(e,"constructor",t),Object.seal(e)}function qt(e,t,n){if(e.hasOwnProperty(t)){var r=e[t];Object.defineProperty(e,t,{get:function(){re
turn r},set:function(r){if(this===e)throw Error("Cannot assign to read only property "+t+" of "+n);return Object.defineProperty(this,t,{value:r,writable:!0}),r}})}}function zt(){return(Ju++).toString()}function Jt(e){var t=Object.prototype.toString.call(e);return t.substring(8,t.length-1)}function Ht(e){if("function"!=typeof btoa)return"";var t=Array.prototype.map.call(new Uint8Array(e),function(e){return String.fromCharCode(e)}).join("");return btoa(t)}function Gt(e){if("function"!=typeof atob)return new ArrayBuffer(0);var t=atob(e),n=new Uint8Array(t.length);return Array.prototype.forEach.call(t,function(e,t){n[t]=e.charCodeAt(0)}),n.buffer}function Xt(e){var t=Jt(e);switch(t){case"Undefined":case"Null":return"";case"RegExp":return e.toString();case"Date":return e.toISOString();case"Number":case"String":case"Boolean":case"Array":case"Object":return e;case"ArrayBuffer":return{"@type":"binary",dataType:t,base64:Ht(e)};case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int
16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":
-case"Float64Array":return{"@type":"binary",dataType:t,base64:Ht(e.buffer)};default:return JSON.stringify(e)}}function Kt(e){if("Object"===Jt(e)){if(e["@type"]&&"binary"===e["@type"])return Gt(e.base64||"");var t={};for(var n in e)t[n]=Kt(e[n]);return t}return"Array"===Jt(e)?e.map(Kt):e}function Zt(e,t){e&&(Gu[e]=t)}function Qt(e){return Gu[e]}function Yt(e){delete Gu[e]}function en(e){var t=Gu[e];return t&&t.taskCenter?t.taskCenter:null}function tn(e,t,n){var r=e.documentElement;if(!(r.pureChildren.length>0||t.parentNode)){var o=r.children,i=o.indexOf(n);i<0?o.push(t):o.splice(i,0,t),1===t.nodeType?("body"===t.role?(t.docId=e.id,t.ownerDocument=e,t.parentNode=r,on(t,r)):(t.children.forEach(function(e){e.parentNode=t}),rn(e,t),t.docId=e.id,t.ownerDocument=e,on(t,r),delete e.nodeMap[t.nodeId]),r.pureChildren.push(t),nn(e,t)):(t.parentNode=r,e.nodeMap[t.ref]=t)}}function nn(e,t){var n=t.toJSON(),r=n.children;delete n.children;var o=e.taskCenter.send("dom",{action:"createBody"},[n]);ret
urn r&&r.forEach(function(t){o=e.taskCenter.send("dom",{action:"addElement"},[n.ref,t,-1])}),o}function rn(e,t){t.role="body",t.depth=1,delete e.nodeMap[t.nodeId],t.ref="_root",e.nodeMap._root=t,e.body=t}function on(e,t){e.parentNode=t,t.docId&&(e.docId=t.docId,e.ownerDocument=t.ownerDocument,e.ownerDocument.nodeMap[e.nodeId]=e,e.depth=t.depth+1),e.children.forEach(function(t){on(t,e)})}function an(e){for(;e;){if(1===e.nodeType)return e;e=e.nextSibling}}function sn(e){for(;e;){if(1===e.nodeType)return e;e=e.previousSibling}}function un(e,t,n,r){n<0&&(n=0);var o=t[n-1],i=t[n];return t.splice(n,0,e),r&&(o&&(o.nextSibling=e),e.previousSibling=o,e.nextSibling=i,i&&(i.previousSibling=e)),n}function cn(e,t,n,r){var o=t.indexOf(e);if(o<0)return-1;if(r){var i=t[o-1],a=t[o+1];i&&(i.nextSibling=a),a&&(a.previousSibling=i)}t.splice(o,1);var s=n;o<=n&&(s=n-1);var u=t[s-1],c=t[s];return t.splice(s,0,e),r&&(u&&(u.nextSibling=e),e.previousSibling=u,e.nextSibling=c,c&&(c.previousSibling=e)),o===s?-
1:n}function ln(e,t,n){var r=t.indexOf(e);if(!(r<0)){if(n){var o=t[r-1],i=t[r+1];o&&(o.nextSibling=i),i&&(i.previousSibling=o)}t.splice(r,1)}}function fn(e,t){if(t&&t.length){var n=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(Ku);t.forEach(function(t){n.prototype[t]=function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];var o=en(this.docId);if(o)return o.send("component",{ref:this.ref,component:e,method:t},n)}}),Zu[e]=n}}function pn(e){return Zu[e]}function dn(e){return"String"===Jt(e)?{"@binding":e}:e}function hn(e){for(var t,n,r=[],o=Qu.lastIndex=0;t=Qu.exec(e);){n=t.index,n>o&&r.push(e.slice(o,n));var i=dn(t[1].trim());r.push(i),o=n+t[0].length}return o<e.length&&r.push(e.slice(o)),1===r.length?r[0]:r}function vn(e){if("String"===Jt(e)&&Qu.test(e))return hn(e);if("Object"===Jt(e)){var t={};for(var n in e)t[n]=vn(e[n]);return t}return"Array"===Jt(e)?e.map(vn):e}function
yn(e,t){Qt(e).nodeMap[t.nodeId]=t}function mn(){var e={createFinish:global.callCreateFinish,updateFinish:global.callUpdateFinish,refreshFinish:global.callRefreshFinish,createBody:global.callCreateBody,addElement:global.callAddElement,removeElement:global.callRemoveElement,moveElement:global.callMoveElement,updateAttrs:global.callUpdateAttrs,updateStyle:global.callUpdateStyle,addEvent:global.callAddEvent,removeEvent:global.callRemoveEvent},t=rc.prototype;for(var n in e)!function(n){var r=e[n];t[n]=r?function(e,t){return r.apply(void 0,[e].concat(t))}:function(e,t){return nc(e,[{module:"dom",method:n,args:t}],"-1")}}(n);t.componentHandler=global.callNativeComponent||function(e,t,n,r,o){return nc(e,[{component:o.component,ref:t,method:n,args:r}])},t.moduleHandler=global.callNativeModule||function(e,t,n,r){return nc(e,[{module:t,method:n,args:r}])}}function _n(e,t){bn(e)?console.warn('Service "'+e+'" has been registered already!'):(t=Object.assign({},t),ac.push({name:e,options:t}))}func
tion gn(e){ac.some(function(t,n){if(t.name===e)return ac.splice(n,1),!0})}function bn(e){return wn(e)>=0}function wn(e){return ac.map(function(e){return e.name}).indexOf(e)}function xn(e){var t=sc.exec(e);if(t)try{return JSON.parse(t[1]).framework}catch(e){}return"Weex"}function En(e,t,n){var r=Object.create(null);return r.service=Object.create(null),ac.forEach(function(o){var i=(o.name,o.options),a=i.create;if(a){var s=a(e,t,n);Object.assign(r.service,s),Object.assign(r,s.instance)}}),delete r.service.instance,Object.freeze(r.service),r}function On(e){if(uc[e])return uc[e].framework}function Sn(e,t,n,r){if(uc[e])return new Error('invalid instance id "'+e+'"');var o=xn(t);n=JSON.parse(JSON.stringify(n||{})),n.env=JSON.parse(JSON.stringify(global.WXEnvironment||{}));var i={config:n,created:Date.now(),framework:o};i.services=En(e,i,ic),uc[e]=i;var a=oc[o];return a?a.createInstance(e,t,n,r,i):new Error('invalid bundle type "'+o+'".')}function Cn(e){cc[e]=function(){for(var t=[],n=argum
ents.length;n--;)t[n]=arguments[n];"registerComponents"===e&&kn(t[0]);for(var r in oc){var o=oc[r];o&&o[e]&&o[e].apply(o,t)}}}function kn(e){Array.isArray(e)&&e.forEach(function(e){e&&e.type&&e.methods&&fn(e.type,e.methods)})}function jn(e){cc[e]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];var r=t[0],o=On(r);if(o&&oc[o]){var i=(s=oc[o])[e].apply(s,t),a={framework:o};return"refreshInstance"===e?ac.forEach(function(e){var t=e.options.refresh;t&&t(r,{info:a,runtime:ic})}):"destroyInstance"===e&&(ac.forEach(function(e){var t=e.options.destroy;t&&t(r,{info:a,runtime:ic})}),delete uc[r]),i}return new Error('invalid instance id "'+r+'"');var s}}function An(e,t){cc[t]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];var r=t[0],o=On(r);return o&&oc[o]?(i=oc[o])[e].apply(i,t):new Error('invalid instance id "'+r+'"');var i}}function In(e){ic=e||{},oc=ic.frameworks||{},mn();for(var t in oc){oc[t].init(e)}return["registerComponents","registerModules","regis
terMethods"].forEach(Cn),["destroyInstance","refreshInstance","receiveTasks","getRoot"].forEach(jn),An("receiveTasks","callJS"),cc}function Tn(e,t){return void 0===t&&(t=[]),{module:"dom",method:e,args:t}}function Nn(e,t){var n=t||global.callNative;return"function"!=typeof n&&console.error("[JS Runtime] no default handler"),function(t){Array.isArray(t)||(t=[t]);for(var r=0;r<t.length;r++){var o=Mn(e,t[r],n);if(-1===o)return o}}}function Pn(e,t){return"dom"===e&&pc[t]&&"function"==typeof global[pc[t]]}function Mn(e,t,n){var r=t.module,o=t.method,i=t.args;return Pn(r,o)?global[pc[o]].apply(global,[e].concat(i,["-1"])):n(e,[t],"-1")}function $n(e,t){var n=t.attrs||{};for(var r in n)e.setAttr(r,n[r],!0);var o=t.style||{};for(var i in o)e.setStyle(i,o[i],!0)}function Rn(){Ut(),Object.freeze(hc.Comment),Object.freeze(hc.Listener),Object.freeze(hc.Document.prototype),Object.freeze(hc.Comment.prototype),Object.freeze(hc.Listener.prototype)}function Dn(e,t){void 0===t&&(t={}),this.type=e||"m
essage",this.data=t.data||null,this.origin=t.origin||"",this.source=t.source||null,this.ports=t.ports||[],this.target=null,this.timeStamp=Date.now()}function Fn(){}function Ln(e,t,n,r){console.warn("[Upgrade Warning] $userTrack will be removed in the next version!"),console.warn("[JS Framework] Vm#$userTrack is deprecated, please use \"require('@weex-module/userTrack').commit(type, name, comName, param)\" instead"),this._app.requireModule("userTrack").commit(e,t,n,r)}function Wn(e,t){if(console.warn("[Upgrade Warning] $sendMtop will be removed in the next version!"),console.warn("[JS Framework] Vm#$sendMtop is deprecated, please use \"require('@weex-module/stream').sendMtop(params, callback)\" instead"),"undefined"==typeof window){this._app.requireModule("windvane").call({class:"MtopWVPlugin",method:"send",data:e},t)}else{this._app.requireModule("stream").sendMtop(e,t)}}function Un(e,t){console.warn("[Upgrade Warning] $callWindvane will be removed in the next version!"),console.warn
("[JS Framework] Vm#$callWindvane is deprecated, please use \"require('@weex-module/windvane').call(params, callback)\" instead"),this._app.requireModule("windvane").call(e,t)}function Vn(e,t){console.warn("[Upgrade Warning] $setSpm will be removed in the next version!"),console.warn("[JS Framework] Vm#$setSpm is deprecated, please use \"require('@weex-module/pageInfo').setSpm(a, b)\" instead"),this._app.requireModule("pageInfo").setSpm(e,t)}function Bn(e){console.warn("[Upgrade Warning] $getUserInfo will be removed in the next version!"),console.warn("[JS Framework] Vm#$getUserInfo is deprecated, please use \"require('@weex-module/user').getUserInfo(callback)\" instead"),this._app.requireModule("user").getUserInfo(e)}function qn(e){console.warn("[Upgrade Warning] $login will be removed in the next version!"),console.warn("[JS Framework] Vm#$login is deprecated, please use \"require('@weex-module/user').login(callback)\" instead"),this._app.requireModule("user").login(e)}function zn
(e){console.warn("[Upgrade Warning] $logout will be removed in the next version!"),console.warn("[JS Framework] Vm#$logout is deprecated, please use \"require('@weex-module/user').logout(callback)\" instead"),this._app.requireModule("user").logout(e)}var Jn,Hn={},Gn={},Xn=Object.freeze({init:e,createInstance:t,destroyInstance:n,getRoot:r,receiveTasks:o}),Kn="undefined"!=typeof window?window:void 0!==global?global:"undefined"!=typeof self?self:{},Zn=a(function(e){e.exports=function(e,t){function n(e){return void 0===e||null===e}function r(e){return void 0!==e&&null!==e}function o(e){return!0===e}function i(e){return!1===e}function a(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}function s(e){return null!==e&&"object"==typeof e}function u(e){return"[object Object]"===kn.call(e)}function c(e){return"[object RegExp]"===kn.call(e)}function l(e){var t=parseFloat(e);return t>=0&&Math.floor(t)===t&&isFinite(e)}function f(e){return null==e?"":"object"==typeof e?JSON.st
ringify(e,null,2):String(e)}function p(e){var t=parseFloat(e);return isNaN(t)?e:t}function d(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o<r.length;o++)n[r[o]]=!0;return t?function(e){return n[e.toLowerCase()]}:function(e){return n[e]}}function h(e,t){if(e.length){var n=e.indexOf(t);if(n>-1)return e.splice(n,1)}}function v(e,t){return An.call(e,t)}function y(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}function m(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n}function _(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function g(e,t){for(var n in t)e[n]=t[n];return e}function b(e){for(var t={},n=0;n<e.length;n++)e[n]&&g(t,e[n]);return t}function w(e,t,n){}function x(e,t){if(e===t)return!0;var n=s(e),r=s(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var o=Array.isArray(e),i=Array.isArray(t);if(o&&i)return e.length===t.length&&e.every(fu
nction(e,n){return x(e,t[n])});if(o||i)return!1;var a=Object.keys(e),u=Object.keys(t);return a.length===u.length&&a.every(function(n){return x(e[n],t[n])})}catch(e){return!1}}function E(e,t){for(var n=0;n<e.length;n++)if(x(e[n],t))return n;return-1}function O(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}}function S(e){var t=(e+"").charCodeAt(0);return 36===t||95===t}function C(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function k(e){if(!Vn.test(e)){var t=e.split(".");return function(e){for(var n=0;n<t.length;n++){if(!e)return;e=e[t[n]]}return e}}}function j(e,t,n){if(Wn.errorHandler)Wn.errorHandler.call(null,e,t,n);else{if(!zn||"undefined"==typeof console)throw e;console.error(e)}}function A(e){return"function"==typeof e&&/native code/.test(e.toString())}function I(e){ar.target&&sr.push(ar.target),ar.target=e}function T(){ar.target=sr.pop()}function N(e,t,n){e.__proto__=t}function P(e,t,n){for(var r=0,o=n.length;r<o;r+
+){var i=n[r];C(e,i,t[i])}}function M(e,t){if(s(e)){var n;return v(e,"__ob__")&&e.__ob__ instanceof pr?n=e.__ob__:fr.shouldConvert&&!tr()&&(Array.isArray(e)||u(e))&&Object.isExtensible(e)&&!e._isVue&&(n=new pr(e)),t&&n&&n.vmCount++,n}}function $(e,t,n,r,o){var i=new ar,a=Object.getOwnPropertyDescriptor(e,t);if(!a||!1!==a.configurable){var s=a&&a.get,u=a&&a.set,c=!o&&M(n);Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var t=s?s.call(e):n;return ar.target&&(i.depend(),c&&c.dep.depend(),Array.isArray(t)&&F(t)),t},set:function(t){var r=s?s.call(e):n;t===r||t!==t&&r!==r||(u?u.call(e,t):n=t,c=!o&&M(t),i.notify())}})}}function R(e,t,n){if(Array.isArray(e)&&l(t))return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(v(e,t))return e[t]=n,n;var r=e.__ob__;return e._isVue||r&&r.vmCount?n:r?($(r.value,t,n),r.dep.notify(),n):(e[t]=n,n)}function D(e,t){if(Array.isArray(e)&&l(t))return void e.splice(t,1);var n=e.__ob__;e._isVue||n&&n.vmCount||v(e,t)&&(delete e[t],n&&n.d
ep.notify())}function F(e){for(var t=void 0,n=0,r=e.length;n<r;n++)t=e[n],t&&t.__ob__&&t.__ob__.dep.depend(),Array.isArray(t)&&F(t)}function L(e,t){if(!t)return e;for(var n,r,o,i=Object.keys(t),a=0;a<i.length;a++)n=i[a],r=e[n],o=t[n],v(e,n)?u(r)&&u(o)&&L(r,o):R(e,n,o);return e}function W(e,t,n){return n?e||t?function(){var r="function"==typeof t?t.call(n):t,o="function"==typeof e?e.call(n):e;return r?L(r,o):o}:void 0:t?e?function(){return L("function"==typeof t?t.call(this):t,"function"==typeof e?e.call(this):e)}:t:e}function U(e,t){return t?e?e.concat(t):Array.isArray(t)?t:[t]:e}function V(e,t){var n=Object.create(e||null);return t?g(n,t):n}function B(e){var t=e.props;if(t){var n,r,o,i={};if(Array.isArray(t))for(n=t.length;n--;)"string"==typeof(r=t[n])&&(o=Tn(r),i[o]={type:null});else if(u(t))for(var a in t)r=t[a],o=Tn(a),i[o]=u(r)?r:{type:r};e.props=i}}function q(e){var t=e.inject;if(Array.isArray(t))for(var n=e.inject={},r=0;r<t.length;r++)n[t[r]]=t[r]}function z(e){var t=e.direc
tives;if(t)for(var n in t){var r=t[n];"function"==typeof r&&(t[n]={bind:r,update:r})}}function J(e,t,n){function r(r){var o=dr[r]||hr;u[r]=o(e[r],t[r],n,r)}"function"==typeof t&&(t=t.options),B(t),q(t),z(t);var o=t.extends;if(o&&(e=J(e,o,n)),t.mixins)for(var i=0,a=t.mixins.length;i<a;i++)e=J(e,t.mixins[i],n);var s,u={};for(s in e)r(s);for(s in t)v(e,s)||r(s);return u}function H(e,t,n,r){if("string"==typeof n){var o=e[t];if(v(o,n))return o[n];var i=Tn(n);if(v(o,i))return o[i];var a=Nn(i);if(v(o,a))return o[a];var s=o[n]||o[i]||o[a];return s}}function G(e,t,n,r){var o=t[e],i=!v(n,e),a=n[e];if(Z(Boolean,o.type)&&(i&&!v(o,"default")?a=!1:Z(String,o.type)||""!==a&&a!==Mn(e)||(a=!0)),void 0===a){a=X(r,o,e);var s=fr.shouldConvert;fr.shouldConvert=!0,M(a),fr.shouldConvert=s}return a}function X(e,t,n){if(v(t,"default")){var r=t.default;return e&&e.$options.propsData&&void 0===e.$options.propsData[n]&&void 0!==e._props[n]?e._props[n]:"function"==typeof r&&"Function"!==K(t.type)?r.call(e):r}}f
unction K(e){var t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:""}function Z(e,t){if(!Array.isArray(t))return K(t)===K(e);for(var n=0,r=t.length;n<r;n++)if(K(t[n])===K(e))return!0;return!1}function Q(e){return new vr(void 0,void 0,void 0,String(e))}function Y(e,t){var n=new vr(e.tag,e.data,e.children,e.text,e.elm,e.context,e.componentOptions,e.asyncFactory);return n.ns=e.ns,n.isStatic=e.isStatic,n.key=e.key,n.isComment=e.isComment,n.isCloned=!0,t&&e.children&&(n.children=ee(e.children)),n}function ee(e,t){for(var n=e.length,r=new Array(n),o=0;o<n;o++)r[o]=Y(e[o],t);return r}function te(e){function t(){var e=arguments,n=t.fns;if(!Array.isArray(n))return n.apply(null,arguments);for(var r=n.slice(),o=0;o<r.length;o++)r[o].apply(null,e)}return t.fns=e,t}function ne(e,t,r,o,i){var a,s,c,l,f;for(a in e)s=c=e[a],l=t[a],f=gr(a),u(s)&&(c=s.handler,f.params=s.params),n(c)||(n(l)?(n(c.fns)&&(c=e[a]=te(c)),r(f.name,c,f.once,f.capture,f.passive,f.params)):c!==l&&(l.fns=c,e[a]=l));f
or(a in t)n(e[a])&&(f=gr(a),o(f.name,t[a],f.capture))}function re(e,t,i){function a(){i.apply(this,arguments),h(s.fns,a)}var s,u=e[t];n(u)?s=te([a]):r(u.fns)&&o(u.merged)?(s=u,s.fns.push(a)):s=te([u,a]),s.merged=!0,e[t]=s}function oe(e,t,o){var i=t.options.props;if(!n(i)){var a={},s=e.attrs,u=e.props;if(r(s)||r(u))for(var c in i){var l=Mn(c);ie(a,u,c,l,!0)||ie(a,s,c,l,!1)}return a}}function ie(e,t,n,o,i){if(r(t)){if(v(t,n))return e[n]=t[n],i||delete t[n],!0;if(v(t,o))return e[n]=t[o],i||delete t[o],!0}return!1}function ae(e){for(var t=0;t<e.length;t++)if(Array.isArray(e[t]))return Array.prototype.concat.apply([],e);return e}function se(e){return a(e)?[Q(e)]:Array.isArray(e)?ce(e):void 0}function ue(e){return r(e)&&r(e.text)&&i(e.isComment)}function ce(e,t){var i,s,u,c=[];for(i=0;i<e.length;i++)s=e[i],n(s)||"boolean"==typeof s||(u=c[c.length-1],Array.isArray(s)?c.push.apply(c,ce(s,(t||"")+"_"+i)):a(s)?ue(u)?u.text+=String(s):""!==s&&c.push(Q(s)):ue(s)&&ue(u)?c[c.length-1]=Q(u.text+s.
text):(o(e._isVList)&&r(s.tag)&&n(s.key)&&r(t)&&(s.key="__vlist"+t+"_"+i+"__"),c.push(s)));return c}function le(e,t){return e.__esModule&&e.default&&(e=e.default),s(e)?t.extend(e):e}function fe(e,t,n,r,o){var i=_r();return i.asyncFactory=e,i.asyncMeta={data:t,context:n,children:r,tag:o},i}function pe(e,t,i){if(o(e.error)&&r(e.errorComp))return e.errorComp;if(r(e.resolved))return e.resolved;if(o(e.loading)&&r(e.loadingComp))return e.loadingComp;if(!r(e.contexts)){var a=e.contexts=[i],u=!0,c=function(){for(var e=0,t=a.length;e<t;e++)a[e].$forceUpdate()},l=O(function(n){e.resolved=le(n,t),u||c()}),f=O(function(t){r(e.errorComp)&&(e.error=!0,c())}),p=e(l,f);return s(p)&&("function"==typeof p.then?n(e.resolved)&&p.then(l,f):r(p.component)&&"function"==typeof p.component.then&&(p.component.then(l,f),r(p.error)&&(e.errorComp=le(p.error,t)),r(p.loading)&&(e.loadingComp=le(p.loading,t),0===p.delay?e.loading=!0:setTimeout(function(){n(e.resolved)&&n(e.error)&&(e.loading=!0,c())},p.delay||200)
),r(p.timeout)&&setTimeout(function(){n(e.resolved)&&f(null)},p.timeout))),u=!1,e.loading?e.loadingComp:e.resolved}e.contexts.push(i)}function de(e){return e.isComment&&e.asyncFactory}function he(e){if(Array.isArray(e))for(var t=0;t<e.length;t++){var n=e[t];if(r(n)&&(r(n.componentOptions)||de(n)))return n}}function ve(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&_e(e,t)}function ye(e,t,n){n?mr.$once(e,t):mr.$on(e,t)}function me(e,t){mr.$off(e,t)}function _e(e,t,n){mr=e,ne(t,n||{},ye,me,e)}function ge(e,t){var n={};if(!e)return n;for(var r=[],o=0,i=e.length;o<i;o++){var a=e[o];if(a.context!==t&&a.functionalContext!==t||!a.data||null==a.data.slot)r.push(a);else{var s=a.data.slot,u=n[s]||(n[s]=[]);"template"===a.tag?u.push.apply(u,a.children):u.push(a)}}return r.every(be)||(n.default=r),n}function be(e){return e.isComment||" "===e.text}function we(e,t){t=t||{};for(var n=0;n<e.length;n++)Array.isArray(e[n])?we(e[n],t):t[e[n].key]=e[n].fn;retur
n t}function xe(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}function Ee(e,t,n){e.$el=t,e.$options.render||(e.$options.render=_r),je(e,"beforeMount");var r;return r=function(){e._update(e._render(),n)},e._watcher=new jr(e,r,w),n=!1,null==e.$vnode&&(e._isMounted=!0,je(e,"mounted")),e}function Oe(e,t,n,r,o){var i=!!(o||e.$options._renderChildren||r.data.scopedSlots||e.$scopedSlots!==Un);if(e.$options._parentVnode=r,e.$vnode=r,e._vnode&&(e._vnode.parent=r),e.$options._renderChildren=o,e.$attrs=r.data&&r.data.attrs||Un,e.$listeners=n||Un,t&&e.$options.props){fr.shouldConvert=!1;for(var a=e._props,s=e.$options._propKeys||[],u=0;u<s.length;u++){var c=s[u];a[c]=G(c,e.$options.props,t,e)}fr.shouldConvert=!0,e.$options.propsData=t}if(n){var l=e.$options
._parentListeners;e.$options._parentListeners=n,_e(e,n,l)}i&&(e.$slots=ge(o,r.context),e.$forceUpdate())}function Se(e){for(;e&&(e=e.$parent);)if(e._inactive)return!0;return!1}function Ce(e,t){if(t){if(e._directInactive=!1,Se(e))return}else if(e._directInactive)return;if(e._inactive||null===e._inactive){e._inactive=!1;for(var n=0;n<e.$children.length;n++)Ce(e.$children[n]);je(e,"activated")}}function ke(e,t){if(!(t&&(e._directInactive=!0,Se(e))||e._inactive)){e._inactive=!0;for(var n=0;n<e.$children.length;n++)ke(e.$children[n]);je(e,"deactivated")}}function je(e,t){var n=e.$options[t];if(n)for(var r=0,o=n.length;r<o;r++)try{n[r].call(e)}catch(n){j(n,e,t+" hook")}e._hasHookEvent&&e.$emit("hook:"+t)}function Ae(){Cr=wr.length=xr.length=0,Er={},Or=Sr=!1}function Ie(){Sr=!0;var e,t;for(wr.sort(function(e,t){return e.id-t.id}),Cr=0;Cr<wr.length;Cr++)e=wr[Cr],t=e.id,Er[t]=null,e.run();var n=xr.slice(),r=wr.slice();Ae(),Pe(n),Te(r),nr&&Wn.devtools&&nr.emit("flush")}function Te(e){for(var
t=e.length;t--;){var n=e[t],r=n.vm;r._watcher===n&&r._isMounted&&je(r,"updated")}}function Ne(e){e._inactive=!1,xr.push(e)}function Pe(e){for(var t=0;t<e.length;t++)e[t]._inactive=!0,Ce(e[t],!0)}function Me(e){var t=e.id;if(null==Er[t]){if(Er[t]=!0,Sr){for(var n=wr.length-1;n>Cr&&wr[n].id>e.id;)n--;wr.splice(n+1,0,e)}else wr.push(e);Or||(Or=!0,or(Ie))}}function $e(e){Ar.clear(),Re(e,Ar)}function Re(e,t){var n,r,o=Array.isArray(e);if((o||s(e))&&Object.isExtensible(e)){if(e.__ob__){var i=e.__ob__.dep.id;if(t.has(i))return;t.add(i)}if(o)for(n=e.length;n--;)Re(e[n],t);else for(r=Object.keys(e),n=r.length;n--;)Re(e[r[n]],t)}}function De(e,t,n){Ir.get=function(){return this[t][n]},Ir.set=function(e){this[t][n]=e},Object.defineProperty(e,n,Ir)}function Fe(e){e._watchers=[];var t=e.$options;t.props&&Le(e,t.props),t.methods&&ze(e,t.methods),t.data?We(e):M(e._data={},!0),t.computed&&Ve(e,t.computed),t.watch&&t.watch!==Xn&&Je(e,t.watch)}function Le(e,t){var n=e.$options.propsData||{},r=e._prop
s={},o=e.$options._propKeys=[],i=!e.$parent;fr.shouldConvert=i;for(var a in t)!function(i){o.push(i);var a=G(i,t,n,e);$(r,i,a),i in e||De(e,"_props",i)}(a);fr.shouldConvert=!0}function We(e){var t=e.$options.data;t=e._data="function"==typeof t?Ue(t,e):t||{},u(t)||(t={});for(var n=Object.keys(t),r=e.$options.props,o=(e.$options.methods,n.length);o--;){var i=n[o];r&&v(r,i)||S(i)||De(e,"_data",i)}M(t,!0)}function Ue(e,t){try{return e.call(t)}catch(e){return j(e,t,"data()"),{}}}function Ve(e,t){var n=e._computedWatchers=Object.create(null),r=tr();for(var o in t){var i=t[o],a="function"==typeof i?i:i.get;r||(n[o]=new jr(e,a||w,w,Tr)),o in e||Be(e,o,i)}}function Be(e,t,n){var r=!tr();"function"==typeof n?(Ir.get=r?qe(t):n,Ir.set=w):(Ir.get=n.get?r&&!1!==n.cache?qe(t):n.get:w,Ir.set=n.set?n.set:w),Object.defineProperty(e,t,Ir)}function qe(e){return function(){var t=this._computedWatchers&&this._computedWatchers[e];if(t)return t.dirty&&t.evaluate(),ar.target&&t.depend(),t.value}}function ze
(e,t){e.$options.props;for(var n in t)e[n]=null==t[n]?w:m(t[n],e)}function Je(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var o=0;o<r.length;o++)He(e,n,r[o]);else He(e,n,r)}}function He(e,t,n,r){return u(n)&&(r=n,n=n.handler),"string"==typeof n&&(n=e[n]),e.$watch(t,n,r)}function Ge(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}function Xe(e){var t=Ke(e.$options.inject,e);t&&(fr.shouldConvert=!1,Object.keys(t).forEach(function(n){$(e,n,t[n])}),fr.shouldConvert=!0)}function Ke(e,t){if(e){for(var n=Object.create(null),r=rr?Reflect.ownKeys(e):Object.keys(e),o=0;o<r.length;o++)for(var i=r[o],a=e[i],s=t;s;){if(s._provided&&a in s._provided){n[i]=s._provided[a];break}s=s.$parent}return n}}function Ze(e,t,n,o,i){var a={},s=e.options.props;if(r(s))for(var u in s)a[u]=G(u,s,t||Un);else r(n.attrs)&&Qe(a,n.attrs),r(n.props)&&Qe(a,n.props);var c=Object.create(o),l=function(e,t,n,r){return ot(c,e,t,n,r,!0)},f=e.options.render.call(null,l,{data:n,props:a
,children:i,parent:o,listeners:n.on||Un,injections:Ke(e.options.inject,o),slots:function(){return ge(i,o)}});return f instanceof vr&&(f.functionalContext=o,f.functionalOptions=e.options,n.slot&&((f.data||(f.data={})).slot=n.slot)),f}function Qe(e,t){for(var n in t)e[Tn(n)]=t[n]}function Ye(e,t,i,a,u){if(!n(e)){var c=i.$options._base;if(s(e)&&(e=c.extend(e)),"function"==typeof e){var l;if(n(e.cid)&&(l=e,void 0===(e=pe(l,c,i))))return fe(l,t,i,a,u);t=t||{},gt(e),r(t.model)&&rt(e.options,t);var f=oe(t,e,u);if(o(e.options.functional))return Ze(e,f,t,i,a);var p=t.on;if(t.on=t.nativeOn,o(e.options.abstract)){var d=t.slot;t={},d&&(t.slot=d)}tt(t);var h=e.options.name||u;return new vr("vue-component-"+e.cid+(h?"-"+h:""),t,void 0,void 0,void 0,i,{Ctor:e,propsData:f,listeners:p,tag:u,children:a},l)}}}function et(e,t,n,o){var i=e.componentOptions,a={_isComponent:!0,parent:t,propsData:i.propsData,_componentTag:i.tag,_parentVnode:e,_parentListeners:i.listeners,_renderChildren:i.children,_parentE
lm:n||null,_refElm:o||null},s=e.data.inlineTemplate;return r(s)&&(a.render=s.render,a.staticRenderFns=s.staticRenderFns),new i.Ctor(a)}function tt(e){e.hook||(e.hook={});for(var t=0;t<Pr.length;t++){var n=Pr[t],r=e.hook[n],o=Nr[n];e.hook[n]=r?nt(o,r):o}}function nt(e,t){return function(n,r,o,i){e(n,r,o,i),t(n,r,o,i)}}function rt(e,t){var n=e.model&&e.model.prop||"value",o=e.model&&e.model.event||"input";(t.props||(t.props={}))[n]=t.model.value;var i=t.on||(t.on={});r(i[o])?i[o]=[t.model.callback].concat(i[o]):i[o]=t.model.callback}function ot(e,t,n,r,i,s){return(Array.isArray(n)||a(n))&&(i=r,r=n,n=void 0),o(s)&&(i=$r),it(e,t,n,r,i)}function it(e,t,n,o,i){if(r(n)&&r(n.__ob__))return _r();if(r(n)&&r(n.is)&&(t=n.is),!t)return _r();Array.isArray(o)&&"function"==typeof o[0]&&(n=n||{},n.scopedSlots={default:o[0]},o.length=0),i===$r?o=se(o):i===Mr&&(o=ae(o));var a,s;if("string"==typeof t){var u;s=e.$vnode&&e.$vnode.ns||Wn.getTagNamespace(t),a=Wn.isReservedTag(t)?new vr(Wn.parsePlatformTagN
ame(t),n,o,void 0,void 0,e):r(u=H(e.$options,"components",t))?Ye(u,n,e,o,t):new vr(t,n,o,void 0,void 0,e)}else a=Ye(t,n,e,o);return r(a)?(s&&at(a,s),a):_r()}function at(e,t){if(e.ns=t,"foreignObject"!==e.tag&&r(e.children))for(var o=0,i=e.children.length;o<i;o++){var a=e.children[o];r(a.tag)&&n(a.ns)&&at(a,t)}}function st(e,t){var n,o,i,a,u;if(Array.isArray(e)||"string"==typeof e)for(n=new Array(e.length),o=0,i=e.length;o<i;o++)n[o]=t(e[o],o);else if("number"==typeof e)for(n=new Array(e),o=0;o<e;o++)n[o]=t(o+1,o);else if(s(e))for(a=Object.keys(e),n=new Array(a.length),o=0,i=a.length;o<i;o++)u=a[o],n[o]=t(e[u],u,o);return r(n)&&(n._isVList=!0),n}function ut(e,t,n,r){var o=this.$scopedSlots[e];if(o)return n=n||{},r&&(n=g(g({},r),n)),o(n)||t;var i=this.$slots[e];return i||t}function ct(e){return H(this.$options,"filters",e,!0)||Rn}function lt(e,t,n){var r=Wn.keyCodes[t]||n;return Array.isArray(r)?-1===r.indexOf(e):r!==e}function ft(e,t,n,r,o){if(n)if(s(n)){Array.isArray(n)&&(n=b(n));va
r i;for(var a in n)!function(a){if("class"===a||"style"===a||jn(a))i=e;else{var s=e.attrs&&e.attrs.type;i=r||Wn.mustUseProp(t,s,a)?e.domProps||(e.domProps={}):e.attrs||(e.attrs={})}if(!(a in i)&&(i[a]=n[a],o)){(e.on||(e.on={}))["update:"+a]=function(e){n[a]=e}}}(a)}else;return e}function pt(e,t){var n=this._staticTrees[e];return n&&!t?Array.isArray(n)?ee(n):Y(n):(n=this._staticTrees[e]=this.$options.staticRenderFns[e].call(this._renderProxy),ht(n,"__static__"+e,!1),n)}function dt(e,t,n){return ht(e,"__once__"+t+(n?"_"+n:""),!0),e}function ht(e,t,n){if(Array.isArray(e))for(var r=0;r<e.length;r++)e[r]&&"string"!=typeof e[r]&&vt(e[r],t+"_"+r,n);else vt(e,t,n)}function vt(e,t,n){e.isStatic=!0,e.key=t,e.isOnce=n}function yt(e,t){if(t)if(u(t)){var n=e.on=e.on?g({},e.on):{};for(var r in t){var o=n[r],i=t[r];n[r]=o?[].concat(i,o):i}}else;return e}function mt(e){e._vnode=null,e._staticTrees=null;var t=e.$vnode=e.$options._parentVnode,n=t&&t.context;e.$slots=ge(e.$options._renderChildren,n),e
.$scopedSlots=Un,e._c=function(t,n,r,o){return ot(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return ot(e,t,n,r,o,!0)};var r=t&&t.data;$(e,"$attrs",r&&r.attrs||Un,null,!0),$(e,"$listeners",e.$options._parentListeners||Un,null,!0)}function _t(e,t){var n=e.$options=Object.create(e.constructor.options);n.parent=t.parent,n.propsData=t.propsData,n._parentVnode=t._parentVnode,n._parentListeners=t._parentListeners,n._renderChildren=t._renderChildren,n._componentTag=t._componentTag,n._parentElm=t._parentElm,n._refElm=t._refElm,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}function gt(e){var t=e.options;if(e.super){var n=gt(e.super);if(n!==e.superOptions){e.superOptions=n;var r=bt(e);r&&g(e.extendOptions,r),t=e.options=J(n,e.extendOptions),t.name&&(t.components[t.name]=e)}}return t}function bt(e){var t,n=e.options,r=e.extendOptions,o=e.sealedOptions;for(var i in n)n[i]!==o[i]&&(t||(t={}),t[i]=wt(n[i],r[i],o[i]));return t}function wt(e,t,n){if(Array.isArray(e)){var r
=[];n=Array.isArray(n)?n:[n],t=Array.isArray(t)?t:[t];for(var o=0;o<e.length;o++)(t.indexOf(e[o])>=0||n.indexOf(e[o])<0)&&r.push(e[o]);return r}return e}function xt(e){this._init(e)}function Et(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=_(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}function Ot(e){e.mixin=function(e){return this.options=J(this.options,e),this}}function St(e){e.cid=0;var t=1;e.extend=function(e){e=e||{};var n=this,r=n.cid,o=e._Ctor||(e._Ctor={});if(o[r])return o[r];var i=e.name||n.options.name,a=function(e){this._init(e)};return a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.cid=t++,a.options=J(n.options,e),a.super=n,a.options.props&&Ct(a),a.options.computed&&kt(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,Fn.forEach(function(e){a[e]=n[e]}),i&&(a.options.components[i]=a),a.super
Options=n.options,a.extendOptions=e,a.sealedOptions=g({},a.options),o[r]=a,a}}function Ct(e){var t=e.options.props;for(var n in t)De(e.prototype,"_props",n)}function kt(e){var t=e.options.computed;for(var n in t)Be(e.prototype,n,t[n])}function jt(e){Fn.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&u(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}function At(e){return e&&(e.Ctor.options.name||e.tag)}function It(e,t){return Array.isArray(e)?e.indexOf(t)>-1:"string"==typeof e?e.split(",").indexOf(t)>-1:!!c(e)&&e.test(t)}function Tt(e,t,n){for(var r in e){var o=e[r];if(o){var i=At(o.componentOptions);i&&!n(i)&&(o!==t&&Nt(o),e[r]=null)}}}function Nt(e){e&&e.componentInstance.$destroy()}function Pt(e){return new t.Element(e)}function Mt(e,n){return new t.Element(e+":"+n)}function $t(e){return new t.TextNode(e)}function Rt(e){return new t.Comment(e)}
function Dt(e,t,n){if(3!==t.nodeType)e.insertBefore(t,n);else if("text"===e.type)e.setAttr("value",t.text),t.parentNode=e;else{var r=Pt("text");r.setAttr("value",t.text),e.insertBefore(r,n)}}function Ft(e,t){if(3===t.nodeType)return void e.setAttr("value","");e.removeChild(t)}function Lt(e,t){if(3!==t.nodeType)e.appendChild(t);else if("text"===e.type)e.setAttr("value",t.text),t.parentNode=e;else{var n=Pt("text");n.setAttr("value",t.text),e.appendChild(n)}}function Wt(e){return e.parentNode}function Ut(e){return e.nextSibling}function Vt(e){return e.type}function Bt(e,t){e.parentNode.setAttr("value",t)}function qt(e,t,n){e.setAttr(t,n)}function zt(e,t){var n=e.data.ref;if(n){var r=e.context,o=e.componentInstance||e.elm,i=r.$refs;t?Array.isArray(i[n])?h(i[n],o):i[n]===o&&(i[n]=void 0):e.data.refInFor?Array.isArray(i[n])?i[n].indexOf(o)<0&&i[n].push(o):i[n]=[o]:i[n]=o}}function Jt(e,t){return e.key===t.key&&(e.tag===t.tag&&e.isComment===t.isComment&&r(e.data)===r(t.data)&&Ht(e,t)||o(e.
isAsyncPlaceholder)&&e.asyncFactory===t.asyncFactory&&n(t.asyncFactory.error))}function Ht(e,t){
-if("input"!==e.tag)return!0;var n,o=r(n=e.data)&&r(n=n.attrs)&&n.type,i=r(n=t.data)&&r(n=n.attrs)&&n.type;return o===i||qr(o)&&qr(i)}function Gt(e,t,n){var o,i,a={};for(o=t;o<=n;++o)i=e[o].key,r(i)&&(a[i]=o);return a}function Xt(e,t){(e.data.directives||t.data.directives)&&Kt(e,t)}function Kt(e,t){var n,r,o,i=e===zr,a=t===zr,s=Zt(e.data.directives,e.context),u=Zt(t.data.directives,t.context),c=[],l=[];for(n in u)r=s[n],o=u[n],r?(o.oldValue=r.value,Yt(o,"update",t,e),o.def&&o.def.componentUpdated&&l.push(o)):(Yt(o,"bind",t,e),o.def&&o.def.inserted&&c.push(o));if(c.length){var f=function(){for(var n=0;n<c.length;n++)Yt(c[n],"inserted",t,e)};i?re(t.data.hook||(t.data.hook={}),"insert",f):f()}if(l.length&&re(t.data.hook||(t.data.hook={}),"postpatch",function(){for(var n=0;n<l.length;n++)Yt(l[n],"componentUpdated",t,e)}),!i)for(n in s)u[n]||Yt(s[n],"unbind",e,e,a)}function Zt(e,t){var n=Object.create(null);if(!e)return n;var r,o;for(r=0;r<e.length;r++)o=e[r],o.modifiers||(o.modifiers=Gr)
,n[Qt(o)]=o,o.def=H(t.$options,"directives",o.name,!0);return n}function Qt(e){return e.rawName||e.name+"."+Object.keys(e.modifiers||{}).join(".")}function Yt(e,t,n,r,o){var i=e.def&&e.def[t];if(i)try{i(n.elm,e,n,r,o)}catch(r){j(r,n.context,"directive "+e.name+" "+t+" hook")}}function en(e,t){if(e.data.attrs||t.data.attrs){var n,r,o=t.elm,i=e.data.attrs||{},a=t.data.attrs||{};a.__ob__&&(a=t.data.attrs=g({},a));for(n in a)r=a[n],i[n]!==r&&o.setAttr(n,r);for(n in i)null==a[n]&&o.setAttr(n)}}function tn(e,t){var n=t.elm,r=t.context,o=t.data,i=e.data;if(o.staticClass||o.class||i&&(i.staticClass||i.class)){var a=[],s=i.staticClass;s&&a.push.apply(a,s),i.class&&a.push.apply(a,i.class);var u=[],c=o.staticClass;c&&u.push.apply(u,c),o.class&&u.push.apply(u,o.class);var l=nn(a,u,r);for(var f in l)n.setStyle(f,l[f])}}function nn(e,t,n){var r=n.$options.style||{},o={};return t.forEach(function(e){g(o,r[e])}),e.forEach(function(e){var t=r[e];for(var n in t)o.hasOwnProperty(n)||(o[n]="")}),o}func
tion rn(e,t,n,r,o,i){if(r)return void console.log("Weex do not support event in bubble phase.");if(n){var a=t,s=Wr;t=function(t){null!==(1===arguments.length?a(t):a.apply(null,arguments))&&on(e,null,null,s)}}Wr.addEvent(e,t,i)}function on(e,t,n,r){(r||Wr).removeEvent(e)}function an(e,t){if(e.data.on||t.data.on){var n=t.data.on||{},r=e.data.on||{};Wr=t.elm,ne(n,r,rn,on,t.context)}}function sn(e,t){if(!t.data.staticStyle)return void un(e,t);var n=t.elm,r=t.data.staticStyle;for(var o in r)r[o]&&n.setStyle(Yr(o),r[o]);un(e,t)}function un(e,t){if(e.data.style||t.data.style){var n,r,o=t.elm,i=e.data.style||{},a=t.data.style||{},s=a.__ob__;Array.isArray(a)&&(a=t.data.style=cn(a)),s&&(a=t.data.style=g({},a));for(r in i)a[r]||o.setStyle(Yr(r),"");for(r in a)n=a[r],o.setStyle(Yr(r),n)}}function cn(e){for(var t={},n=0;n<e.length;n++)e[n]&&g(t,e[n]);return t}function ln(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&g(t,to(e.name||"v")),g(t,e),t}return"string"==typeof e?to(e):void 0
}}function fn(e,t){var n=t.elm;n._leaveCb&&(n._leaveCb.cancelled=!0,n._leaveCb());var r=ln(t.data.transition);if(r&&!n._enterCb){for(var o=r.enterClass,i=r.enterToClass,a=r.enterActiveClass,s=r.appearClass,u=r.appearToClass,c=r.appearActiveClass,l=r.beforeEnter,f=r.enter,p=r.afterEnter,d=r.enterCancelled,h=r.beforeAppear,v=r.appear,y=r.afterAppear,m=r.appearCancelled,_=br,g=br.$vnode;g&&g.parent;)g=g.parent,_=g.context;var b=!_._isMounted||!t.isRootInsert;if(!b||v||""===v){var x=b?s:o,E=b?u:i,S=b?c:a,C=b?h||l:l,k=b&&"function"==typeof v?v:f,j=b?y||p:p,A=b?m||d:d,I=k&&(k._length||k.length)>1,T=t.context.$options.style||{},N=T[x],P=T["@TRANSITION"]&&T["@TRANSITION"][S]||{},M=dn(n,T,x,E,S,t.context),$=Object.keys(M).length>0,R=n._enterCb=O(function(){R.cancelled?A&&A(n):j&&j(n),n._enterCb=null});if(setTimeout(function(){var e=n.parentNode,r=e&&e._pending&&e._pending[t.key];if(r&&r.context===t.context&&r.tag===t.tag&&r.elm._leaveCb&&r.elm._leaveCb(),k&&k(n,R),$){t.context.$requireWeexMo
dule("animation").transition(n.ref,{styles:M,duration:P.duration||0,delay:P.delay||0,timingFunction:P.timingFunction||"linear"},I?w:R)}else I||R()},16),C&&C(n),N)for(var D in N)n.setStyle(D,N[D]);$||I||R()}}}function pn(e,t){function n(){function t(){n.transition(r.ref,{styles:y,duration:m.duration||0,delay:m.delay||0,timingFunction:m.timingFunction||"linear"},d?w:_)}var n=e.context.$requireWeexModule("animation");_.cancelled||(e.data.show||((r.parentNode._pending||(r.parentNode._pending={}))[e.key]=e),u&&u(r),v?n.transition(r.ref,{styles:v},t):t(),c&&c(r,_),y||d||_())}var r=e.elm;r._enterCb&&(r._enterCb.cancelled=!0,r._enterCb());var o=ln(e.data.transition);if(!o)return t();if(!r._leaveCb){var i=o.leaveClass,a=o.leaveToClass,s=o.leaveActiveClass,u=o.beforeLeave,c=o.leave,l=o.afterLeave,f=o.leaveCancelled,p=o.delayLeave,d=c&&(c._length||c.length)>1,h=e.context.$options.style||{},v=h[i],y=h[a]||h[s],m=h["@TRANSITION"]&&h["@TRANSITION"][s]||{},_=r._leaveCb=O(function(){r.parentNode&&r
.parentNode._pending&&(r.parentNode._pending[e.key]=null),_.cancelled?f&&f(r):(t(),l&&l(r)),r._leaveCb=null});p?p(n):n()}}function dn(e,t,n,r,o,i){var a={},s=t[n],u=t[r],c=t[o];if(s)for(var l in s)a[l]=e.style[l];if(c)for(var f in c)0!==f.indexOf("transition")&&(a[f]=c[f]);return u&&g(a,u),a}function hn(e){return e.tag?e.tag.replace(/vue\-component\-(\d+\-)?/,""):""}function vn(e){return e.children&&1===e.children.length&&!e.children[0].tag}function yn(e){var t=String(e).match(so);return t?Number(t[1]):e}function mn(e){if(e&&e.data){var t=e.data,n=t.staticStyle,r=t.staticClass;if(e.data.style||e.data.class||n||r){var o=Object.assign({},n,e.data.style),i=e.context.$options.style||{};[].concat(r,e.data.class).forEach(function(e){e&&i[e]&&Object.assign(o,i[e])});for(var a in o)o[a]=yn(o[a]);return o}}}function _n(e){if(e.length)return e.map(function(e){var t=hn(e),n={type:t};if(t){if(n.style=mn(e),e.data&&(n.attr=e.data.attrs,e.data.on&&(n.events=e.data.on)),"span"===t&&vn(e))return n.
attr=n.attr||{},n.attr.value=e.children[0].text.trim(),n}else n.type="span",n.attr={value:(e.text||"").trim()};return e.children&&e.children.length&&(n.children=_n(e.children)),n})}function gn(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?gn(he(t.children)):e}function bn(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var o=n._parentListeners;for(var i in o)t[Tn(i)]=o[i];return t}function wn(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}function xn(e){for(;e=e.parent;)if(e.data.transition)return!0}function En(e,t){return t.key===e.key&&t.tag===e.tag}function On(){}function Sn(){}function Cn(e,n){var r=new t.Comment("root");return r.hasAttribute=r.removeAttribute=function(){},n.documentElement.appendChild(r),r}var kn=Object.prototype.toString,jn=(d("slot,component",!0),d("key,ref,slot,is")),An=Object.prototype.hasOwnProperty,In=/-(\w)/g,Tn=y(function(e){return e.replace(In,function(e,t){return t?t.toUpp
erCase():""})}),Nn=y(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),Pn=/\B([A-Z])/g,Mn=y(function(e){return e.replace(Pn,"-$1").toLowerCase()}),$n=function(e,t,n){return!1},Rn=function(e){return e},Dn="data-server-rendered",Fn=["component","directive","filter"],Ln=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated"],Wn={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:$n,isReservedAttr:$n,isUnknownElement:$n,getTagNamespace:w,parsePlatformTagName:Rn,mustUseProp:$n,_lifecycleHooks:Ln},Un=Object.freeze({}),Vn=/[^\w.$]/,Bn=w,qn="__proto__"in{},zn="undefined"!=typeof window,Jn=zn&&window.navigator.userAgent.toLowerCase(),Hn=(Jn&&/msie|trident/.test(Jn),Jn&&Jn.indexOf("msie 9.0"),Jn&&Jn.indexOf("edge/")>0),Gn=(Jn&&Jn.indexOf("android"),Jn&&/iphone|ipad|ipod|io
s/.test(Jn)),Xn=(Jn&&/chrome\/\d+/.test(Jn),{}.watch),Zn=!1;if(zn)try{var Qn={};Object.defineProperty(Qn,"passive",{get:function(){Zn=!0}}),window.addEventListener("test-passive",null,Qn)}catch(e){}var Yn,er,tr=function(){return void 0===Yn&&(Yn=!zn&&void 0!==Kn&&"server"===Kn.process.env.VUE_ENV),Yn},nr=zn&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__,rr="undefined"!=typeof Symbol&&A(Symbol)&&"undefined"!=typeof Reflect&&A(Reflect.ownKeys),or=function(){function e(){r=!1;var e=n.slice(0);n.length=0;for(var t=0;t<e.length;t++)e[t]()}var t,n=[],r=!1;if("undefined"!=typeof Promise&&A(Promise)){var o=Promise.resolve(),i=function(e){console.error(e)};t=function(){o.then(e).catch(i),Gn&&setTimeout(w)}}else if("undefined"==typeof MutationObserver||!A(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())t=function(){setTimeout(e,0)};else{var a=1,s=new MutationObserver(e),u=document.createTextNode(String(a));s.observe(u,{characterData:!0}),t=function(){a=(a+1)%2,u.
data=String(a)}}return function(e,o){var i;if(n.push(function(){if(e)try{e.call(o)}catch(e){j(e,o,"nextTick")}else i&&i(o)}),r||(r=!0,t()),!e&&"undefined"!=typeof Promise)return new Promise(function(e,t){i=e})}}();er="undefined"!=typeof Set&&A(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ir=0,ar=function(){this.id=ir++,this.subs=[]};ar.prototype.addSub=function(e){this.subs.push(e)},ar.prototype.removeSub=function(e){h(this.subs,e)},ar.prototype.depend=function(){ar.target&&ar.target.addDep(this)},ar.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t<n;t++)e[t].update()},ar.target=null;var sr=[],ur=Array.prototype,cr=Object.create(ur);["push","pop","shift","unshift","splice","sort","reverse"].forEach(function(e){var t=ur[e];C(cr,e,function(){for(var n=arguments,r=[],o=argument
s.length;o--;)r[o]=n[o];var i,a=t.apply(this,r),s=this.__ob__;switch(e){case"push":case"unshift":i=r;break;case"splice":i=r.slice(2)}return i&&s.observeArray(i),s.dep.notify(),a})});var lr=Object.getOwnPropertyNames(cr),fr={shouldConvert:!0},pr=function(e){if(this.value=e,this.dep=new ar,this.vmCount=0,C(e,"__ob__",this),Array.isArray(e)){(qn?N:P)(e,cr,lr),this.observeArray(e)}else this.walk(e)};pr.prototype.walk=function(e){for(var t=Object.keys(e),n=0;n<t.length;n++)$(e,t[n],e[t[n]])},pr.prototype.observeArray=function(e){for(var t=0,n=e.length;t<n;t++)M(e[t])};var dr=Wn.optionMergeStrategies;dr.data=function(e,t,n){return n?W(e,t,n):t&&"function"!=typeof t?e:W.call(this,e,t)},Ln.forEach(function(e){dr[e]=U}),Fn.forEach(function(e){dr[e+"s"]=V}),dr.watch=function(e,t){if(e===Xn&&(e=void 0),t===Xn&&(t=void 0),!t)return Object.create(e||null);if(!e)return t;var n={};g(n,e);for(var r in t){var o=n[r],i=t[r];o&&!Array.isArray(o)&&(o=[o]),n[r]=o?o.concat(i):Array.isArray(i)?i:[i]}retur
n n},dr.props=dr.methods=dr.inject=dr.computed=function(e,t){if(!e)return t;var n=Object.create(null);return g(n,e),t&&g(n,t),n},dr.provide=W;var hr=function(e,t){return void 0===t?e:t},vr=function(e,t,n,r,o,i,a,s){this.tag=e,this.data=t,this.children=n,this.text=r,this.elm=o,this.ns=void 0,this.context=i,this.functionalContext=void 0,this.key=t&&t.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=s,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1},yr={child:{}};yr.child.get=function(){return this.componentInstance},Object.defineProperties(vr.prototype,yr);var mr,_r=function(e){void 0===e&&(e="");var t=new vr;return t.text=e,t.isComment=!0,t},gr=y(function(e){var t="&"===e.charAt(0);e=t?e.slice(1):e;var n="~"===e.charAt(0);e=n?e.slice(1):e;var r="!"===e.charAt(0);return e=r?e.slice(1):e,{name:e,once:n,capture:r,passive:t}}),br=null,wr=[],xr
=[],Er={},Or=!1,Sr=!1,Cr=0,kr=0,jr=function(e,t,n,r){this.vm=e,e._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++kr,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new er,this.newDepIds=new er,this.expression="","function"==typeof t?this.getter=t:(this.getter=k(t),this.getter||(this.getter=function(){})),this.value=this.lazy?void 0:this.get()};jr.prototype.get=function(){I(this);var e,t=this.vm;try{e=this.getter.call(t,t)}catch(e){if(!this.user)throw e;j(e,t,'getter for watcher "'+this.expression+'"')}finally{this.deep&&$e(e),T(),this.cleanupDeps()}return e},jr.prototype.addDep=function(e){var t=e.id;this.newDepIds.has(t)||(this.newDepIds.add(t),this.newDeps.push(e),this.depIds.has(t)||e.addSub(this))},jr.prototype.cleanupDeps=function(){for(var e=this,t=this.deps.length;t--;){var n=e.deps[t];e.newDepIds.has(n.id)||n.removeSub(e)}var r=this
.depIds;this.depIds=this.newDepIds,this.newDepIds=r,this.newDepIds.clear(),r=this.deps,this.deps=this.newDeps,this.newDeps=r,this.newDeps.length=0},jr.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():Me(this)},jr.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||s(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){j(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},jr.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},jr.prototype.depend=function(){for(var e=this,t=this.deps.length;t--;)e.deps[t].depend()},jr.prototype.teardown=function(){var e=this;if(this.active){this.vm._isBeingDestroyed||h(this.vm._watchers,this);for(var t=this.deps.length;t--;)e.deps[t].removeSub(e);this.active=!1}};var Ar=new er,Ir={enumerable:!0,configurable:!0,get:w,set:w},Tr={lazy:!0},Nr={init:function(e,t,n,r){if(!e.componentInstance||e.componentInstance._
isDestroyed){(e.componentInstance=et(e,br,n,r)).$mount(t?e.elm:void 0,t)}else if(e.data.keepAlive){var o=e;Nr.prepatch(o,o)}},prepatch:function(e,t){var n=t.componentOptions;Oe(t.componentInstance=e.componentInstance,n.propsData,n.listeners,t,n.children)},insert:function(e){var t=e.context,n=e.componentInstance;n._isMounted||(n._isMounted=!0,je(n,"mounted")),e.data.keepAlive&&(t._isMounted?Ne(n):Ce(n,!0))},destroy:function(e){var t=e.componentInstance;t._isDestroyed||(e.data.keepAlive?ke(t,!0):t.$destroy())}},Pr=Object.keys(Nr),Mr=1,$r=2,Rr=0;!function(e){e.prototype._init=function(e){var t=this;t._uid=Rr++,t._isVue=!0,e&&e._isComponent?_t(t,e):t.$options=J(gt(t.constructor),e||{},t),t._renderProxy=t,t._self=t,xe(t),ve(t),mt(t),je(t,"beforeCreate"),Xe(t),Fe(t),Ge(t),je(t,"created"),t.$options.el&&t.$mount(t.$options.el)}}(xt),function(e){var t={};t.get=function(){return this._data};var n={};n.get=function(){return this._props},Object.defineProperty(e.prototype,"$data",t),Object.defi
neProperty(e.prototype,"$props",n),e.prototype.$set=R,e.prototype.$delete=D,e.prototype.$watch=function(e,t,n){var r=this;if(u(t))return He(r,e,t,n);n=n||{},n.user=!0;var o=new jr(r,e,t,n);return n.immediate&&t.call(r,o.value),function(){o.teardown()}}}(xt),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this,o=this;if(Array.isArray(e))for(var i=0,a=e.length;i<a;i++)r.$on(e[i],n);else(o._events[e]||(o._events[e]=[])).push(n),t.test(e)&&(o._hasHookEvent=!0);return o},e.prototype.$once=function(e,t){function n(){r.$off(e,n),t.apply(r,arguments)}var r=this;return n.fn=t,r.$on(e,n),r},e.prototype.$off=function(e,t){var n=this,r=this;if(!arguments.length)return r._events=Object.create(null),r;if(Array.isArray(e)){for(var o=0,i=e.length;o<i;o++)n.$off(e[o],t);return r}var a=r._events[e];if(!a)return r;if(1===arguments.length)return r._events[e]=null,r;for(var s,u=a.length;u--;)if((s=a[u])===t||s.fn===t){a.splice(u,1);break}return r},e.prototype.$emit=function(e){var t=this,
n=t._events[e];if(n){n=n.length>1?_(n):n;for(var r=_(arguments,1),o=0,i=n.length;o<i;o++)try{n[o].apply(t,r)}catch(n){j(n,t,'event handler for "'+e+'"')}}return t}}(xt),function(e){e.prototype._update=function(e,t){var n=this;n._isMounted&&je(n,"beforeUpdate");var r=n.$el,o=n._vnode,i=br;br=n,n._vnode=e,o?n.$el=n.__patch__(o,e):(n.$el=n.__patch__(n.$el,e,t,!1,n.$options._parentElm,n.$options._refElm),n.$options._parentElm=n.$options._refElm=null),br=i,r&&(r.__vue__=null),n.$el&&(n.$el.__vue__=n),n.$vnode&&n.$parent&&n.$vnode===n.$parent._vnode&&(n.$parent.$el=n.$el)},e.prototype.$forceUpdate=function(){var e=this;e._watcher&&e._watcher.update()},e.prototype.$destroy=function(){var e=this;if(!e._isBeingDestroyed){je(e,"beforeDestroy"),e._isBeingDestroyed=!0;var t=e.$parent;!t||t._isBeingDestroyed||e.$options.abstract||h(t.$children,e),e._watcher&&e._watcher.teardown();for(var n=e._watchers.length;n--;)e._watchers[n].teardown();e._data.__ob__&&e._data.__ob__.vmCount--,e._isDestroyed=!
0,e.__patch__(e._vnode,null),je(e,"destroyed"),e.$off(),e.$el&&(e.$el.__vue__=null)}}}(xt),function(e){e.prototype.$nextTick=function(e){return or(e,this)},e.prototype._render=function(){var e=this,t=e.$options,n=t.render,r=t.staticRenderFns,o=t._parentVnode;if(e._isMounted)for(var i in e.$slots){var a=e.$slots[i];a._rendered&&(e.$slots[i]=ee(a,!0))}e.$scopedSlots=o&&o.data.scopedSlots||Un,r&&!e._staticTrees&&(e._staticTrees=[]),e.$vnode=o;var s;try{s=n.call(e._renderProxy,e.$createElement)}catch(t){j(t,e,"render function"),s=e._vnode}return s instanceof vr||(s=_r()),s.parent=o,s},e.prototype._o=dt,e.prototype._n=p,e.prototype._s=f,e.prototype._l=st,e.prototype._t=ut,e.prototype._q=x,e.prototype._i=E,e.prototype._m=pt,e.prototype._f=ct,e.prototype._k=lt,e.prototype._b=ft,e.prototype._v=Q,e.prototype._e=_r,e.prototype._u=we,e.prototype._g=yt}(xt);var Dr=[String,RegExp,Array],Fr={name:"keep-alive",abstract:!0,props:{include:Dr,exclude:Dr},created:function(){this.cache=Object.create(nu
ll)},destroyed:function(){var e=this;for(var t in e.cache)Nt(e.cache[t])},watch:{include:function(e){Tt(this.cache,this._vnode,function(t){return It(e,t)})},exclude:function(e){Tt(this.cache,this._vnode,function(t){return!It(e,t)})}},render:function(){var e=he(this.$slots.default),t=e&&e.componentOptions;if(t){var n=At(t);if(n&&(this.include&&!It(this.include,n)||this.exclude&&It(this.exclude,n)))return e;var r=null==e.key?t.Ctor.cid+(t.tag?"::"+t.tag:""):e.key;this.cache[r]?e.componentInstance=this.cache[r].componentInstance:this.cache[r]=e,e.data.keepAlive=!0}return e}},Lr={KeepAlive:Fr};!function(e){var t={};t.get=function(){return Wn},Object.defineProperty(e,"config",t),e.util={warn:Bn,extend:g,mergeOptions:J,defineReactive:$},e.set=R,e.delete=D,e.nextTick=or,e.options=Object.create(null),Fn.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,g(e.options.components,Lr),Et(e),Ot(e),St(e),jt(e)}(xt),Object.defineProperty(xt.prototype,"$isServer",{get:tr}),
Object.defineProperty(xt.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),xt.version="2.4.2";var Wr,Ur={},Vr=Object.freeze({namespaceMap:Ur,createElement:Pt,createElementNS:Mt,createTextNode:$t,createComment:Rt,insertBefore:Dt,removeChild:Ft,appendChild:Lt,parentNode:Wt,nextSibling:Ut,tagName:Vt,setTextContent:Bt,setAttribute:qt}),Br={create:function(e,t){zt(t)},update:function(e,t){e.data.ref!==t.data.ref&&(zt(e,!0),zt(t))},destroy:function(e){zt(e,!0)}},qr=(d("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgrou
p,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),d("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0),d("text,number,password,search,email,tel,url")),zr=new vr("",{},[]),Jr=["create","activate","update","remove","destroy"],Hr={create:Xt,update:Xt,destroy:function(e){Xt(e,zr)}},Gr=Object.create(null),Xr=[Br,Hr],Kr={create:en,update:en},Zr={create:tn,update:tn},Qr={create:an,update:an},Yr=y(Tn),eo={create:sn,update:un},to=y(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),no=(zn&&window.requestAnimationFrame&&window.requestAnimationFrame.bind(window),{create:fn,activate:fn,remove:pn}),ro=[Kr,Zr,Qr,eo,n
o],oo=ro.concat(Xr),io=function(e){function t(e){return new vr(T.tagName(e).toLowerCase(),{},[],void 0,e)}function i(e,t){function n(){0==--n.listeners&&s(e)}return n.listeners=t,n}function s(e){var t=T.parentNode(e);r(t)&&T.removeChild(t,e)}function u(e,t,n,i,a){if(e.isRootInsert=!a,!c(e,t,n,i)){var s=e.data,u=e.children,l=e.tag;if(r(l)){e.elm=e.ns?T.createElementNS(e.ns,l):T.createElement(l,e),m(e);var f=r(s)&&o(s.appendAsTree);f||(r(s)&&y(e,t),p(n,e.elm,i)),h(e,u,t),f&&(r(s)&&y(e,t),p(n,e.elm,i))}else o(e.isComment)?(e.elm=T.createComment(e.text),p(n,e.elm,i)):(e.elm=T.createTextNode(e.text),p(n,e.elm,i))}}function c(e,t,n,i){var a=e.data;if(r(a)){var s=r(e.componentInstance)&&a.keepAlive;if(r(a=a.hook)&&r(a=a.init)&&a(e,!1,n,i),r(e.componentInstance))return l(e,t),o(s)&&f(e,t,n,i),!0}}function l(e,t){r(e.data.pendingInsert)&&(t.push.apply(t,e.data.pendingInsert),e.data.pendingInsert=null),e.elm=e.componentInstance.$el,v(e)?(y(e,t),m(e)):(zt(e),t.push(e))}function f(e,t,n,o){for(
var i,a=e;a.componentInstance;)if(a=a.componentInstance._vnode,r(i=a.data)&&r(i=i.transition)){for(i=0;i<A.activate.length;++i)A.activate[i](zr,a);t.push(a);break}p(n,e.elm,o)}function p(e,t,n){r(e)&&(r(n)?n.parentNode===e&&T.insertBefore(e,t,n):T.appendChild(e,t))}function h(e,t,n){if(Array.isArray(t))for(var r=0;r<t.length;++r)u(t[r],n,e.elm,null,!0);else a(e.text)&&T.appendChild(e.elm,T.createTextNode(e.text))}function v(e){for(;e.componentInstance;)e=e.componentInstance._vnode;return r(e.tag)}function y(e,t){for(var n=0;n<A.create.length;++n)A.create[n](zr,e);k=e.data.hook,r(k)&&(r(k.create)&&k.create(zr,e),r(k.insert)&&t.push(e))}function m(e){for(var t,n=e;n;)r(t=n.context)&&r(t=t.$options._scopeId)&&T.setAttribute(e.elm,t,""),n=n.parent;r(t=br)&&t!==e.context&&r(t=t.$options._scopeId)&&T.setAttribute(e.elm,t,"")}function _(e,t,n,r,o,i){for(;r<=o;++r)u(n[r],i,e,t)}function g(e){var t,n,o=e.data;if(r(o))for(r(t=o.hook)&&r(t=t.destroy)&&t(e),t=0;t<A.destroy.length;++t)A.destroy[
t](e);if(r(t=e.children))for(n=0;n<e.children.length;++n)g(e.children[n])}function b(e,t,n,o){for(;n<=o;++n){var i=t[n];r(i)&&(r(i.tag)?(w(i),g(i)):s(i.elm))}}function w(e,t){if(r(t)||r(e.data)){var n,o=A.remove.length+1;for(r(t)?t.listeners+=o:t=i(e.elm,o),r(n=e.componentInstance)&&r(n=n._vnode)&&r(n.data)&&w(n,t),n=0;n<A.remove.length;++n)A.remove[n](e,t);r(n=e.data.hook)&&r(n=n.remove)?n(e,t):t()}else s(e.elm)}function x(e,t,o,i,a){for(var s,c,l,f,p=0,d=0,h=t.length-1,v=t[0],y=t[h],m=o.length-1,g=o[0],w=o[m],x=!a;p<=h&&d<=m;)n(v)?v=t[++p]:n(y)?y=t[--h]:Jt(v,g)?(O(v,g,i),v=t[++p],g=o[++d]):Jt(y,w)?(O(y,w,i),y=t[--h],w=o[--m]):Jt(v,w)?(O(v,w,i),x&&T.insertBefore(e,v.elm,T.nextSibling(y.elm)),v=t[++p],w=o[--m]):Jt(y,g)?(O(y,g,i),x&&T.insertBefore(e,y.elm,v.elm),y=t[--h],g=o[++d]):(n(s)&&(s=Gt(t,p,h)),c=r(g.key)?s[g.key]:E(g,t,p,h),n(c)?u(g,i,e,v.elm):(l=t[c],Jt(l,g)?(O(l,g,i),t[c]=void 0,x&&T.insertBefore(e,l.elm,v.elm)):u(g,i,e,v.elm)),g=o[++d]);p>h?(f=n(o[m+1])?null:o[m+1].elm,_(e
,f,o,d,m,i)):d>m&&b(e,t,p,h)}function E(e,t,n,o){for(var i=n;i<o;i++){var a=t[i];if(r(a)&&Jt(e,a))return i}}function O(e,t,i,a){if(e!==t){var s=t.elm=e.elm;if(o(e.isAsyncPlaceholder))return void(r(t.asyncFactory.resolved)?C(e.elm,t,i):t.isAsyncPlaceholder=!0);if(o(t.isStatic)&&o(e.isStatic)&&t.key===e.key&&(o(t.isCloned)||o(t.isOnce)))return void(t.componentInstance=e.componentInstance);var u,c=t.data;r(c)&&r(u=c.hook)&&r(u=u.prepatch)&&u(e,t);var l=e.children,f=t.children;if(r(c)&&v(t)){for(u=0;u<A.update.length;++u)A.update[u](e,t);r(u=c.hook)&&r(u=u.update)&&u(e,t)}n(t.text)?r(l)&&r(f)?l!==f&&x(s,l,f,i,a):r(f)?(r(e.text)&&T.setTextContent(s,""),_(s,null,f,0,f.length-1,i)):r(l)?b(s,l,0,l.length-1):r(e.text)&&T.setTextContent(s,""):e.text!==t.text&&T.setTextContent(s,t.text),r(c)&&r(u=c.hook)&&r(u=u.postpatch)&&u(e,t)}}function S(e,t,n){if(o(n)&&r(e.parent))e.parent.data.pendingInsert=t;else for(var i=0;i<t.length;++i)t[i].data.hook.insert(t[i])}function C(e,t,n){if(o(t.isComment)&
&r(t.asyncFactory))return t.elm=e,t.isAsyncPlaceholder=!0,!0;t.elm=e;var i=t.tag,a=t.data,s=t.children;if(r(a)&&(r(k=a.hook)&&r(k=k.init)&&k(t,!0),r(k=t.componentInstance)))return l(t,n),!0;if(r(i)){if
<TRUNCATED>
[14/14] incubator-weex git commit: improve textdom and refactor
template cache and render function
Posted by gu...@apache.org.
improve textdom and refactor template cache and render function
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/9e6bee8e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/9e6bee8e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/9e6bee8e
Branch: refs/heads/master
Commit: 9e6bee8ee2b2340a79874dcd3314195b324024a1
Parents: 772ac33
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Wed Sep 27 11:06:45 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
.../taobao/weex/bridge/NativeInvokeHelper.java | 2 +-
.../main/java/com/taobao/weex/dom/WXAttr.java | 6 +
.../com/taobao/weex/dom/WXCellDomObject.java | 11 +
.../java/com/taobao/weex/dom/WXDomManager.java | 4 +
.../java/com/taobao/weex/dom/WXDomObject.java | 7 +-
.../taobao/weex/dom/WXRecyclerDomObject.java | 47 +-
.../com/taobao/weex/dom/WXTextDomObject.java | 31 +-
.../com/taobao/weex/dom/binding/ELUtils.java | 2 +
.../java/com/taobao/weex/dom/flex/CSSNode.java | 14 +-
.../taobao/weex/ui/component/WXComponent.java | 10 +-
.../weex/ui/component/binding/Layouts.java | 53 ++-
.../weex/ui/component/binding/Statements.java | 103 +++--
.../ui/component/list/BasicListComponent.java | 1 -
.../taobao/weex/ui/component/list/WXCell.java | 30 ++
.../list/template/CellLifecycleManager.java | 211 ---------
.../component/list/template/DomTreeBuilder.java | 83 ++++
.../component/list/template/TemplateCache.java | 30 ++
.../list/template/TemplateViewHolder.java | 2 +
.../list/template/WXRecyclerTemplateList.java | 443 ++++++++++++-------
.../ui/component/binding/StatementTest.java | 8 +-
20 files changed, 654 insertions(+), 444 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/bridge/NativeInvokeHelper.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/bridge/NativeInvokeHelper.java b/android/sdk/src/main/java/com/taobao/weex/bridge/NativeInvokeHelper.java
index 98381b5..73255db 100644
--- a/android/sdk/src/main/java/com/taobao/weex/bridge/NativeInvokeHelper.java
+++ b/android/sdk/src/main/java/com/taobao/weex/bridge/NativeInvokeHelper.java
@@ -47,7 +47,7 @@ public final class NativeInvokeHelper {
try {
invoker.invoke(target, params);
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new RuntimeException(target + "Invoker " + invoker.toString() ,e);
}
}
}, 0);
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
index c3b0399..b05d46d 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
@@ -19,6 +19,7 @@
package com.taobao.weex.dom;
import static com.taobao.weex.dom.binding.ELUtils.COMPONENT_PROPS;
+import static com.taobao.weex.dom.binding.ELUtils.EXCLUDES_BINDING;
import static java.lang.Boolean.parseBoolean;
import android.support.annotation.NonNull;
@@ -477,6 +478,11 @@ public class WXAttr implements Map<String, Object>,Cloneable {
ELUtils.bindingBlock(value);
return false;
}
+ for(String exclude : EXCLUDES_BINDING){
+ if(key.equals(exclude)){
+ return false;
+ }
+ }
if(ELUtils.isBinding(value)){
if(mBindingAttrs == null){
mBindingAttrs = new ArrayMap<String, Object>();
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/dom/WXCellDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXCellDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXCellDomObject.java
index 6d50ab6..649a09d 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXCellDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXCellDomObject.java
@@ -41,11 +41,22 @@ public class WXCellDomObject extends WXDomObject {
if (WXBasicComponentType.CELL.equals(domObject.getType())
|| WXBasicComponentType.CELL_SLOT.equals(domObject.getType())) {
float w = ((WXRecyclerDomObject) parent).getColumnWidth();
+ if(w <= 0 && parentDom.getColumnCount() <= 1){
+ w = parentDom.getAvailableWidth();
+ if(w <= 0){
+ w = parentDom.getLayoutWidth();
+ if(w <= 0){
+ w = parentDom.getViewPortWidth();
+ }
+ }
+ }
node.setLayoutWidth(w);
+ measureOutput.width = w;
} else if (WXBasicComponentType.HEADER.equals(domObject.getType())){
float w = parentDom.getAvailableWidth();
WXLogUtils.d("getAvailableWidth:"+w);
node.setLayoutWidth(w);
+ measureOutput.width = w;
}
}else if (node instanceof WXCellDomObject){
WXCellDomObject slotDomObject = (WXCellDomObject) node;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java
index 66fd56e..e1ed82f 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java
@@ -178,6 +178,10 @@ public final class WXDomManager {
}
}
+ public DOMActionContext getDomContext(String instanceId){
+ return mDomRegistries.get(instanceId);
+ }
+
/**
* @param action
* @param createContext only true when create body
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
index 001545d..8398a2d 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
@@ -136,6 +136,10 @@ public class WXDomObject extends CSSNode implements Cloneable,ImmutableDomObject
return mRef;
}
+ public void setRef(String ref) {
+ this.mRef = ref;
+ }
+
public String getType(){
return mType;
}
@@ -301,6 +305,7 @@ public class WXDomObject extends CSSNode implements Cloneable,ImmutableDomObject
}
}
+
public boolean isFixed() {
return mStyles == null ? false : mStyles.isFixed();
}
@@ -459,7 +464,7 @@ public class WXDomObject extends CSSNode implements Cloneable,ImmutableDomObject
super.dirty();
}
- /** package **/ void applyStyleToNode() {
+ /** package **/public void applyStyleToNode() {
WXStyle stylesMap = getStyles();
int vp = getViewPortWidth();
if (!stylesMap.isEmpty()) {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
index 1ae3af2..11918e8 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
@@ -27,9 +27,11 @@ import com.taobao.weex.ui.component.WXBasicComponentType;
import com.taobao.weex.utils.WXLogUtils;
import com.taobao.weex.utils.WXViewUtils;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
import java.util.Map;
-import static com.taobao.weex.dom.flex.CSSLayout.DIMENSION_WIDTH;
/**
* Created by zhengshihan on 2017/2/21.
@@ -43,6 +45,10 @@ public class WXRecyclerDomObject extends WXDomObject{
private float mAvailableWidth = 0;
private boolean mIsPreCalculateCellWidth =false;
+ /**cell-slot not on the tree */
+ private List<WXCellDomObject> cellList;
+
+
public float getAvailableWidth() {
return WXViewUtils.getRealPxByWidth(mAvailableWidth,getViewPortWidth());
}
@@ -64,9 +70,18 @@ public class WXRecyclerDomObject extends WXDomObject{
}
@Override
public void add(WXDomObject child, int index) {
- super.add(child, index);
+ if(WXBasicComponentType.CELL_SLOT.equals(child.getType())
+ && child instanceof WXCellDomObject){
+ if(cellList == null){
+ cellList = Collections.synchronizedList(new ArrayList<WXCellDomObject>());
+ }
+ cellList.add((WXCellDomObject)child);
+ }else{
+ super.add(child, index);
+ }
- if (WXBasicComponentType.CELL.equals(child.getType())) {
+ if (WXBasicComponentType.CELL.equals(child.getType())
+ || WXBasicComponentType.CELL_SLOT.equals(child.getType())) {
if (!mIsPreCalculateCellWidth) {
preCalculateCellWidth();
}
@@ -77,6 +92,22 @@ public class WXRecyclerDomObject extends WXDomObject{
}
@Override
+ public void remove(WXDomObject child) {
+ if(cellList != null){
+ cellList.remove(child);
+ }
+ super.remove(child);
+ }
+
+ @Override
+ public void removeFromDom(WXDomObject child) {
+ if(cellList != null){
+ cellList.remove(child);
+ }
+ super.removeFromDom(child);
+ }
+
+ @Override
public float getStyleWidth() {
float width = getLayoutWidth();
if (Float.isNaN(width) || width <= 0){
@@ -192,4 +223,14 @@ public class WXRecyclerDomObject extends WXDomObject{
return Constants.Orientation.VERTICAL;
}
+ @Override
+ public WXDomObject clone() {
+ WXRecyclerDomObject domObject = (WXRecyclerDomObject) super.clone();
+ domObject.cellList = cellList;
+ return domObject;
+ }
+
+ public List<WXCellDomObject> getCellList() {
+ return cellList;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
index 3456bde..bdcfd39 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
@@ -39,6 +39,8 @@ import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.AlignmentSpan;
import android.text.style.ForegroundColorSpan;
+import android.util.Log;
+
import com.taobao.weex.WXEnvironment;
import com.taobao.weex.common.Constants;
import com.taobao.weex.common.WXThread;
@@ -98,9 +100,16 @@ public class WXTextDomObject extends WXDomObject {
if (CSSConstants.isUndefined(width)) {
width = node.cssstyle.maxWidth;
}
- if(textDomObject.getTextWidth(textDomObject.mTextPaint,width,false)>0) {
- textDomObject.layout = textDomObject.createLayout(width, false, null);
- textDomObject.hasBeenMeasured = true;
+ boolean forceWidth = false;
+ if(width > 0){
+ if(node.getParent() != null && textDomObject.mAlignment == Layout.Alignment.ALIGN_CENTER){
+ forceWidth = FloatUtil.floatsEqual(width, node.getParent().getLayoutWidth());
+ }
+ }
+ textDomObject.hasBeenMeasured = true;
+ width = textDomObject.getTextWidth(textDomObject.mTextPaint,width, forceWidth);
+ if(width > 0 && textDomObject.mText != null) {
+ textDomObject.layout = textDomObject.createLayout(width, true, null);
textDomObject.previousWidth = textDomObject.layout.getWidth();
measureOutput.height = textDomObject.layout.getHeight();
measureOutput.width = textDomObject.previousWidth;
@@ -186,7 +195,7 @@ public class WXTextDomObject extends WXDomObject {
hasBeenMeasured = false;
if (layout != null && !layout.equals(atomicReference.get()) &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- if(Thread.currentThread() instanceof WXThread){
+ if(Thread.currentThread() != Looper.getMainLooper().getThread()){
warmUpTextLayoutCache(layout);
}
}
@@ -241,8 +250,12 @@ public class WXTextDomObject extends WXDomObject {
float contentWidth = WXDomUtils.getContentWidth(this);
if (contentWidth > 0) {
spanned = createSpanned(mText);
- layout = createLayout(contentWidth, true, layout);
- previousWidth = layout.getWidth();
+ if(mText != null){
+ layout = createLayout(contentWidth, true, layout);
+ previousWidth = layout.getWidth();
+ }else{
+ previousWidth = 0;
+ }
}
}
@@ -394,6 +407,12 @@ public class WXTextDomObject extends WXDomObject {
* outerWidth in case of outerWidth is defined, in other case, it will be outer width.
*/
float getTextWidth(TextPaint textPaint,float outerWidth, boolean forceToDesired) {
+ if(mText == null){
+ if(forceToDesired){
+ return outerWidth;
+ }
+ return 0;
+ }
float textWidth;
if (forceToDesired) {
textWidth = outerWidth;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/dom/binding/ELUtils.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/binding/ELUtils.java b/android/sdk/src/main/java/com/taobao/weex/dom/binding/ELUtils.java
index c0924f0..8202a46 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/binding/ELUtils.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/binding/ELUtils.java
@@ -41,6 +41,8 @@ public class ELUtils {
public static final String COMPONENT_PROPS = "@componentProps";
+ public static final String[] EXCLUDES_BINDING = {"clickEventParams"};
+
/**
* @param value check object is binding expression
* */
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java
index 3f55245..79ba6e5 100755
--- a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java
@@ -9,6 +9,9 @@ package com.taobao.weex.dom.flex;
import android.support.annotation.NonNull;
+import com.taobao.weex.WXEnvironment;
+import com.taobao.weex.utils.WXLogUtils;
+
import java.util.ArrayList;
import static com.taobao.weex.dom.flex.CSSLayout.DIMENSION_HEIGHT;
@@ -54,6 +57,10 @@ public class CSSNode {
dirty();
}
+ public void markLayoutStateUpdated(){
+ this.mLayoutState = LayoutState.UP_TO_DATE;
+ }
+
/**
* whether layout changed when {@link #updateLastLayout(CSSLayout)} invoked last time.
* @return
@@ -165,12 +172,15 @@ public class CSSNode {
if (mLayoutState == LayoutState.DIRTY) {
return;
} else if (mLayoutState == LayoutState.HAS_NEW_LAYOUT) {
- throw new IllegalStateException("Previous csslayout was ignored! markLayoutSeen() never called");
+ if(WXEnvironment.isApkDebugable()){
+ WXLogUtils.w("weex", new IllegalStateException("Previous csslayout was ignored! markLayoutSeen() never called"));
+ }
+ markLayoutSeen();
}
mLayoutState = LayoutState.DIRTY;
- if (mParent != null) {
+ if (mParent != null && !mParent.isDirty()) {
mParent.dirty();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
index e9d7296..f735e4e 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
@@ -337,7 +337,7 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi
long startNanos = System.nanoTime();
if(!isLazy()) {
if (component == null) {
- component = this;
+ component = this;
}
setLayout(component.getDomObject());
setPadding(component.getDomObject().getPadding(), component.getDomObject().getBorder());
@@ -1408,6 +1408,14 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi
view.setVisibility(View.GONE);
}
}
+ if(mDomObj != null){
+ WXDomObject domObject = (WXDomObject) mDomObj;
+ if (TextUtils.equals(visibility, Constants.Value.VISIBLE)) {
+ domObject.setVisible(true);
+ } else if (TextUtils.equals(visibility, Constants.Value.HIDDEN)) {
+ domObject.setVisible(false);
+ }
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
index 5b8d32c..1e48ea7 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
@@ -28,9 +28,11 @@ import com.taobao.weex.WXSDKInstance;
import com.taobao.weex.common.Constants;
import com.taobao.weex.dom.WXDomObject;
import com.taobao.weex.dom.flex.CSSLayoutContext;
+import com.taobao.weex.dom.flex.CSSNode;
import com.taobao.weex.ui.component.WXComponent;
import com.taobao.weex.ui.component.WXVContainer;
import com.taobao.weex.ui.component.list.template.TemplateViewHolder;
+import com.taobao.weex.ui.component.list.template.WXRecyclerTemplateList;
import com.taobao.weex.utils.WXLogUtils;
/**
@@ -41,35 +43,41 @@ public class Layouts {
* do dom layout async or sync , and set layout to component on main.
* on first use do sync layout, when compontnet reuse do async layout
* */
- public static void doLayoutAsync(final TemplateViewHolder templateViewHolder){
+ public static void doLayoutAsync(final TemplateViewHolder templateViewHolder, boolean async){
final WXComponent component = templateViewHolder.getComponent();
final int position = templateViewHolder.getHolderPosition();
if(templateViewHolder.asyncTask != null){
- templateViewHolder.asyncTask.cancel(true);
+ templateViewHolder.asyncTask.cancel(false);
templateViewHolder.asyncTask = null;
}
- AsyncTask<Void, Void, Void> asyncTask = new AsyncTask<Void, Void, Void>() {
- @Override
- protected Void doInBackground(Void... params) {
- if(templateViewHolder.getHolderPosition() == position){
- if(component.getInstance() != null && !component.getInstance().isDestroy()) {
- doSafeLayout(component, templateViewHolder.getLayoutContext());
+ if(async){
+ AsyncTask<Void, Void, Void> asyncTask = new AsyncTask<Void, Void, Void>() {
+ @Override
+ protected Void doInBackground(Void... params) {
+ if(templateViewHolder.getHolderPosition() == position){
+ if(component.getInstance() != null && !component.getInstance().isDestroy()) {
+ doSafeLayout(component, templateViewHolder.getLayoutContext());
+ }
}
+ return null;
}
- return null;
- }
- @Override
- protected void onPostExecute(Void aVoid) {
- if(position == templateViewHolder.getHolderPosition()) {
- if(component.getInstance() != null && !component.getInstance().isDestroy()) {
- setLayout(component, false);
+ @Override
+ protected void onPostExecute(Void aVoid) {
+ if(position == templateViewHolder.getHolderPosition()) {
+ if(component.getInstance() != null && !component.getInstance().isDestroy()) {
+ setLayout(component, false);
+ }
}
}
- }
- };
- templateViewHolder.asyncTask = asyncTask;
- asyncTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); //serial executor is better
+ };
+ templateViewHolder.asyncTask = asyncTask;
+ asyncTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); //serial executor is better
+ }else{
+ doSafeLayout(component, templateViewHolder.getLayoutContext());
+ Log.e("weex", "weex" + component.getLayoutHeight() + " " + component.getLayoutWidth());
+ setLayout(component, false);
+ }
}
@@ -81,13 +89,13 @@ public class Layouts {
long start = System.currentTimeMillis();
doLayout(component, layoutContext);
if(WXEnvironment.isApkDebugable()){
- WXLogUtils.d("WXTemplateList",
+ WXLogUtils.d(WXRecyclerTemplateList.TAG, "WXTemplateList doSafeLayout" +
component.getDomObject().getAttrs().get(Constants.Name.Recycler.SLOT_TEMPLATE_TYPE) + Thread.currentThread().getName() + " doSafeLayout used " +
(System.currentTimeMillis() - start));
}
}catch (Exception e){
if(WXEnvironment.isApkDebugable()){
- WXLogUtils.e("WXTemplateListdoSafeLayout", e);
+ WXLogUtils.e(WXRecyclerTemplateList.TAG, e);
}
}
}
@@ -135,6 +143,9 @@ public class Layouts {
WXDomObject domObject = (WXDomObject) component.getDomObject();
if(domObject.hasUpdate() || force){
domObject.markUpdateSeen();
+ if(domObject.hasUpdate()){
+ domObject.markLayoutStateUpdated();
+ }
component.setLayout(component.getDomObject());
if(component.getDomObject().getExtra() != null){
component.updateExtra(component.getDomObject().getExtra());
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java
index 6912335..1af8934 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java
@@ -25,6 +25,8 @@ import android.util.Log;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.taobao.weex.WXEnvironment;
+import com.taobao.weex.annotation.Component;
import com.taobao.weex.common.Constants;
import com.taobao.weex.dom.WXAttr;
import com.taobao.weex.dom.WXDomObject;
@@ -39,6 +41,8 @@ import com.taobao.weex.ui.component.WXComponent;
import com.taobao.weex.ui.component.WXComponentFactory;
import com.taobao.weex.ui.component.WXImage;
import com.taobao.weex.ui.component.WXVContainer;
+import com.taobao.weex.ui.component.list.WXCell;
+import com.taobao.weex.ui.component.list.template.WXRecyclerTemplateList;
import com.taobao.weex.utils.WXLogUtils;
import com.taobao.weex.utils.WXUtils;
@@ -59,7 +63,11 @@ public class Statements {
* recursive copy component, none parent connect
* */
public static WXComponent copyComponentTree(WXComponent component){
+ long start = System.currentTimeMillis();
WXComponent copy = copyComponentTree(component, component.getParent());
+ if(WXEnvironment.isApkDebugable()){
+ WXLogUtils.d(WXRecyclerTemplateList.TAG, Thread.currentThread() + component.getRef() + "copyComponentTree " + "used " + (System.currentTimeMillis() - start));
+ }
return copy;
}
@@ -96,26 +104,47 @@ public class Statements {
* may be next render it can be used.
* after statement has executed, render component's binding attrs in context and bind it to component.
* */
- public static final void doRender(WXComponent component, ArrayStack stack){
+ public static final List<WXComponent> doRender(WXComponent component, ArrayStack stack){
+ List<WXComponent> updates = new ArrayList<>(4);
try{
- doRenderComponent(component, stack);
+ doRenderComponent(component, stack, updates);
}catch (Exception e){
WXLogUtils.e("WeexStatementRender", e);
}
+ return updates;
}
+ public static final void doInitCompontent(List<WXComponent> updates) {
+ if(updates == null || updates.size() == 0){
+ return;
+ }
+ for(WXComponent renderNode : updates){
+ if(renderNode.getParent() == null){
+ throw new IllegalArgumentException("render node parent cann't find");
+ }
+ WXVContainer parent = renderNode.getParent();
+ int renderIndex = parent.indexOf(renderNode);
+ if(renderIndex < 0){
+ throw new IllegalArgumentException("render node cann't find");
+ }
+ parent.createChildViewAt(renderIndex);
+ renderNode.applyLayoutAndEvent(renderNode);
+ renderNode.bindData(renderNode);
+ }
+ }
- /**
- * @param component component with v-for statement, v-if statement and bind attrs
- * @param context execute context
- * render component in context, the function do the following work.
- * execute component's v-for statement, v-if statement in context,
- * and rebuild component's tree with the statement, v-for reuse component execute by pre render.
- * if executed, component will be removed, don't remove, just mark it waste;
- * may be next render it can be used.
- * after statement has executed, render component's binding attrs in context and bind it to component.
- * */
- static final int doRenderComponent(WXComponent component, ArrayStack context){
+ /**
+ * @param component component with v-for statement, v-if statement and bind attrs
+ * @param context execute context
+ * render component in context, the function do the following work.
+ * execute component's v-for statement, v-if statement in context,
+ * and rebuild component's tree with the statement, v-for reuse component execute by pre render.
+ * if executed, component will be removed, don't remove, just mark it waste;
+ * may be next render it can be used.
+ * after statement has executed, render component's binding attrs in context and bind it to component.
+ * */
+ private static final int doRenderComponent(WXComponent component, ArrayStack context,
+ List<WXComponent> updates){
WXVContainer parent = component.getParent();
WXDomObject domObject = (WXDomObject) component.getDomObject();
WXAttr attrs = domObject.getAttrs();
@@ -198,18 +227,18 @@ public class Statements {
}
//none resuable render node, create node, add to parent, but clear node's statement
if(renderNode == null){
+ long start = System.currentTimeMillis();
renderNode = copyComponentTree(component, parent);
WXDomObject renderNodeDomObject = (WXDomObject) renderNode.getDomObject();
renderNodeDomObject.getAttrs().setStatement(null); // clear node's statement
parentDomObject.add(renderNodeDomObject, renderIndex);
parent.addChild(renderNode, renderIndex);
- if(Thread.currentThread() == Looper.getMainLooper().getThread()) {
- parent.createChildViewAt(renderIndex);
- renderNode.applyLayoutAndEvent(renderNode);
- renderNode.bindData(renderNode);
+ updates.add(renderNode);
+ if(WXEnvironment.isApkDebugable()){
+ WXLogUtils.d(WXRecyclerTemplateList.TAG, Thread.currentThread().getName() + renderNode.getRef() + renderNode.getDomObject().getType() + "statements copy component tree used " + (System.currentTimeMillis() - start));
}
}
- doBindingAttrsEventAndRenderChildNode(renderNode, domObject, context);
+ doBindingAttrsEventAndRenderChildNode(renderNode, domObject, context, updates);
renderIndex++;
if(loop.size() > 0){
context.push(loop);
@@ -220,7 +249,7 @@ public class Statements {
}
}
}else{
- WXLogUtils.e("StatementsVFor", vfor.toJSONString() + " not call vfor block, for pre compile");
+ WXLogUtils.e(WXRecyclerTemplateList.TAG, vfor.toJSONString() + " not call vfor block, for pre compile");
}
//after v-for execute, remove component created pre v-for.
for(;renderIndex<parent.getChildCount(); renderIndex++){
@@ -237,20 +266,23 @@ public class Statements {
if(vif != null){
if(!Operators.isTrue(vif.execute(context))){
component.setWaste(true);
- return 1;
+ if(Thread.currentThread() == Looper.getMainLooper().getThread()) {
+ return 1;
+ }
}else{
component.setWaste(false);
}
}
}
- doBindingAttrsEventAndRenderChildNode(component, domObject, context);
+ doBindingAttrsEventAndRenderChildNode(component, domObject, context, updates);
return 1;
}
/**
* bind attrs and doRender component child
* */
- private static void doBindingAttrsEventAndRenderChildNode(WXComponent component, WXDomObject domObject, ArrayStack context){
+ private static void doBindingAttrsEventAndRenderChildNode(WXComponent component, WXDomObject domObject, ArrayStack context,
+ List<WXComponent> updates){
WXAttr attr = component.getDomObject().getAttrs();
/**
* sub component supported, sub component new stack
@@ -266,10 +298,17 @@ public class Statements {
}
doRenderBindingAttrsAndEvent(component, domObject, context);
if(component instanceof WXVContainer){
+ if(!domObject.isShow()){
+ if(!(component instanceof WXCell)){
+ if(Thread.currentThread() == Looper.getMainLooper().getThread()){
+ return;
+ }
+ }
+ }
WXVContainer container = (WXVContainer) component;
for(int k=0; k<container.getChildCount();){
WXComponent next = container.getChild(k);
- k += doRenderComponent(next, context);
+ k += doRenderComponent(next, context, updates);
}
}
}
@@ -325,6 +364,7 @@ public class Statements {
if(Thread.currentThread() == Looper.getMainLooper().getThread()) {
component.updateProperties(dynamic);
}
+ dynamic.clear();
}
}
WXEvent event = domObject.getEvents();
@@ -346,9 +386,16 @@ public class Statements {
* @param context context
* return binding attrs rended value in context
* */
+ private static final ThreadLocal<Map<String, Object>> dynamicLocal = new ThreadLocal<>();
public static Map<String, Object> renderBindingAttrs(ArrayMap bindAttrs, ArrayStack context){
Set<Map.Entry<String, Object>> entrySet = bindAttrs.entrySet();
- Map<String, Object> dynamic = new HashMap<>();
+ Map<String, Object> dynamic = dynamicLocal.get();
+ if(dynamic == null) {
+ dynamic = new HashMap<>();
+ }
+ if(dynamic.size() > 0){
+ dynamic.clear();
+ }
for(Map.Entry<String, Object> entry : entrySet){
Object value = entry.getValue();
String key = entry.getKey();
@@ -378,7 +425,13 @@ public class Statements {
builder.append(blockValue);
}
}
- dynamic.put(key, builder.toString());
+ String builderString = builder.toString();
+ if(builderString.length() > 256){
+ if(WXEnvironment.isApkDebugable()){
+ WXLogUtils.w(WXRecyclerTemplateList.TAG, " warn too big string " + builderString);
+ }
+ }
+ dynamic.put(key, builderString);
}
}
return dynamic;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
index 9b8fe04..640a17e 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
@@ -459,7 +459,6 @@ public abstract class BasicListComponent<T extends ViewGroup & ListComponentView
//Invalid position
return;
}
-
final WXRecyclerView view = bounceRecyclerView.getInnerView();
view.scrollTo(smooth, pos, offset, getOrientation());
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXCell.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXCell.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXCell.java
index 401b654..4fe4bc2 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXCell.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXCell.java
@@ -55,6 +55,12 @@ public class WXCell extends WidgetContainer<WXFrameLayout> {
private int mScrollPositon = -1;
private boolean mFlatUIEnabled = false;
+ private Object renderData;
+
+ private boolean isSourceUsed = false;
+
+ private boolean hasLayout = false;
+
@Deprecated
public WXCell(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId, boolean isLazy) {
super(instance, dom, parent);
@@ -178,4 +184,28 @@ public class WXCell extends WidgetContainer<WXFrameLayout> {
public boolean intendToBeFlatContainer() {
return getInstance().getFlatUIContext().isFlatUIEnabled(this) && WXCell.class.equals(getClass()) && !isSticky();
}
+
+ public Object getRenderData() {
+ return renderData;
+ }
+
+ public void setRenderData(Object renderData) {
+ this.renderData = renderData;
+ }
+
+ public boolean isSourceUsed() {
+ return isSourceUsed;
+ }
+
+ public void setSourceUsed(boolean sourceUsed) {
+ isSourceUsed = sourceUsed;
+ }
+
+ public boolean isHasLayout() {
+ return hasLayout;
+ }
+
+ public void setHasLayout(boolean hasLayout) {
+ this.hasLayout = hasLayout;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/CellLifecycleManager.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/CellLifecycleManager.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/CellLifecycleManager.java
deleted file mode 100644
index d30963d..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/CellLifecycleManager.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.taobao.weex.ui.component.list.template;
-
-import com.taobao.weex.common.Constants;
-import com.taobao.weex.dom.WXEvent;
-import com.taobao.weex.ui.component.WXComponent;
-import com.taobao.weex.ui.component.WXVContainer;
-import com.taobao.weex.ui.component.list.WXCell;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * cell-slot lifecycle manager, onCreate onAttach onDetach destroy
- * Created by furture on 2017/9/19.
- */
-public class CellLifecycleManager {
-
- private static final String[] lifecycleEventNames = {
- Constants.Event.SLOT_LIFECYCLE.CREATE,
- Constants.Event.SLOT_LIFECYCLE.ATTACH,
- Constants.Event.SLOT_LIFECYCLE.DETACH,
- Constants.Event.SLOT_LIFECYCLE.DESTORY
- };
-
- private WXRecyclerTemplateList recyclerTemplateList;
- private Map<String,Map<String,List<String>>> eventSlotWatchRefs;
-
-
- private Map<Integer,Boolean> firedCreateEvent; // only call once
-
-
- public CellLifecycleManager(WXRecyclerTemplateList recyclerTemplateList) {
- this.recyclerTemplateList = recyclerTemplateList;
- this.eventSlotWatchRefs = new HashMap<>();
- this.firedCreateEvent = new HashMap<>();
- }
-
-
-
- public void filterLifecycleWatchEvent(WXCell cell, WXComponent component){
- WXEvent wxEvent = component.getDomObject().getEvents();
- for(String event : lifecycleEventNames){
- if(wxEvent.contains(event)){
- Map<String,List<String>> slotWatchRefs = eventSlotWatchRefs.get(event);
- if(slotWatchRefs == null){
- slotWatchRefs = new HashMap<>();
- eventSlotWatchRefs.put(event, slotWatchRefs);
- }
- List<String> refs = slotWatchRefs.get(cell.getRef());
- if(refs == null){
- refs = new ArrayList<>(8);
- slotWatchRefs.put(cell.getRef(), refs);
- }
- if(!refs.contains(component.getRef())){
- refs.add(component.getRef());
- }
- }
- }
- if(component instanceof WXVContainer){
- WXVContainer container = (WXVContainer) component;
- for(int i=0; i<container.getChildCount(); i++){
- WXComponent child = container.getChild(i);
- filterLifecycleWatchEvent(cell, child);
- }
- }
- }
-
- /**
- * onCreate event
- * */
- public void onCreate(int position){
- WXCell cell = recyclerTemplateList.getSourceTemplate(position);
- if(cell == null){
- return;
- }
- if(firedCreateEvent.get(position) != null){
- return;
- }
- firedCreateEvent.put(position, true);
- Map<String,List<String>> slotWatchCreateRefs = eventSlotWatchRefs.get(Constants.Event.SLOT_LIFECYCLE.CREATE);
- if(slotWatchCreateRefs == null
- || slotWatchCreateRefs.get(cell.getRef()) == null
- || slotWatchCreateRefs.get(cell.getRef()).size() == 0){
- return;
- }
- List<String> refs = slotWatchCreateRefs.get(cell.getRef());
- if(refs == null || refs.size() == 0){
- return;
- }
- fireChildEvent(Constants.Event.SLOT_LIFECYCLE.CREATE, cell, refs, position);
- }
-
- public void onInsert(int position){
- WXCell cell = recyclerTemplateList.getSourceTemplate(position);
- if(cell == null){
- return;
- }
- firedCreateEvent.put(position, true);
- firedCreateEvent.put(firedCreateEvent.size(), true);
- Map<String,List<String>> slotWatchCreateRefs = eventSlotWatchRefs.get(Constants.Event.SLOT_LIFECYCLE.CREATE);
- if(slotWatchCreateRefs == null
- || slotWatchCreateRefs.get(cell.getRef()) == null
- || slotWatchCreateRefs.get(cell.getRef()).size() == 0){
- return;
- }
- List<String> refs = slotWatchCreateRefs.get(cell.getRef());
- if(refs == null || refs.size() == 0){
- return;
- }
- fireChildEvent(Constants.Event.SLOT_LIFECYCLE.CREATE, cell, refs, position);
- }
-
- /**
- * onAttach event
- * */
- public void onAttach(int position, WXCell cell){
- if(cell == null || position < 0){
- return;
- }
- Map<String,List<String>> slotWatchAttachRefs = eventSlotWatchRefs.get(Constants.Event.SLOT_LIFECYCLE.ATTACH);
- if(slotWatchAttachRefs == null
- || slotWatchAttachRefs.get(cell.getRef()) == null
- || slotWatchAttachRefs.get(cell.getRef()).size() == 0){
- return;
- }
- List<String> refs = slotWatchAttachRefs.get(cell.getRef());
- fireChildEvent(Constants.Event.SLOT_LIFECYCLE.ATTACH, cell, refs, position);
- }
-
- /**
- * onDetach event
- * */
- public void onDetach(int position, WXCell cell){
- if(cell == null || position < 0){
- return;
- }
- Map<String,List<String>> slotWatchDetachRefs = eventSlotWatchRefs.get(Constants.Event.SLOT_LIFECYCLE.ATTACH);
- if(slotWatchDetachRefs == null
- || slotWatchDetachRefs.get(cell.getRef()) == null
- || slotWatchDetachRefs.get(cell.getRef()).size() == 0){
- return;
- }
- List<String> refs = slotWatchDetachRefs.get(cell.getRef());
- fireChildEvent(Constants.Event.SLOT_LIFECYCLE.DETACH, cell, refs, position);
- }
-
- /**
- * onDestory event
- * */
- public void onDestory(int position){
- Boolean hasCreated = firedCreateEvent.remove(position);
- if(hasCreated == null){
- return;
- }
- Map<String,List<String>> slotWatchDestroyRefs = eventSlotWatchRefs.get(Constants.Event.SLOT_LIFECYCLE.DESTORY);
- if(slotWatchDestroyRefs == null
- || slotWatchDestroyRefs.size() == 0){
- return;
- }
- WXCell cell = recyclerTemplateList.getSourceTemplate(position);
- if(cell == null){
- return;
- }
- List<String> refs = slotWatchDestroyRefs.get(cell.getRef());
- if(refs == null || refs.size() == 0){
- return;
- }
- fireChildEvent(Constants.Event.SLOT_LIFECYCLE.DESTORY, cell, refs, position);
- }
-
- public Map<Integer, Boolean> getFiredCreateEvent() {
- return firedCreateEvent;
- }
-
- private final void fireChildEvent(String event, WXCell cell, List<String> refs, int position){
- if(refs == null || refs.size() == 0){
- return;
- }
- for(String ref : refs){
- List<WXComponent> components = recyclerTemplateList.findChildListByRef(cell, ref);
- if(components == null || components.size() == 0){
- continue;
- }
- for(WXComponent component : components) {
- Map<String, Object> params = new HashMap<>(8);
- params.put("index", position);
- component.fireEvent(event, params);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/DomTreeBuilder.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/DomTreeBuilder.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/DomTreeBuilder.java
new file mode 100644
index 0000000..c475195
--- /dev/null
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/DomTreeBuilder.java
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.taobao.weex.ui.component.list.template;
+
+import com.taobao.weex.WXSDKManager;
+import com.taobao.weex.dom.DOMActionContext;
+import com.taobao.weex.dom.WXDomObject;
+import com.taobao.weex.dom.action.TraceableAction;
+import com.taobao.weex.ui.component.WXComponent;
+import com.taobao.weex.ui.component.WXComponentFactory;
+import com.taobao.weex.ui.component.WXVContainer;
+
+/**
+ * Created by furture on 2017/10/2.
+ */
+
+class DomTreeBuilder extends TraceableAction {
+
+
+
+
+ public WXComponent generateComponentTree(DOMActionContext context, WXDomObject dom, WXVContainer parent) {
+ if (dom == null) {
+ return null;
+ }
+ long startNanos = System.nanoTime();
+ WXComponent component = WXComponentFactory.newInstance(context.getInstance(), dom, parent);
+ if (component != null) {
+ component.mTraceInfo.domThreadStart = dom.mDomThreadTimestamp;
+ component.mTraceInfo.rootEventId = mTracingEventId;
+ component.mTraceInfo.domQueueTime = mDomQueueTime;
+ }
+ ((WXDomObject)component.getDomObject()).applyStyleToNode();
+ context.registerDOMObject(dom.getRef(), dom);
+ context.registerComponent(dom.getRef(), component);
+ if (component instanceof WXVContainer) {
+ WXVContainer container = (WXVContainer) component;
+ WXDomObject parentDom = (WXDomObject) container.getDomObject();
+ int count = dom.childCount();
+ WXDomObject child = null;
+ for (int i = 0; i < count; ++i) {
+ child = dom.getChild(i);
+ if (child != null) {
+ WXComponent childComponent = generateComponentTree(context, child, container);
+ container.addChild(childComponent);
+ parentDom.add((WXDomObject) childComponent.getDomObject(), -1);
+ }
+ }
+ }
+ if (component != null) {
+ component.mTraceInfo.domThreadNanos = System.nanoTime() - startNanos;
+ }
+ return component;
+ }
+
+ public static final WXComponent buildTree(WXDomObject domObject, WXVContainer parent){
+ DOMActionContext domActionContext = WXSDKManager.getInstance().getWXDomManager().getDomContext(parent.getInstanceId());
+ if(domActionContext == null){
+ return null;
+ }
+ domObject.getStyles().put("display", "flex");
+ DomTreeBuilder builder = new DomTreeBuilder();
+ return builder.generateComponentTree(domActionContext, domObject, parent);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateCache.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateCache.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateCache.java
new file mode 100644
index 0000000..eab80bc
--- /dev/null
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateCache.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.taobao.weex.ui.component.list.template;
+import com.taobao.weex.ui.component.list.WXCell;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+/**
+ * preload cell cache
+ * Created by furture on 2017/9/29.
+ */
+class TemplateCache {
+ ConcurrentLinkedQueue<WXCell> cells = new ConcurrentLinkedQueue<>();
+ boolean isLoadIng = false;
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java
index a418e3e..d0b5dbf 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java
@@ -47,6 +47,8 @@ public class TemplateViewHolder extends ListBaseViewHolder {
public AsyncTask<Void, Void, Void> asyncTask;
+ public Object data;
+
/**
* header position
* */
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
index 5d23bf6..d371ab2 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
@@ -25,6 +25,7 @@ import android.graphics.PointF;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Looper;
+import android.os.MessageQueue;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.ArrayMap;
@@ -43,14 +44,16 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.taobao.weex.WXEnvironment;
import com.taobao.weex.WXSDKInstance;
+import com.taobao.weex.WXSDKManager;
import com.taobao.weex.annotation.Component;
import com.taobao.weex.annotation.JSMethod;
+import com.taobao.weex.bridge.WXBridgeManager;
import com.taobao.weex.common.Constants;
import com.taobao.weex.common.ICheckBindingScroller;
import com.taobao.weex.common.OnWXScrollListener;
-import com.taobao.weex.dom.ImmutableDomObject;
import com.taobao.weex.dom.WXAttr;
import com.taobao.weex.dom.WXCellDomObject;
+import com.taobao.weex.dom.WXDomHandler;
import com.taobao.weex.dom.WXDomObject;
import com.taobao.weex.dom.WXEvent;
import com.taobao.weex.dom.WXRecyclerDomObject;
@@ -81,10 +84,12 @@ import com.taobao.weex.utils.WXViewUtils;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
import static com.taobao.weex.common.Constants.Name.LOADMOREOFFSET;
@@ -96,10 +101,11 @@ import static com.taobao.weex.common.Constants.Name.LOADMOREOFFSET;
@Component(lazyload = false)
public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> implements
IRecyclerAdapterListener<TemplateViewHolder>, IOnLoadMoreListener, Scrollable {
- private static final String TAG = "WXRecyclerTemplateList";
+ public static final String TAG = "WXRecyclerTemplateList";
private static final String NAME_HAS_FIXED_SIZE = "hasFixedSize";
private static final String NAME_ITEM_VIEW_CACHE_SIZE = "itemViewCacheSize";
+ private static final String NAME_TEMPLATE_CACHE_SIZE = "templateCacheSize";
private WXRecyclerDomObject mDomObject;
@@ -135,11 +141,12 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
- private Map<String, WXCell> mTemplates;
+ private Map<String, WXCell> mTemplateSources;
private String listDataTemplateKey = Constants.Name.Recycler.SLOT_TEMPLATE_TYPE;
private Runnable listUpdateRunnable;
- private ConcurrentHashMap<String, WXCell> mTemplatesCache;
- private ConcurrentHashMap<String, Boolean> mTemplateRendered;
+ private ConcurrentHashMap<String, TemplateCache> mTemplatesCache;
+ private int templateCacheSize = 2;
+
/**
* sticky helper
@@ -148,12 +155,6 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
/**
- * cell item lifecycle manager
- * */
- private CellLifecycleManager cellLifecycleManager;
-
-
- /**
* appear and disappear event managaer
* */
private ArrayMap<Integer, List<AppearanceHelper>> mAppearHelpers = new ArrayMap<>();
@@ -166,6 +167,9 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
* */
private ArrayMap<Integer, Map<String,Map<Integer, List<Object>>>> mDisAppearWatchList = new ArrayMap<>();
+ private ArrayStack bindIngStackContext = new ArrayStack();
+ private Map bindIngMapContext = new HashMap();
+
public WXRecyclerTemplateList(WXSDKInstance instance, WXDomObject node, WXVContainer parent) {
super(instance, node, parent);
initRecyclerTemplateList(instance, node, parent);
@@ -180,10 +184,9 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
}
mTemplateViewTypes = new ArrayMap<>();
mTemplateViewTypes.put("", 0); //empty view, when template was not sended
- mTemplates = new HashMap<>();
+ mTemplateSources = new HashMap<>();
mTemplatesCache = new ConcurrentHashMap<>();
mStickyHelper = new TemplateStickyHelper(this);
- cellLifecycleManager = new CellLifecycleManager(this);
orientation = mDomObject.getOrientation();
listDataTemplateKey = WXUtils.getString(getDomObject().getAttrs().get(Constants.Name.Recycler.LIST_DATA_TEMPLATE_KEY), Constants.Name.Recycler.SLOT_TEMPLATE_TYPE);
listDataItemKey = WXUtils.getString(getDomObject().getAttrs().get(Constants.Name.Recycler.LIST_DATA_ITEM), listDataItemKey);
@@ -194,7 +197,12 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
listData = array;
}
}
- mTemplateRendered = new ConcurrentHashMap<>();
+
+ if(mDomObject != null && mDomObject.getCellList() != null){
+ for(int i=0; i<mDomObject.getCellList().size(); i++){
+ addChild(DomTreeBuilder.buildTree(mDomObject.getCellList().get(i), this));
+ }
+ }
}
@Override
@@ -206,8 +214,13 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
bounceRecyclerView.getInnerView().addItemDecoration(RecyclerTransform.parseTransforms(getOrientation(), transforms));
}
mItemAnimator = bounceRecyclerView.getInnerView().getItemAnimator();
+
+ if(attrs.get(NAME_TEMPLATE_CACHE_SIZE) != null){
+ templateCacheSize = WXUtils.getInteger(attrs.get(NAME_TEMPLATE_CACHE_SIZE), templateCacheSize);
+ }
+
boolean hasFixedSize = false;
- int itemViewCacheSize = 4;
+ int itemViewCacheSize = 2;
if(attrs.get(NAME_ITEM_VIEW_CACHE_SIZE) != null){
itemViewCacheSize = WXUtils.getNumberInt(getDomObject().getAttrs().get(NAME_ITEM_VIEW_CACHE_SIZE), itemViewCacheSize);
}
@@ -217,7 +230,9 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
RecyclerViewBaseAdapter recyclerViewBaseAdapter = new RecyclerViewBaseAdapter<>(this);
recyclerViewBaseAdapter.setHasStableIds(true);
bounceRecyclerView.getInnerView().setItemAnimator(null);
- bounceRecyclerView.getInnerView().setItemViewCacheSize(itemViewCacheSize);
+ if(itemViewCacheSize != 2) {
+ bounceRecyclerView.getInnerView().setItemViewCacheSize(itemViewCacheSize);
+ }
bounceRecyclerView.getInnerView().setHasFixedSize(hasFixedSize);
bounceRecyclerView.setRecyclerViewBaseAdapter(recyclerViewBaseAdapter);
bounceRecyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
@@ -302,6 +317,9 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
if(getHostView() != null && getHostView().getRecyclerViewBaseAdapter() != null){
getHostView().getRecyclerViewBaseAdapter().notifyDataSetChanged();
}
+ if(WXEnvironment.isApkDebugable()){
+ WXLogUtils.d(TAG, "WXTemplateList notifyDataSetChanged");
+ }
}
};
return bounceRecyclerView;
@@ -537,7 +555,9 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
@Override
public void addChild(WXComponent child, int index) {
- super.addChild(child, index);
+ if(!(child instanceof WXCell)) {
+ super.addChild(child, index);
+ }
if(child instanceof WXBaseRefresh){
return;
}
@@ -546,19 +566,18 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
Object templateId = child.getDomObject().getAttrs().get(Constants.Name.Recycler.SLOT_TEMPLATE_TYPE);
String key = WXUtils.getString(templateId, null);
if(key != null){
- //set visible false, skip layout in dom thread, set visible true in onCreateViewHolder
- if(child.getDomObject() != null) {
- WXDomObject domObject = (WXDomObject) child.getDomObject();
- domObject.setVisible(false);
+ if(child.getDomObject() instanceof WXCellDomObject
+ && getDomObject() instanceof WXRecyclerDomObject){
+ WXCellDomObject domObject = (WXCellDomObject) child.getDomObject();
+ domObject.setRecyclerDomObject((WXRecyclerDomObject) getDomObject());
}
- mTemplates.put(key, (WXCell) child);
- asyncPreloadCellCopyCache(key);
+ mTemplateSources.put(key, (WXCell) child);
+ ensureSourceCellRenderWithData((WXCell)child);
if(mTemplateViewTypes.get(key) == null){
mTemplateViewTypes.put(key, mTemplateViewTypes.size());
}
}
}
- cellLifecycleManager.filterLifecycleWatchEvent((WXCell)child, child);
notifyUpdateList();
}
}
@@ -602,21 +621,6 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
}
- /**
- * To determine whether an animation is needed
- * @param child
- * @return
- */
- private boolean isRemoveAnimation(WXComponent child) {
- ImmutableDomObject domObject = child.getDomObject();
- if (domObject != null) {
- Object attr = domObject.getAttrs().get(Constants.Name.DELETE_CELL_ANIMATION);
- if (Constants.Value.DEFAULT.equals(attr)) {
- return true;
- }
- }
- return false;
- }
@Override
public void computeVisiblePointInViewCoordinate(PointF pointF) {
@@ -727,23 +731,13 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
@JSMethod
public void setListData(Object param){
- if(listData != null){
- for(int i=0;i<listData.size(); i++){
- cellLifecycleManager.onDestory(i);
- }
- }
- boolean update = listData != null;
+ boolean update = listData != null && listData != param;
if(param instanceof JSONArray){
listData = (JSONArray) param;
}
if(update){
notifyUpdateList();
}
- if(listData != null){
- for(int i=0; i<listData.size(); i++){
- cellLifecycleManager.onCreate(i);
- }
- }
}
@JSMethod
@@ -751,14 +745,9 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
if(listData == null){
listData = new JSONArray();
}
- int position = listData.size();
if(arrayObject instanceof JSONArray){
listData.addAll(arrayObject);
}
- int end = listData.size();
- for(int i=position; i<end; i++){
- cellLifecycleManager.onCreate(position);
- }
notifyUpdateList();
}
@@ -771,7 +760,6 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
return;
}
listData.add(index, data);
- cellLifecycleManager.onInsert(index);
notifyUpdateList();
}
@@ -783,13 +771,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
if(listData == null || index >= listData.size()){
return;
}
- int before = getItemViewType(index);
listData.set(index, data);
- int after = getItemViewType(index);
- if(before != after){
- cellLifecycleManager.onDestory(index);
- cellLifecycleManager.onCreate(index);
- }
notifyUpdateList();
}
@@ -806,15 +788,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
}
index -= offset;
if(index < listData.size()){
- int markPostion = listData.size() - 1;
- cellLifecycleManager.onDestory(index);
listData.remove((int)index);
- if(index < listData.size()){
- cellLifecycleManager.getFiredCreateEvent().put(index, true);
- }
- if(markPostion >= 0){
- cellLifecycleManager.getFiredCreateEvent().remove(markPostion);
- }
offset++;
}
}
@@ -1002,8 +976,8 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
if(mTemplateViewTypes != null){
mTemplateViewTypes.clear();
}
- if(mTemplates != null){
- mTemplates.clear();
+ if(mTemplateSources != null){
+ mTemplateSources.clear();
}
if(mAppearHelpers != null){
mAppearHelpers.clear();
@@ -1017,8 +991,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
@Override
- public void onViewRecycled(TemplateViewHolder holder) {
- }
+ public void onViewRecycled(TemplateViewHolder holder) {}
@Override
public void onBindViewHolder(final TemplateViewHolder templateViewHolder, int position) {
@@ -1029,110 +1002,96 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
if(component == null){
return;
}
- cellLifecycleManager.onDetach(templateViewHolder.getHolderPosition(), component);
long start = System.currentTimeMillis();
+ boolean async = templateViewHolder.getHolderPosition() >= 0;
templateViewHolder.setHolderPosition(position);
- Statements.doRender(component, getStackContextForPosition(position));
- if(WXEnvironment.isApkDebugable()){
- WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder render used " + (System.currentTimeMillis() - start));
- }
- Layouts.doLayoutAsync(templateViewHolder);
- cellLifecycleManager.onAttach(position, component);
- if(WXEnvironment.isApkDebugable()){
- WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder layout used " + (System.currentTimeMillis() - start));
+ Object data = listData.get(position);
+ if(component.getRenderData() == data){
+ if(!async){
+ if(!component.isHasLayout()) {
+ Layouts.doLayoutAsync(templateViewHolder, async);
+ }
+ if(WXEnvironment.isApkDebugable()){
+ WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder source layout used " + (System.currentTimeMillis() - start) + async);
+ }
+ }
+ component.setHasLayout(true);
+ }else{
+ List<WXComponent> updates = Statements.doRender(component, getStackContextForPosition(position, data));
+ Statements.doInitCompontent(updates);
+ component.setRenderData(data);
+ if(WXEnvironment.isApkDebugable()){
+ WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder render used " + (System.currentTimeMillis() - start));
+ }
+ if(component.isHasLayout()){
+ async = true;
+ }
+ Layouts.doLayoutAsync(templateViewHolder, async);
+ component.setHasLayout(true);
+ if(WXEnvironment.isApkDebugable()){
+ WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder layout used " + (System.currentTimeMillis() - start) + async);
+ }
}
}
@Override
public TemplateViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
String template = mTemplateViewTypes.keyAt(viewType);
- WXCell source = mTemplates.get(template);
+ WXCell source = mTemplateSources.get(template);
if(source == null){
FrameLayout view = new FrameLayout(getContext());
view.setLayoutParams(new FrameLayout.LayoutParams(0, 0));
return new TemplateViewHolder(view, viewType);
}
- long start = System.currentTimeMillis();
- WXCell component = mTemplatesCache.remove(template);
- boolean needLayout = false;
- if(component == null) {
- component = (WXCell) copyCell(source);
- needLayout = true;
+ TemplateCache cache = mTemplatesCache.get(template);
+ WXCell component = null;
+ boolean cacheHit = true;
+ if(cache != null && cache.cells != null && cache.cells.size() > 0){
+ component = cache.cells.poll();
}
- asyncPreloadCellCopyCache(template);
- CSSLayoutContext layoutContext = null;
- if(needLayout){
- layoutContext = new CSSLayoutContext();
- Layouts.doSafeLayout(component, layoutContext);
- if(WXEnvironment.isApkDebugable()){
- WXLogUtils.d(TAG, template + " onCreateViewHolder sync layout used " + (System.currentTimeMillis() - start));
- }
+ if(cache == null || !cache.isLoadIng){
+ asyncLoadTemplateCache(template);
}
- Layouts.setLayout(component, false);
- component.lazy(false);
- component.createView();
- if(WXEnvironment.isApkDebugable()){
- WXLogUtils.d(TAG, template + " onCreateViewHolder view used " + (System.currentTimeMillis() - start));
+ if(component == null){
+ cacheHit = false;
+ if(!source.isSourceUsed()){
+ source.setSourceUsed(true);
+ ensureSourceCellRenderWithData(source);
+ component = source;
+ if(WXEnvironment.isApkDebugable()) {
+ WXLogUtils.d(TAG, template + " onCreateViewHolder source");
+ }
+ }
}
- component.applyLayoutAndEvent(component);
- if(WXEnvironment.isApkDebugable()) {
- WXLogUtils.d(TAG, template + " onCreateViewHolder apply layout used " + (System.currentTimeMillis() - start));
+ if(component == null) {
+ long start = System.currentTimeMillis();
+ component = (WXCell) copyCell(source);
+ if(WXEnvironment.isApkDebugable()) {
+ WXLogUtils.d(TAG, template + " onCreateViewHolder copy used " + (System.currentTimeMillis() - start));
+ }
}
- component.bindData(component);
- if(WXEnvironment.isApkDebugable()) {
- WXLogUtils.d(TAG, template + " onCreateViewHolder bindData used " + (System.currentTimeMillis() - start));
+ if(component.isLazy()) {
+ doInitLazyCell(component, template, false);
+ if(WXEnvironment.isApkDebugable()) {
+ WXLogUtils.d(TAG, template + " onCreateViewHolder cache hit " + cacheHit + " idle init false ");
+ }
+ }else{
+ if(WXEnvironment.isApkDebugable()) {
+ WXLogUtils.d(TAG, template + " onCreateViewHolder cache hit " + cacheHit + " idle init true");
+ }
}
TemplateViewHolder templateViewHolder = new TemplateViewHolder(component, viewType);
- templateViewHolder.setLayoutContext(layoutContext);
return templateViewHolder;
}
- private void asyncPreloadCellCopyCache(final String template) {
- final WXCell cell = mTemplates.get(template);
- if(cell == null){
- return;
- }
- if(mTemplatesCache.get(template) != null){
- return;
- }
- AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
- @Override
- public void run() {
- if(cell.getInstance() == null || cell.getInstance().isDestroy()){
- return;
- }
- WXCell component = (WXCell) copyCell(cell);
- if(cell.getInstance() == null || cell.getInstance().isDestroy()){
- return;
- }
- Layouts.doSafeLayout(component, new CSSLayoutContext());
- mTemplatesCache.put(template, component);
- }
- });
- }
/**
- * copy cell component from source, and return source
+ * copy cell component from source, init render data, and return source
+ * if none data, return null
* */
- private WXComponent copyCell(WXComponent cell){
- /** pre render for cell */
- Boolean rendered = mTemplateRendered.get(cell.getRef());
- if(rendered == null || !rendered) {
- if(listData != null){
- for(int i=0; i<listData.size(); i++){
- WXCell source = getSourceTemplate(i);
- if(source == cell){
- Statements.doRender(cell, getStackContextForPosition(i));
- mTemplateRendered.put(source.getRef(), true);
- break;
- }
- }
- }
- }
+ private WXComponent copyCell(WXCell cell){
+ ensureSourceCellRenderWithData(cell);
WXCell component = (WXCell) Statements.copyComponentTree(cell);
- if(component.getDomObject() != null){
- ((WXDomObject)component.getDomObject()).setVisible(true);
- }
if(component.getDomObject() instanceof WXCellDomObject
&& getDomObject() instanceof WXRecyclerDomObject){
WXCellDomObject domObject = (WXCellDomObject) component.getDomObject();
@@ -1141,6 +1100,26 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
return component;
}
+ private void ensureSourceCellRenderWithData(WXCell cell){
+ if(cell.getRenderData() == null){
+ if(listData != null && listData.size() > 0){
+ synchronized (this){
+ if(cell.getRenderData() == null){
+ for(int i=0; i<listData.size(); i++){
+ if(cell == getSourceTemplate(i)){
+ Object data = listData.get(i);
+ Statements.doRender(cell, getStackContextForPosition(i, data));
+ cell.setRenderData(data);
+ //WXSDKManager.getInstance().getWXDomManager().postAction(getInstanceId(), new RenderSourceCellAction(cell, null, data), false);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
/**
* @param position
* when template not send, return an invalid id, use empty view holder.
@@ -1164,14 +1143,19 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
/**
* return code context for render component
* */
- private ArrayStack getStackContextForPosition(int position){
- ArrayStack stack = new ArrayStack();
- Map map = new HashMap();
+ private ArrayStack getStackContextForPosition(int position, Object item){
+ if(!bindIngStackContext.isEmpty()){
+ bindIngStackContext.getList().clear();
+ }
+ if(!bindIngMapContext.isEmpty()){
+ bindIngMapContext.clear();
+ }
+ ArrayStack stack = bindIngStackContext;
+ Map map = bindIngMapContext;
if(listData != null){
stack.push(listData);
stack.push(map);
map.put(listDataKey, listData);
- Object item = listData.get(position);
if(!TextUtils.isEmpty(listDataIndexKey)) {
map.put(listDataIndexKey, position);
}
@@ -1201,7 +1185,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
* */
public WXCell getSourceTemplate(int position){
String template = getTemplateKey(position);
- return mTemplates.get(template);
+ return mTemplateSources.get(template);
}
@@ -1236,7 +1220,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
if(mTemplateViewTypes == null || mTemplateViewTypes.size() <= 1){
return 0;
}
- if(mTemplates == null || mTemplates.size() == 0){
+ if(mTemplateSources == null || mTemplateSources.size() == 0){
return 0;
}
return listData.size();
@@ -1385,7 +1369,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
if(map == null){
continue;
}
- WXCell template = mTemplates.get(getTemplateKey(position));
+ WXCell template = mTemplateSources.get(getTemplateKey(position));
if(template == null){
return;
}
@@ -1420,15 +1404,16 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
}
private void notifyUpdateList(){
- if(getHostView() != null
- && listUpdateRunnable != null
- && getHostView().getInnerView() != null){
- if(Looper.getMainLooper().getThread().getId() != Thread.currentThread().getId()){
- getHostView().removeCallbacks(listUpdateRunnable);
- getHostView().post(listUpdateRunnable);
- }else{
- listUpdateRunnable.run();
- }
+ if(getHostView() == null
+ || getHostView().getInnerView() == null
+ || listUpdateRunnable == null){
+ return;
+ }
+ if(Looper.getMainLooper().getThread().getId() != Thread.currentThread().getId()){
+ getHostView().removeCallbacks(listUpdateRunnable);
+ getHostView().post(listUpdateRunnable);
+ }else{
+ listUpdateRunnable.run();
}
}
@@ -1545,4 +1530,126 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
}
return componentList;
}
+
+
+ /**
+ * copy cell async and save to cache
+ * */
+ private void asyncLoadTemplateCache(final String template) {
+ if(Thread.currentThread() != Looper.getMainLooper().getThread()){
+ if(listData == null || listData.size() == 0){
+ return;
+ }
+ boolean firstScreenContains = false;
+ for(int i=0; i<listData.size(); i++){
+ if(template.equals(getTemplateKey(i))){
+ firstScreenContains = true;
+ break;
+ }
+ }
+ if(!firstScreenContains){
+ return;
+ }
+ }
+ final WXCell source = mTemplateSources.get(template);
+ if(source == null){
+ return;
+ }
+ TemplateCache cellCache = mTemplatesCache.get(template);
+ if(cellCache == null){
+ cellCache = new TemplateCache();
+ mTemplatesCache.put(template, cellCache);
+ }
+ if(cellCache.cells.size() >= templateCacheSize){
+ cellCache.isLoadIng = false;
+ return;
+ }
+ if(cellCache.isLoadIng){
+ return;
+ }
+ cellCache.isLoadIng = true;
+ AsyncTask<Void,Void, Void> preloadTask = new AsyncTask<Void, Void, Void>() {
+ @Override
+ protected Void doInBackground(Void... params) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ TemplateCache cellCache = mTemplatesCache.get(template);
+ if(cellCache == null || cellCache.cells == null){
+ return null;
+ }
+ while (cellCache.cells.size() < templateCacheSize){
+ WXCell component = (WXCell) copyCell(source);
+ if(component == null){
+ return null;
+ }
+ if(source.getInstance() == null || source.getInstance().isDestroy()){
+ return null;
+ }
+ cellCache.cells.add(component);
+ }
+ return null;
+ }
+ @Override
+ protected void onPostExecute(Void aVoid) {
+ if(source.getInstance() == null || source.getInstance().isDestroy()){
+ return;
+ }
+ final TemplateCache cellCache = mTemplatesCache.get(template);
+ if(cellCache == null){
+ return;
+ }
+ if(cellCache.cells == null
+ || cellCache.cells.size() == 0){
+ cellCache.isLoadIng = false;
+ return;
+ }
+ Looper.myQueue().addIdleHandler(new MessageQueue.IdleHandler() {
+ @Override
+ public boolean queueIdle() {
+ if(source.getInstance() == null || source.getInstance().isDestroy()){
+ return false;
+ }
+ ConcurrentLinkedQueue<WXCell> queue = cellCache.cells;
+ Iterator<WXCell> iterator = queue.iterator();
+ while (iterator.hasNext()){
+ WXCell component = iterator.next();
+ if(component.isLazy()){
+ doInitLazyCell(component, template, true);
+ return iterator.hasNext();
+ }
+ if(!component.isHasLayout()){
+ Layouts.doSafeLayout(component, new CSSLayoutContext());
+ component.setHasLayout(true);
+ }
+ }
+ return false;
+ }
+ });
+ cellCache.isLoadIng = false;
+ }
+ };
+ preloadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+ }
+
+ private static void doInitLazyCell(WXCell component, String template, boolean inPreload){
+ if(component.isLazy()){
+ long start = System.currentTimeMillis();
+ component.lazy(false);
+ component.createView();
+ if(WXEnvironment.isApkDebugable()) {
+ WXLogUtils.d(TAG, "doInitLazyCell " + inPreload + template + " createView used " + (System.currentTimeMillis() - start));
+ }
+ component.applyLayoutAndEvent(component);
+ if(WXEnvironment.isApkDebugable()) {
+ WXLogUtils.d(TAG, "doInitLazyCell " + inPreload + template + " apply layout used " + (System.currentTimeMillis() - start));
+ }
+ component.bindData(component);
+ if(WXEnvironment.isApkDebugable()) {
+ WXLogUtils.d(TAG, "doInitLazyCell " + inPreload + template + " bindData used " + (System.currentTimeMillis() - start));
+ }
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9e6bee8e/android/sdk/src/test/java/com/taobao/weex/ui/component/binding/StatementTest.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/test/java/com/taobao/weex/ui/component/binding/StatementTest.java b/android/sdk/src/test/java/com/taobao/weex/ui/component/binding/StatementTest.java
index 3566816..3924a3a 100644
--- a/android/sdk/src/test/java/com/taobao/weex/ui/component/binding/StatementTest.java
+++ b/android/sdk/src/test/java/com/taobao/weex/ui/component/binding/StatementTest.java
@@ -76,7 +76,7 @@ public class StatementTest {
public void testVFor() throws Exception {
WXCell cell = createVForNode();
int count = 3;
- Statements.doRenderComponent(cell, createContext(count));
+ Statements.doRender(cell, createContext(count));
Assert.assertTrue(cell.getChildCount() == 1);
WXDiv div = (WXDiv) cell.getChild(0);
Assert.assertEquals(div.getChildCount(), count);
@@ -88,7 +88,7 @@ public class StatementTest {
WXComponent childThree = div.getChild(2);
count = 4;
- Statements.doRenderComponent(cell, createContext(count));
+ Statements.doRender(cell, createContext(count));
Assert.assertTrue(cell.getChildCount() == 1);
div = (WXDiv) cell.getChild(0);
Assert.assertTrue(div.getChildCount() == count);
@@ -98,7 +98,7 @@ public class StatementTest {
WXComponent childFour = div.getChild(3);
count = 5;
- Statements.doRenderComponent(cell, createContext(count));
+ Statements.doRender(cell, createContext(count));
Assert.assertTrue(cell.getChildCount() == 1);
div = (WXDiv) cell.getChild(0);
Assert.assertTrue(div.getChildCount() == count);
@@ -109,7 +109,7 @@ public class StatementTest {
count = 3;
- Statements.doRenderComponent(cell, createContext(count));
+ Statements.doRender(cell, createContext(count));
Assert.assertTrue(cell.getChildCount() == 1);
div = (WXDiv) cell.getChild(0);
Assert.assertTrue(div.getChildCount() == 5);
[02/14] incubator-weex git commit: remove cell-slot from
recycler-list dom tree reduce layout and create component time,
layout async always and dom support clone this
Posted by gu...@apache.org.
remove cell-slot from recycler-list dom tree reduce layout and create component time, layout async always and dom support clone this
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/72a852b0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/72a852b0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/72a852b0
Branch: refs/heads/master
Commit: 72a852b06d22f656d55f82dde9aae131763dbc53
Parents: 9e6bee8
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Tue Oct 3 20:19:24 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
.../java/com/taobao/weex/dom/WXDomObject.java | 13 +++++++
.../taobao/weex/dom/WXRecyclerDomObject.java | 3 ++
.../com/taobao/weex/dom/WXTextDomObject.java | 7 +++-
.../taobao/weex/ui/component/WXComponent.java | 24 +++++-------
.../weex/ui/component/binding/Layouts.java | 25 +++++++++++-
.../component/list/template/DomTreeBuilder.java | 33 ++++++++++++----
.../list/template/WXRecyclerTemplateList.java | 41 +++++++-------------
7 files changed, 94 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/72a852b0/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
index 8398a2d..f990792 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
@@ -104,6 +104,8 @@ public class WXDomObject extends CSSNode implements Cloneable,ImmutableDomObject
public long mDomThreadNanos;
public long mDomThreadTimestamp;
+ private boolean cloneThis = false;
+
public void traverseTree(Consumer...consumers){
long startNanos = System.nanoTime();
if (consumers == null) {
@@ -598,6 +600,9 @@ public class WXDomObject extends CSSNode implements Cloneable,ImmutableDomObject
if (sDestroy.get()) {
return null;
}
+ if(cloneThis){
+ return this;
+ }
WXDomObject dom = null;
try {
dom = WXDomObjectFactory.newInstance(mType);
@@ -722,4 +727,12 @@ public class WXDomObject extends CSSNode implements Cloneable,ImmutableDomObject
public interface Consumer{
void accept(WXDomObject dom);
}
+
+ public boolean isCloneThis() {
+ return cloneThis;
+ }
+
+ public void setCloneThis(boolean cloneThis) {
+ this.cloneThis = cloneThis;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/72a852b0/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
index 11918e8..805ef8e 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
@@ -225,6 +225,9 @@ public class WXRecyclerDomObject extends WXDomObject{
@Override
public WXDomObject clone() {
+ if(isCloneThis()){
+ return this;
+ }
WXRecyclerDomObject domObject = (WXRecyclerDomObject) super.clone();
domObject.cellList = cellList;
return domObject;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/72a852b0/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
index bdcfd39..749afbd 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
@@ -174,7 +174,9 @@ public class WXTextDomObject extends WXDomObject {
updateStyleAndText();
spanned = createSpanned(mText);
if(hasNewLayout()){
- WXLogUtils.e("TextDom", new IllegalStateException("Previous csslayout was ignored! markLayoutSeen() never called"));
+ if(WXEnvironment.isApkDebugable()) {
+ WXLogUtils.w("TextDom", new IllegalStateException("Previous csslayout was ignored! markLayoutSeen() never called"));
+ }
markUpdateSeen();
}
super.dirty();
@@ -226,6 +228,9 @@ public class WXTextDomObject extends WXDomObject {
@Override
public WXTextDomObject clone() {
+ if(isCloneThis()){
+ return this;
+ }
WXTextDomObject dom = null;
try {
dom = new WXTextDomObject();
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/72a852b0/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
index f735e4e..1d64d5d 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
@@ -1408,14 +1408,6 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi
view.setVisibility(View.GONE);
}
}
- if(mDomObj != null){
- WXDomObject domObject = (WXDomObject) mDomObj;
- if (TextUtils.equals(visibility, Constants.Value.VISIBLE)) {
- domObject.setVisible(true);
- } else if (TextUtils.equals(visibility, Constants.Value.HIDDEN)) {
- domObject.setVisible(false);
- }
- }
}
/**
@@ -1819,16 +1811,17 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi
this.waste = waste;
WXDomObject domObject = (WXDomObject) getDomObject();
if(waste){
+ getDomObject().getStyles().put(Constants.Name.VISIBILITY, Constants.Value.HIDDEN);
if(domObject.getAttrs().getStatement() == null) {
- domObject.setVisible(false);
- if (getHostView() != null) {
+ domObject.setVisible(false);
+ if (getHostView() != null) {
getHostView().setVisibility(View.GONE);
- }
- return;
+ }
+ return;
}
if(Constants.Value.VISIBLE.equals(domObject.getAttrs().get(Constants.Name.VIF_FALSE))){
- domObject.setVisible(true);
- if(getHostView() != null){
+ domObject.setVisible(true);
+ if(getHostView() != null){
getHostView().setVisibility(View.VISIBLE);
}
}else{
@@ -1840,8 +1833,9 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi
}else{
domObject.setVisible(true);
if(getHostView() != null){
- getHostView().setVisibility(View.VISIBLE);
+ getHostView().setVisibility(View.VISIBLE);
}
+ getDomObject().getStyles().put(Constants.Name.VISIBILITY, Constants.Value.VISIBLE);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/72a852b0/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
index 1e48ea7..9dea0ff 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
@@ -75,7 +75,6 @@ public class Layouts {
asyncTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); //serial executor is better
}else{
doSafeLayout(component, templateViewHolder.getLayoutContext());
- Log.e("weex", "weex" + component.getLayoutHeight() + " " + component.getLayoutWidth());
setLayout(component, false);
}
@@ -140,6 +139,10 @@ public class Layouts {
* if force is true, always set layout
* */
public static final void setLayout(WXComponent component, boolean force){
+ if(component.isWaste()){
+ setLayoutWaste(component, force);
+ return;
+ }
WXDomObject domObject = (WXDomObject) component.getDomObject();
if(domObject.hasUpdate() || force){
domObject.markUpdateSeen();
@@ -162,4 +165,24 @@ public class Layouts {
}
}
}
+
+ private static final void setLayoutWaste(WXComponent component, boolean force){
+ WXDomObject domObject = (WXDomObject) component.getDomObject();
+ if(domObject.hasUpdate() || force){
+ domObject.markUpdateSeen();
+ if(domObject.hasUpdate()){
+ domObject.markLayoutStateUpdated();
+ }
+ }
+ if(component instanceof WXVContainer){
+ WXVContainer container = (WXVContainer) component;
+ int count = container.getChildCount();
+ for (int i = 0; i < count; ++i) {
+ WXComponent child = container.getChild(i);
+ if (child != null) {
+ setLayoutWaste(child, force);
+ }
+ }
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/72a852b0/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/DomTreeBuilder.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/DomTreeBuilder.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/DomTreeBuilder.java
index c475195..0aa6cde 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/DomTreeBuilder.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/DomTreeBuilder.java
@@ -18,6 +18,7 @@
*/
package com.taobao.weex.ui.component.list.template;
+import com.taobao.weex.WXEnvironment;
import com.taobao.weex.WXSDKManager;
import com.taobao.weex.dom.DOMActionContext;
import com.taobao.weex.dom.WXDomObject;
@@ -25,6 +26,7 @@ import com.taobao.weex.dom.action.TraceableAction;
import com.taobao.weex.ui.component.WXComponent;
import com.taobao.weex.ui.component.WXComponentFactory;
import com.taobao.weex.ui.component.WXVContainer;
+import com.taobao.weex.utils.WXLogUtils;
/**
* Created by furture on 2017/10/2.
@@ -40,29 +42,41 @@ class DomTreeBuilder extends TraceableAction {
return null;
}
long startNanos = System.nanoTime();
+ dom.setCloneThis(true);
WXComponent component = WXComponentFactory.newInstance(context.getInstance(), dom, parent);
if (component != null) {
component.mTraceInfo.domThreadStart = dom.mDomThreadTimestamp;
component.mTraceInfo.rootEventId = mTracingEventId;
component.mTraceInfo.domQueueTime = mDomQueueTime;
}
- ((WXDomObject)component.getDomObject()).applyStyleToNode();
- context.registerDOMObject(dom.getRef(), dom);
context.registerComponent(dom.getRef(), component);
if (component instanceof WXVContainer) {
WXVContainer container = (WXVContainer) component;
WXDomObject parentDom = (WXDomObject) container.getDomObject();
- int count = dom.childCount();
- WXDomObject child = null;
- for (int i = 0; i < count; ++i) {
- child = dom.getChild(i);
+ for (int i = 0; i < dom.childCount(); ++i) {
+ WXDomObject child = dom.getChild(i);
if (child != null) {
WXComponent childComponent = generateComponentTree(context, child, container);
container.addChild(childComponent);
- parentDom.add((WXDomObject) childComponent.getDomObject(), -1);
+ WXDomObject childDomObject = (WXDomObject) childComponent.getDomObject();
+ if(childDomObject != child) {
+ int index = parentDom.index(child);
+ parentDom.add(childDomObject, index);
+ if(index >= 0) {
+ parentDom.remove(child);
+ i--;
+ }
+ RuntimeException exception = new IllegalArgumentException(childDomObject.getClass().getName()
+ + " not support clone this");
+ WXLogUtils.e("weex", exception);
+ if(WXEnvironment.isApkDebugable()){
+ throw exception;
+ }
+ }
}
}
}
+ dom.setCloneThis(false);
if (component != null) {
component.mTraceInfo.domThreadNanos = System.nanoTime() - startNanos;
}
@@ -74,8 +88,11 @@ class DomTreeBuilder extends TraceableAction {
if(domActionContext == null){
return null;
}
- domObject.getStyles().put("display", "flex");
DomTreeBuilder builder = new DomTreeBuilder();
+ domObject.traverseTree(
+ domActionContext.getAddDOMConsumer(),
+ domActionContext.getApplyStyleConsumer()
+ );
return builder.generateComponentTree(domActionContext, domObject, parent);
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/72a852b0/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
index d371ab2..7e0746b 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
@@ -197,12 +197,15 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
listData = array;
}
}
-
+ long start = System.currentTimeMillis();
if(mDomObject != null && mDomObject.getCellList() != null){
for(int i=0; i<mDomObject.getCellList().size(); i++){
addChild(DomTreeBuilder.buildTree(mDomObject.getCellList().get(i), this));
}
}
+ if(WXEnvironment.isApkDebugable()){
+ WXLogUtils.d(TAG, "TemplateList BuildDomTree Used " + (System.currentTimeMillis() - start));
+ }
}
@Override
@@ -1003,18 +1006,10 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
return;
}
long start = System.currentTimeMillis();
- boolean async = templateViewHolder.getHolderPosition() >= 0;
+ boolean resuse = templateViewHolder.getHolderPosition() >= 0;
templateViewHolder.setHolderPosition(position);
Object data = listData.get(position);
if(component.getRenderData() == data){
- if(!async){
- if(!component.isHasLayout()) {
- Layouts.doLayoutAsync(templateViewHolder, async);
- }
- if(WXEnvironment.isApkDebugable()){
- WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder source layout used " + (System.currentTimeMillis() - start) + async);
- }
- }
component.setHasLayout(true);
}else{
List<WXComponent> updates = Statements.doRender(component, getStackContextForPosition(position, data));
@@ -1024,12 +1019,12 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder render used " + (System.currentTimeMillis() - start));
}
if(component.isHasLayout()){
- async = true;
+ resuse = true;
}
- Layouts.doLayoutAsync(templateViewHolder, async);
+ Layouts.doLayoutAsync(templateViewHolder, true);
component.setHasLayout(true);
if(WXEnvironment.isApkDebugable()){
- WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder layout used " + (System.currentTimeMillis() - start) + async);
+ WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder layout used " + (System.currentTimeMillis() - start) + resuse);
}
}
}
@@ -1097,6 +1092,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
WXCellDomObject domObject = (WXCellDomObject) component.getDomObject();
domObject.setRecyclerDomObject((WXRecyclerDomObject) getDomObject());
}
+ component.setRenderData(cell.getRenderData());
return component;
}
@@ -1109,8 +1105,8 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
if(cell == getSourceTemplate(i)){
Object data = listData.get(i);
Statements.doRender(cell, getStackContextForPosition(i, data));
+ Layouts.doSafeLayout(cell, new CSSLayoutContext());
cell.setRenderData(data);
- //WXSDKManager.getInstance().getWXDomManager().postAction(getInstanceId(), new RenderSourceCellAction(cell, null, data), false);
break;
}
}
@@ -1560,7 +1556,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
cellCache = new TemplateCache();
mTemplatesCache.put(template, cellCache);
}
- if(cellCache.cells.size() >= templateCacheSize){
+ if(cellCache.cells.size() > 0){
cellCache.isLoadIng = false;
return;
}
@@ -1571,11 +1567,6 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
AsyncTask<Void,Void, Void> preloadTask = new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
TemplateCache cellCache = mTemplatesCache.get(template);
if(cellCache == null || cellCache.cells == null){
return null;
@@ -1620,10 +1611,6 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
doInitLazyCell(component, template, true);
return iterator.hasNext();
}
- if(!component.isHasLayout()){
- Layouts.doSafeLayout(component, new CSSLayoutContext());
- component.setHasLayout(true);
- }
}
return false;
}
@@ -1640,15 +1627,15 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
component.lazy(false);
component.createView();
if(WXEnvironment.isApkDebugable()) {
- WXLogUtils.d(TAG, "doInitLazyCell " + inPreload + template + " createView used " + (System.currentTimeMillis() - start));
+ WXLogUtils.d(TAG, "doInitLazyCell idle" + inPreload + template + " createView used " + (System.currentTimeMillis() - start));
}
component.applyLayoutAndEvent(component);
if(WXEnvironment.isApkDebugable()) {
- WXLogUtils.d(TAG, "doInitLazyCell " + inPreload + template + " apply layout used " + (System.currentTimeMillis() - start));
+ WXLogUtils.d(TAG, "doInitLazyCell idle" + inPreload + template + " apply layout used " + (System.currentTimeMillis() - start));
}
component.bindData(component);
if(WXEnvironment.isApkDebugable()) {
- WXLogUtils.d(TAG, "doInitLazyCell " + inPreload + template + " bindData used " + (System.currentTimeMillis() - start));
+ WXLogUtils.d(TAG, "doInitLazyCell idle" + inPreload + template + " bindData used " + (System.currentTimeMillis() - start));
}
}
}
[10/14] incubator-weex git commit: fix scroll to bug and add md5 for
template
Posted by gu...@apache.org.
fix scroll to bug and add md5 for template
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/948aa127
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/948aa127
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/948aa127
Branch: refs/heads/master
Commit: 948aa127dd24b2570d40d1de875b1b38228af33b
Parents: e904b62
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Mon Oct 9 19:19:33 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
.../weex/ui/component/binding/Layouts.java | 69 ++++++++++++++------
.../list/template/TemplateViewHolder.java | 3 +
.../list/template/WXRecyclerTemplateList.java | 3 +-
3 files changed, 53 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/948aa127/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
index bf0abfc..f80bc1e 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
@@ -20,11 +20,15 @@ package com.taobao.weex.ui.component.binding;
+import android.os.AsyncTask;
+import android.speech.tts.Voice;
+
import com.taobao.weex.WXSDKInstance;
import com.taobao.weex.dom.WXDomObject;
import com.taobao.weex.dom.flex.CSSLayoutContext;
import com.taobao.weex.ui.component.WXComponent;
import com.taobao.weex.ui.component.WXVContainer;
+import com.taobao.weex.ui.component.list.template.TemplateViewHolder;
/**
* Created by furture on 2017/8/21.
@@ -33,34 +37,57 @@ public class Layouts {
/**
* do dom layout, and set layout to component
* */
- public static void doLayout(WXComponent component, CSSLayoutContext layoutContext){
+ public static void doLayout(final TemplateViewHolder templateViewHolder){
+ final CSSLayoutContext layoutContext = templateViewHolder.getLayoutContext();
+ final WXComponent component = templateViewHolder.getComponent();
final WXSDKInstance instance = component.getInstance();
- WXDomObject domObject = (WXDomObject) component.getDomObject();
- domObject.traverseTree(new WXDomObject.Consumer() {
+ final int position = templateViewHolder.getHolderPosition();
+ if(templateViewHolder.asyncTask != null){
+ templateViewHolder.asyncTask.cancel(true);
+ }
+ AsyncTask<Void, Void, Void> asyncTask = new AsyncTask<Void, Void, Void>() {
@Override
- public void accept(WXDomObject dom) {
- if(instance == null || instance.isDestroy()){
- return;
- }
- if(!dom.hasUpdate()){
- return;
+ protected Void doInBackground(Void... params) {
+ if(templateViewHolder.getHolderPosition() == position){
+
+ WXDomObject domObject = (WXDomObject) component.getDomObject();
+ domObject.traverseTree(new WXDomObject.Consumer() {
+ @Override
+ public void accept(WXDomObject dom) {
+ if(instance == null || instance.isDestroy()){
+ return;
+ }
+ if(!dom.hasUpdate()){
+ return;
+ }
+ dom.layoutBefore();
+ }
+ });
+ domObject.calculateLayout(layoutContext);
+ domObject.traverseTree( new WXDomObject.Consumer() {
+ @Override
+ public void accept(WXDomObject dom) {
+ if(instance == null || instance.isDestroy()){
+ return;
+ }
+ if (dom.hasUpdate()) {
+ dom.layoutAfter();
+ }
+ }
+ });
}
- dom.layoutBefore();
+ return null;
}
- });
- domObject.calculateLayout(layoutContext);
- domObject.traverseTree( new WXDomObject.Consumer() {
+
@Override
- public void accept(WXDomObject dom) {
- if(instance == null || instance.isDestroy()){
- return;
- }
- if (dom.hasUpdate()) {
- dom.layoutAfter();
+ protected void onPostExecute(Void aVoid) {
+ if(position == templateViewHolder.getHolderPosition()) {
+ setLayout(component, false);
}
}
- });
- setLayout(component, false);
+ };
+ templateViewHolder.asyncTask = asyncTask;
+ asyncTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/948aa127/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java
index 6a6c2b9..21930eb 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java
@@ -17,6 +17,7 @@
* under the License.
*/
package com.taobao.weex.ui.component.list.template;
+import android.os.AsyncTask;
import android.view.View;
import com.taobao.weex.annotation.Component;
@@ -44,6 +45,8 @@ public class TemplateViewHolder extends ListBaseViewHolder {
private int holderPosition = -1;
+ public AsyncTask<Void, Void, Void> asyncTask;
+
/**
* header position
* */
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/948aa127/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
index 1ca589b..0454aba 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
@@ -1017,7 +1017,8 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
if(WXEnvironment.isApkDebugable()){
WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder render used " + (System.currentTimeMillis() - start));
}
- Layouts.doLayout(component, templateViewHolder.getLayoutContext());
+
+ Layouts.doLayout(templateViewHolder);
cellLifecycleManager.onAttach(position, component);
if(WXEnvironment.isApkDebugable()){
WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder layout used " + (System.currentTimeMillis() - start));
[12/14] incubator-weex git commit: async layout and preload cell and
quick convert parameter
Posted by gu...@apache.org.
async layout and preload cell and quick convert parameter
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/772ac33c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/772ac33c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/772ac33c
Branch: refs/heads/master
Commit: 772ac33c16aaf639bddbd22080504b829d855842
Parents: 948aa12
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Thu Sep 28 16:32:50 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
.../java/com/taobao/weex/dom/WXDomObject.java | 3 +
.../com/taobao/weex/dom/WXTextDomObject.java | 3 +-
.../weex/ui/component/binding/Layouts.java | 101 ++++++++++++------
.../weex/ui/component/binding/Statements.java | 26 ++++-
.../list/template/TemplateViewHolder.java | 4 +
.../list/template/WXRecyclerTemplateList.java | 103 +++++++++++++++++--
.../taobao/weex/utils/WXReflectionUtils.java | 6 ++
7 files changed, 197 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/772ac33c/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
index c766e35..001545d 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
@@ -438,6 +438,9 @@ public class WXDomObject extends CSSNode implements Cloneable,ImmutableDomObject
mAttributes = new WXAttr();
}
mAttributes.putAll(attrs);
+ if(hasNewLayout()){
+ markUpdateSeen();
+ }
super.dirty();
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/772ac33c/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
index 06c4e8a..3456bde 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
@@ -41,6 +41,7 @@ import android.text.style.AlignmentSpan;
import android.text.style.ForegroundColorSpan;
import com.taobao.weex.WXEnvironment;
import com.taobao.weex.common.Constants;
+import com.taobao.weex.common.WXThread;
import com.taobao.weex.dom.flex.CSSConstants;
import com.taobao.weex.dom.flex.CSSNode;
import com.taobao.weex.dom.flex.FloatUtil;
@@ -185,7 +186,7 @@ public class WXTextDomObject extends WXDomObject {
hasBeenMeasured = false;
if (layout != null && !layout.equals(atomicReference.get()) &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- if(Looper.getMainLooper().getThread().getId() != Thread.currentThread().getId()){
+ if(Thread.currentThread() instanceof WXThread){
warmUpTextLayoutCache(layout);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/772ac33c/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
index f80bc1e..5b8d32c 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Layouts.java
@@ -21,60 +21,40 @@ package com.taobao.weex.ui.component.binding;
import android.os.AsyncTask;
-import android.speech.tts.Voice;
+import android.util.Log;
+import com.taobao.weex.WXEnvironment;
import com.taobao.weex.WXSDKInstance;
+import com.taobao.weex.common.Constants;
import com.taobao.weex.dom.WXDomObject;
import com.taobao.weex.dom.flex.CSSLayoutContext;
import com.taobao.weex.ui.component.WXComponent;
import com.taobao.weex.ui.component.WXVContainer;
import com.taobao.weex.ui.component.list.template.TemplateViewHolder;
+import com.taobao.weex.utils.WXLogUtils;
/**
* Created by furture on 2017/8/21.
*/
public class Layouts {
/**
- * do dom layout, and set layout to component
+ * do dom layout async or sync , and set layout to component on main.
+ * on first use do sync layout, when compontnet reuse do async layout
* */
- public static void doLayout(final TemplateViewHolder templateViewHolder){
- final CSSLayoutContext layoutContext = templateViewHolder.getLayoutContext();
+ public static void doLayoutAsync(final TemplateViewHolder templateViewHolder){
final WXComponent component = templateViewHolder.getComponent();
- final WXSDKInstance instance = component.getInstance();
final int position = templateViewHolder.getHolderPosition();
if(templateViewHolder.asyncTask != null){
templateViewHolder.asyncTask.cancel(true);
+ templateViewHolder.asyncTask = null;
}
AsyncTask<Void, Void, Void> asyncTask = new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
if(templateViewHolder.getHolderPosition() == position){
-
- WXDomObject domObject = (WXDomObject) component.getDomObject();
- domObject.traverseTree(new WXDomObject.Consumer() {
- @Override
- public void accept(WXDomObject dom) {
- if(instance == null || instance.isDestroy()){
- return;
- }
- if(!dom.hasUpdate()){
- return;
- }
- dom.layoutBefore();
- }
- });
- domObject.calculateLayout(layoutContext);
- domObject.traverseTree( new WXDomObject.Consumer() {
- @Override
- public void accept(WXDomObject dom) {
- if(instance == null || instance.isDestroy()){
- return;
- }
- if (dom.hasUpdate()) {
- dom.layoutAfter();
- }
- }
- });
+ if(component.getInstance() != null && !component.getInstance().isDestroy()) {
+ doSafeLayout(component, templateViewHolder.getLayoutContext());
+ }
}
return null;
}
@@ -82,14 +62,69 @@ public class Layouts {
@Override
protected void onPostExecute(Void aVoid) {
if(position == templateViewHolder.getHolderPosition()) {
- setLayout(component, false);
+ if(component.getInstance() != null && !component.getInstance().isDestroy()) {
+ setLayout(component, false);
+ }
}
}
};
templateViewHolder.asyncTask = asyncTask;
- asyncTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
+ asyncTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); //serial executor is better
+
}
+ /**
+ * safe layout
+ * */
+ public static void doSafeLayout(WXComponent component, final CSSLayoutContext layoutContext){
+ try{
+ long start = System.currentTimeMillis();
+ doLayout(component, layoutContext);
+ if(WXEnvironment.isApkDebugable()){
+ WXLogUtils.d("WXTemplateList",
+ component.getDomObject().getAttrs().get(Constants.Name.Recycler.SLOT_TEMPLATE_TYPE) + Thread.currentThread().getName() + " doSafeLayout used " +
+ (System.currentTimeMillis() - start));
+ }
+ }catch (Exception e){
+ if(WXEnvironment.isApkDebugable()){
+ WXLogUtils.e("WXTemplateListdoSafeLayout", e);
+ }
+ }
+ }
+
+ private static void doLayout(WXComponent component, final CSSLayoutContext layoutContext){
+ WXDomObject domObject = (WXDomObject) component.getDomObject();
+ final WXSDKInstance instance = component.getInstance();
+ domObject.traverseTree(new WXDomObject.Consumer() {
+ @Override
+ public void accept(WXDomObject dom) {
+ if(instance == null || instance.isDestroy()){
+ return;
+ }
+ if(!dom.hasUpdate()){
+ return;
+ }
+ dom.layoutBefore();
+ }
+ });
+ if(instance != null && !instance.isDestroy()){
+ domObject.calculateLayout(layoutContext);
+ }
+ domObject.traverseTree( new WXDomObject.Consumer() {
+ @Override
+ public void accept(WXDomObject dom) {
+ if(instance == null || instance.isDestroy()){
+ return;
+ }
+ if (dom.hasUpdate()) {
+ dom.layoutAfter();
+ }
+ }
+ });
+ }
+
+
+
/**
* recursive set layout to component,
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/772ac33c/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java
index 755bae2..6912335 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java
@@ -18,21 +18,26 @@
*/
package com.taobao.weex.ui.component.binding;
+import android.os.Looper;
import android.support.v4.util.ArrayMap;
import android.text.TextUtils;
+import android.util.Log;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.taobao.weex.common.Constants;
import com.taobao.weex.dom.WXAttr;
import com.taobao.weex.dom.WXDomObject;
import com.taobao.weex.dom.WXEvent;
import com.taobao.weex.dom.binding.ELUtils;
import com.taobao.weex.dom.binding.WXStatement;
+import com.taobao.weex.dom.flex.CSSLayoutContext;
import com.taobao.weex.el.parse.ArrayStack;
import com.taobao.weex.el.parse.Operators;
import com.taobao.weex.el.parse.Token;
import com.taobao.weex.ui.component.WXComponent;
import com.taobao.weex.ui.component.WXComponentFactory;
+import com.taobao.weex.ui.component.WXImage;
import com.taobao.weex.ui.component.WXVContainer;
import com.taobao.weex.utils.WXLogUtils;
import com.taobao.weex.utils.WXUtils;
@@ -198,9 +203,11 @@ public class Statements {
renderNodeDomObject.getAttrs().setStatement(null); // clear node's statement
parentDomObject.add(renderNodeDomObject, renderIndex);
parent.addChild(renderNode, renderIndex);
- parent.createChildViewAt(renderIndex);
- renderNode.applyLayoutAndEvent(renderNode);
- renderNode.bindData(renderNode);
+ if(Thread.currentThread() == Looper.getMainLooper().getThread()) {
+ parent.createChildViewAt(renderIndex);
+ renderNode.applyLayoutAndEvent(renderNode);
+ renderNode.bindData(renderNode);
+ }
}
doBindingAttrsEventAndRenderChildNode(renderNode, domObject, context);
renderIndex++;
@@ -307,8 +314,17 @@ public class Statements {
}
if(dynamic.size() > 0) {
- domObject.updateAttr(dynamic);
- component.updateProperties(dynamic);
+ if(dynamic.size() == 1
+ && dynamic.get(Constants.Name.SRC) != null
+ && component instanceof WXImage){
+ //for image avoid dirty layout, only update src attrs
+ domObject.getAttrs().put(Constants.Name.SRC, dynamic.get(Constants.Name.SRC));
+ }else {
+ domObject.updateAttr(dynamic); //dirty layout
+ }
+ if(Thread.currentThread() == Looper.getMainLooper().getThread()) {
+ component.updateProperties(dynamic);
+ }
}
}
WXEvent event = domObject.getEvents();
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/772ac33c/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java
index 21930eb..a418e3e 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/TemplateViewHolder.java
@@ -67,6 +67,10 @@ public class TemplateViewHolder extends ListBaseViewHolder {
return layoutContext;
}
+ public void setLayoutContext(CSSLayoutContext layoutContext){
+ this.layoutContext = layoutContext;
+ }
+
public int getHolderPosition() {
return holderPosition;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/772ac33c/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
index 0454aba..5d23bf6 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
@@ -22,6 +22,7 @@ import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Point;
import android.graphics.PointF;
+import android.os.AsyncTask;
import android.os.Build;
import android.os.Looper;
import android.support.annotation.NonNull;
@@ -53,6 +54,7 @@ import com.taobao.weex.dom.WXCellDomObject;
import com.taobao.weex.dom.WXDomObject;
import com.taobao.weex.dom.WXEvent;
import com.taobao.weex.dom.WXRecyclerDomObject;
+import com.taobao.weex.dom.flex.CSSLayoutContext;
import com.taobao.weex.dom.flex.Spacing;
import com.taobao.weex.el.parse.ArrayStack;
import com.taobao.weex.ui.component.AppearanceHelper;
@@ -82,6 +84,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import static com.taobao.weex.common.Constants.Name.LOADMOREOFFSET;
@@ -135,7 +138,8 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
private Map<String, WXCell> mTemplates;
private String listDataTemplateKey = Constants.Name.Recycler.SLOT_TEMPLATE_TYPE;
private Runnable listUpdateRunnable;
-
+ private ConcurrentHashMap<String, WXCell> mTemplatesCache;
+ private ConcurrentHashMap<String, Boolean> mTemplateRendered;
/**
* sticky helper
@@ -177,12 +181,20 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
mTemplateViewTypes = new ArrayMap<>();
mTemplateViewTypes.put("", 0); //empty view, when template was not sended
mTemplates = new HashMap<>();
+ mTemplatesCache = new ConcurrentHashMap<>();
mStickyHelper = new TemplateStickyHelper(this);
cellLifecycleManager = new CellLifecycleManager(this);
orientation = mDomObject.getOrientation();
listDataTemplateKey = WXUtils.getString(getDomObject().getAttrs().get(Constants.Name.Recycler.LIST_DATA_TEMPLATE_KEY), Constants.Name.Recycler.SLOT_TEMPLATE_TYPE);
listDataItemKey = WXUtils.getString(getDomObject().getAttrs().get(Constants.Name.Recycler.LIST_DATA_ITEM), listDataItemKey);
listDataIndexKey = WXUtils.getString(getDomObject().getAttrs().get(Constants.Name.Recycler.LIST_DATA_ITEM_INDEX), listDataIndexKey);
+ if( getDomObject().getAttrs().get(Constants.Name.Recycler.LIST_DATA) instanceof JSONArray) {
+ JSONArray array = (JSONArray)getDomObject().getAttrs().get(Constants.Name.Recycler.LIST_DATA);
+ if(array.size() > 0) {
+ listData = array;
+ }
+ }
+ mTemplateRendered = new ConcurrentHashMap<>();
}
@Override
@@ -204,6 +216,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
}
RecyclerViewBaseAdapter recyclerViewBaseAdapter = new RecyclerViewBaseAdapter<>(this);
recyclerViewBaseAdapter.setHasStableIds(true);
+ bounceRecyclerView.getInnerView().setItemAnimator(null);
bounceRecyclerView.getInnerView().setItemViewCacheSize(itemViewCacheSize);
bounceRecyclerView.getInnerView().setHasFixedSize(hasFixedSize);
bounceRecyclerView.setRecyclerViewBaseAdapter(recyclerViewBaseAdapter);
@@ -533,7 +546,13 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
Object templateId = child.getDomObject().getAttrs().get(Constants.Name.Recycler.SLOT_TEMPLATE_TYPE);
String key = WXUtils.getString(templateId, null);
if(key != null){
+ //set visible false, skip layout in dom thread, set visible true in onCreateViewHolder
+ if(child.getDomObject() != null) {
+ WXDomObject domObject = (WXDomObject) child.getDomObject();
+ domObject.setVisible(false);
+ }
mTemplates.put(key, (WXCell) child);
+ asyncPreloadCellCopyCache(key);
if(mTemplateViewTypes.get(key) == null){
mTemplateViewTypes.put(key, mTemplateViewTypes.size());
}
@@ -1017,8 +1036,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
if(WXEnvironment.isApkDebugable()){
WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder render used " + (System.currentTimeMillis() - start));
}
-
- Layouts.doLayout(templateViewHolder);
+ Layouts.doLayoutAsync(templateViewHolder);
cellLifecycleManager.onAttach(position, component);
if(WXEnvironment.isApkDebugable()){
WXLogUtils.d(TAG, position + getTemplateKey(position) + " onBindViewHolder layout used " + (System.currentTimeMillis() - start));
@@ -1034,30 +1052,95 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
view.setLayoutParams(new FrameLayout.LayoutParams(0, 0));
return new TemplateViewHolder(view, viewType);
}
- WXCell component = (WXCell) Statements.copyComponentTree(source);
- if(component.getDomObject() instanceof WXCellDomObject
- && getDomObject() instanceof WXRecyclerDomObject){
- WXCellDomObject domObject = (WXCellDomObject) component.getDomObject();
- domObject.setRecyclerDomObject((WXRecyclerDomObject) getDomObject());
+ long start = System.currentTimeMillis();
+ WXCell component = mTemplatesCache.remove(template);
+ boolean needLayout = false;
+ if(component == null) {
+ component = (WXCell) copyCell(source);
+ needLayout = true;
+ }
+ asyncPreloadCellCopyCache(template);
+ CSSLayoutContext layoutContext = null;
+ if(needLayout){
+ layoutContext = new CSSLayoutContext();
+ Layouts.doSafeLayout(component, layoutContext);
+ if(WXEnvironment.isApkDebugable()){
+ WXLogUtils.d(TAG, template + " onCreateViewHolder sync layout used " + (System.currentTimeMillis() - start));
+ }
}
+ Layouts.setLayout(component, false);
component.lazy(false);
- long start = System.currentTimeMillis();
component.createView();
if(WXEnvironment.isApkDebugable()){
WXLogUtils.d(TAG, template + " onCreateViewHolder view used " + (System.currentTimeMillis() - start));
}
component.applyLayoutAndEvent(component);
if(WXEnvironment.isApkDebugable()) {
- WXLogUtils.d(TAG, template + " onCreateViewHolder layout used " + (System.currentTimeMillis() - start));
+ WXLogUtils.d(TAG, template + " onCreateViewHolder apply layout used " + (System.currentTimeMillis() - start));
}
component.bindData(component);
if(WXEnvironment.isApkDebugable()) {
WXLogUtils.d(TAG, template + " onCreateViewHolder bindData used " + (System.currentTimeMillis() - start));
}
TemplateViewHolder templateViewHolder = new TemplateViewHolder(component, viewType);
+ templateViewHolder.setLayoutContext(layoutContext);
return templateViewHolder;
}
+ private void asyncPreloadCellCopyCache(final String template) {
+ final WXCell cell = mTemplates.get(template);
+ if(cell == null){
+ return;
+ }
+ if(mTemplatesCache.get(template) != null){
+ return;
+ }
+ AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
+ @Override
+ public void run() {
+ if(cell.getInstance() == null || cell.getInstance().isDestroy()){
+ return;
+ }
+ WXCell component = (WXCell) copyCell(cell);
+ if(cell.getInstance() == null || cell.getInstance().isDestroy()){
+ return;
+ }
+ Layouts.doSafeLayout(component, new CSSLayoutContext());
+ mTemplatesCache.put(template, component);
+ }
+ });
+ }
+
+ /**
+ * copy cell component from source, and return source
+ * */
+ private WXComponent copyCell(WXComponent cell){
+ /** pre render for cell */
+ Boolean rendered = mTemplateRendered.get(cell.getRef());
+ if(rendered == null || !rendered) {
+ if(listData != null){
+ for(int i=0; i<listData.size(); i++){
+ WXCell source = getSourceTemplate(i);
+ if(source == cell){
+ Statements.doRender(cell, getStackContextForPosition(i));
+ mTemplateRendered.put(source.getRef(), true);
+ break;
+ }
+ }
+ }
+ }
+ WXCell component = (WXCell) Statements.copyComponentTree(cell);
+ if(component.getDomObject() != null){
+ ((WXDomObject)component.getDomObject()).setVisible(true);
+ }
+ if(component.getDomObject() instanceof WXCellDomObject
+ && getDomObject() instanceof WXRecyclerDomObject){
+ WXCellDomObject domObject = (WXCellDomObject) component.getDomObject();
+ domObject.setRecyclerDomObject((WXRecyclerDomObject) getDomObject());
+ }
+ return component;
+ }
+
/**
* @param position
* when template not send, return an invalid id, use empty view holder.
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/772ac33c/android/sdk/src/main/java/com/taobao/weex/utils/WXReflectionUtils.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/utils/WXReflectionUtils.java b/android/sdk/src/main/java/com/taobao/weex/utils/WXReflectionUtils.java
index 930c383..5bef6d3 100644
--- a/android/sdk/src/main/java/com/taobao/weex/utils/WXReflectionUtils.java
+++ b/android/sdk/src/main/java/com/taobao/weex/utils/WXReflectionUtils.java
@@ -20,6 +20,8 @@ package com.taobao.weex.utils;
import android.text.TextUtils;
import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -39,6 +41,10 @@ public class WXReflectionUtils {
return value.getClass().isAssignableFrom(double.class) ? value : WXUtils.getDouble(value);
} else if (paramClazz == float.class) {
return value.getClass().isAssignableFrom(float.class) ? value : WXUtils.getFloat(value);
+ } else if (paramClazz == JSONArray.class && value != null && value.getClass() == JSONArray.class) {
+ return value;
+ } else if (paramClazz == JSONObject.class && value != null && value.getClass() == JSONObject.class) {
+ return value;
} else {
return JSON.parseObject(value instanceof String ? (String) value : JSON.toJSONString(value), paramClazz);
}
[07/14] incubator-weex git commit: fix scroll to bug and add md5 for
template
Posted by gu...@apache.org.
fix scroll to bug and add md5 for template
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/8cc05165
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/8cc05165
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/8cc05165
Branch: refs/heads/master
Commit: 8cc05165c421fb0a27656ff4313069cb80addc8d
Parents: ef1aad2
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Mon Oct 9 19:19:33 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
.../com/taobao/weex/bridge/WXBridgeManager.java | 3 +-
.../ui/component/list/BasicListComponent.java | 29 +-------------------
.../java/com/taobao/weex/utils/WXFileUtils.java | 26 ++++++++++++++++++
.../com/taobao/weex/utils/WXFileUtilsTest.java | 8 ++++++
4 files changed, 37 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8cc05165/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
index d1ea794..a949e3b 100644
--- a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
+++ b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
@@ -1431,7 +1431,8 @@ public class WXBridgeManager implements Callback,BactchExecutor {
} catch (Throwable e) {
instance.onRenderError(WXRenderErrorCode.WX_CREATE_INSTANCE_ERROR,
"createInstance failed!");
- String err = "[WXBridgeManager] invokeCreateInstance " + e.getCause();
+ String err = "[WXBridgeManager] invokeCreateInstance " + e.getCause()
+ + " template md5 " + WXFileUtils.md5(template) + " length " + (template == null ? 0 : template.length());
commitJSBridgeAlarmMonitor(instance.getInstanceId(), WXErrorCode.WX_ERR_INVOKE_NATIVE,err);
WXLogUtils.e(err);
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8cc05165/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
index 296946a..9b8fe04 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
@@ -461,34 +461,7 @@ public abstract class BasicListComponent<T extends ViewGroup & ListComponentView
}
final WXRecyclerView view = bounceRecyclerView.getInnerView();
-
- if (!smooth) {
- RecyclerView.LayoutManager layoutManager = view.getLayoutManager();
- if (layoutManager instanceof LinearLayoutManager) {
- //GridLayoutManager is also instance of LinearLayoutManager
- ((LinearLayoutManager) layoutManager).scrollToPositionWithOffset(pos, -offset);
- } else if (layoutManager instanceof StaggeredGridLayoutManager) {
- ((StaggeredGridLayoutManager) layoutManager).scrollToPositionWithOffset(pos, -offset);
- }
- //Any else?
- } else {
- view.smoothScrollToPosition(pos);
- if (offset != 0) {
- view.addOnScrollListener(new RecyclerView.OnScrollListener() {
- @Override
- public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
- if (newState == RecyclerView.SCROLL_STATE_IDLE) {
- if (getOrientation() == Constants.Orientation.VERTICAL) {
- recyclerView.smoothScrollBy(0, offset);
- } else {
- recyclerView.smoothScrollBy(offset, 0);
- }
- recyclerView.removeOnScrollListener(this);
- }
- }
- });
- }
- }
+ view.scrollTo(smooth, pos, offset, getOrientation());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8cc05165/android/sdk/src/main/java/com/taobao/weex/utils/WXFileUtils.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/utils/WXFileUtils.java b/android/sdk/src/main/java/com/taobao/weex/utils/WXFileUtils.java
index 0083326..3921cfd 100644
--- a/android/sdk/src/main/java/com/taobao/weex/utils/WXFileUtils.java
+++ b/android/sdk/src/main/java/com/taobao/weex/utils/WXFileUtils.java
@@ -29,6 +29,10 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
public class WXFileUtils {
@@ -130,4 +134,26 @@ public class WXFileUtils {
}
return false;
}
+
+ public static String md5(String template){
+ try {
+ if(template == null){
+ return "";
+ }
+ return md5(template.getBytes("UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ return "";
+ }
+ }
+
+ public static String md5(byte[] bts){
+ try {
+ MessageDigest digest = MessageDigest.getInstance("MD5");
+ digest.update(bts);
+ BigInteger bigInt = new BigInteger(1, digest.digest());
+ return bigInt.toString(16);
+ } catch (NoSuchAlgorithmException e) {;
+ return "";
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8cc05165/android/sdk/src/test/java/com/taobao/weex/utils/WXFileUtilsTest.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/test/java/com/taobao/weex/utils/WXFileUtilsTest.java b/android/sdk/src/test/java/com/taobao/weex/utils/WXFileUtilsTest.java
index 64a0720..13d47a3 100644
--- a/android/sdk/src/test/java/com/taobao/weex/utils/WXFileUtilsTest.java
+++ b/android/sdk/src/test/java/com/taobao/weex/utils/WXFileUtilsTest.java
@@ -20,6 +20,8 @@ package com.taobao.weex.utils;
import com.taobao.weappplus_sdk.BuildConfig;
import java.io.File;
+
+import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -62,4 +64,10 @@ public class WXFileUtilsTest {
public void testSaveFile() throws Exception {
WXFileUtils.saveFile("build/test","test".getBytes(),RuntimeEnvironment.application);
}
+
+
+ @Test
+ public void testMd5(){
+ Assert.assertEquals("77963b7a931377ad4ab5ad6a9cd718aa", WXFileUtils.md5("ddd"));
+ }
}
[13/14] incubator-weex git commit: reduce unused code and reuse
hashmap
Posted by gu...@apache.org.
reduce unused code and reuse hashmap
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/6d9be145
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/6d9be145
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/6d9be145
Branch: refs/heads/master
Commit: 6d9be1457300955f556617b01018094ff970fe15
Parents: 72a852b
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Mon Oct 9 19:52:50 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java | 6 +-----
.../sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java | 2 +-
.../sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java | 2 +-
.../main/java/com/taobao/weex/ui/component/WXComponent.java | 2 +-
.../java/com/taobao/weex/ui/component/binding/Statements.java | 1 +
5 files changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6d9be145/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
index f990792..782b16c 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
@@ -138,9 +138,6 @@ public class WXDomObject extends CSSNode implements Cloneable,ImmutableDomObject
return mRef;
}
- public void setRef(String ref) {
- this.mRef = ref;
- }
public String getType(){
return mType;
@@ -169,7 +166,6 @@ public class WXDomObject extends CSSNode implements Cloneable,ImmutableDomObject
}
-
public @NonNull DomContext getDomContext() {
return mDomContext;
}
@@ -466,7 +462,7 @@ public class WXDomObject extends CSSNode implements Cloneable,ImmutableDomObject
super.dirty();
}
- /** package **/public void applyStyleToNode() {
+ /** package **/ void applyStyleToNode() {
WXStyle stylesMap = getStyles();
int vp = getViewPortWidth();
if (!stylesMap.isEmpty()) {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6d9be145/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
index 749afbd..e9a5c79 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
@@ -175,7 +175,7 @@ public class WXTextDomObject extends WXDomObject {
spanned = createSpanned(mText);
if(hasNewLayout()){
if(WXEnvironment.isApkDebugable()) {
- WXLogUtils.w("TextDom", new IllegalStateException("Previous csslayout was ignored! markLayoutSeen() never called"));
+ WXLogUtils.d("Previous csslayout was ignored! markLayoutSeen() never called");
}
markUpdateSeen();
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6d9be145/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java
index 79ba6e5..624c4c9 100755
--- a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java
@@ -173,7 +173,7 @@ public class CSSNode {
return;
} else if (mLayoutState == LayoutState.HAS_NEW_LAYOUT) {
if(WXEnvironment.isApkDebugable()){
- WXLogUtils.w("weex", new IllegalStateException("Previous csslayout was ignored! markLayoutSeen() never called"));
+ WXLogUtils.d("Previous csslayout was ignored! markLayoutSeen() never called");
}
markLayoutSeen();
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6d9be145/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
index 1d64d5d..d801290 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
@@ -337,7 +337,7 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi
long startNanos = System.nanoTime();
if(!isLazy()) {
if (component == null) {
- component = this;
+ component = this;
}
setLayout(component.getDomObject());
setPadding(component.getDomObject().getPadding(), component.getDomObject().getBorder());
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6d9be145/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java
index 1af8934..548a1a0 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/Statements.java
@@ -392,6 +392,7 @@ public class Statements {
Map<String, Object> dynamic = dynamicLocal.get();
if(dynamic == null) {
dynamic = new HashMap<>();
+ dynamicLocal.set(dynamic);
}
if(dynamic.size() > 0){
dynamic.clear();
[11/14] incubator-weex git commit: * [ios] update image load
performance
Posted by gu...@apache.org.
* [ios] update image load performance
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/34b7b1b5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/34b7b1b5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/34b7b1b5
Branch: refs/heads/master
Commit: 34b7b1b530bb018e97763a1431622382c1344552
Parents: 93c95f2
Author: acton393 <zh...@gmail.com>
Authored: Mon Oct 9 21:39:16 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
.../Sources/Component/WXImageComponent.m | 89 ++++++++++----------
1 file changed, 45 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/34b7b1b5/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
index 90c29a1..4cbe4da 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
@@ -336,14 +336,17 @@ WX_EXPORT_METHOD(@selector(save:))
- (void)setImageSrc:(NSString*)src
{
- pthread_mutex_lock(&(_imageSrcMutex));
- if (![src isEqualToString:_imageSrc]) {
- _imageSrc = src;
- _imageDownloadFinish = NO;
- ((UIImageView*)self.view).image = nil;
- [self updateImage];
+ if ([src isEqualToString:_imageSrc]) {
+ // if image src is equal to then ignore it.
+ return;
}
+ pthread_mutex_lock(&(_imageSrcMutex));
+ _imageSrc = src;
+ _imageDownloadFinish = NO;
+ ((UIImageView*)self.view).image = nil;
pthread_mutex_unlock(&(_imageSrcMutex));
+
+ [self updateImage];
}
- (void)updateImage
@@ -426,45 +429,43 @@ WX_EXPORT_METHOD(@selector(save:))
NSString * newURL = [imageSrc copy];
WX_REWRITE_URL(imageSrc, WXResourceTypeImage, self.weexInstance)
__weak typeof(self) weakSelf = self;
- dispatch_async(dispatch_get_main_queue(), ^{
- weakSelf.imageOperation = [[weakSelf imageLoader] downloadImageWithURL:newURL imageFrame:weakSelf.calculatedFrame userInfo:userInfo completed:^(UIImage *image, NSError *error, BOOL finished) {
- dispatch_async(dispatch_get_main_queue(), ^{
- __strong typeof(self) strongSelf = weakSelf;
-
- if (strongSelf.imageLoadEvent) {
- NSMutableDictionary *sizeDict = [NSMutableDictionary new];
- sizeDict[@"naturalWidth"] = @0;
- sizeDict[@"naturalHeight"] = @0;
- if (!error) {
- sizeDict[@"naturalWidth"] = @(image.size.width * image.scale);
- sizeDict[@"naturalHeight"] = @(image.size.height * image.scale);
- } else {
- [sizeDict setObject:[error description]?:@"" forKey:@"errorDesc"];
- }
- [strongSelf fireEvent:@"load" params:@{ @"success": error? @false : @true,@"size":sizeDict}];
- }
- if (error) {
- downloadFailedBlock(imageSrc, error);
- [strongSelf readyToRender];
- return ;
- }
-
- if (![imageSrc isEqualToString:strongSelf.imageSrc]) {
- return ;
- }
-
- if ([strongSelf isViewLoaded]) {
- strongSelf.imageDownloadFinish = YES;
- ((UIImageView *)strongSelf.view).image = image;
- [strongSelf readyToRender];
- } else if (strongSelf->_isCompositingChild) {
- strongSelf.imageDownloadFinish = YES;
- strongSelf->_image = image;
- [strongSelf setNeedsDisplay];
+ weakSelf.imageOperation = [[weakSelf imageLoader] downloadImageWithURL:newURL imageFrame:weakSelf.calculatedFrame userInfo:userInfo completed:^(UIImage *image, NSError *error, BOOL finished) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ __strong typeof(self) strongSelf = weakSelf;
+
+ if (strongSelf.imageLoadEvent) {
+ NSMutableDictionary *sizeDict = [NSMutableDictionary new];
+ sizeDict[@"naturalWidth"] = @0;
+ sizeDict[@"naturalHeight"] = @0;
+ if (!error) {
+ sizeDict[@"naturalWidth"] = @(image.size.width * image.scale);
+ sizeDict[@"naturalHeight"] = @(image.size.height * image.scale);
+ } else {
+ [sizeDict setObject:[error description]?:@"" forKey:@"errorDesc"];
}
- });
- }];
- });
+ [strongSelf fireEvent:@"load" params:@{ @"success": error? @false : @true,@"size":sizeDict}];
+ }
+ if (error) {
+ downloadFailedBlock(imageSrc, error);
+ [strongSelf readyToRender];
+ return ;
+ }
+
+ if (![imageSrc isEqualToString:strongSelf.imageSrc]) {
+ return ;
+ }
+
+ if ([strongSelf isViewLoaded]) {
+ strongSelf.imageDownloadFinish = YES;
+ ((UIImageView *)strongSelf.view).image = image;
+ [strongSelf readyToRender];
+ } else if (strongSelf->_isCompositingChild) {
+ strongSelf.imageDownloadFinish = YES;
+ strongSelf->_image = image;
+ [strongSelf setNeedsDisplay];
+ }
+ });
+ }];
}
- (void)readyToRender
[06/14] incubator-weex git commit: * [jsfm] upgrade weex-js-framework
to 0.22.5
Posted by gu...@apache.org.
* [jsfm] upgrade weex-js-framework to 0.22.5
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/ef1aad20
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/ef1aad20
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/ef1aad20
Branch: refs/heads/master
Commit: ef1aad205cc5a407075181a3753c2bfe976ca1ff
Parents: 1c33e23
Author: Hanks <zh...@gmail.com>
Authored: Mon Oct 9 17:42:36 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
pre-build/native-bundle-main.js | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
[04/14] incubator-weex git commit: * [ios] bugfix scroll event not
valid
Posted by gu...@apache.org.
* [ios] bugfix scroll event not valid
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/1c33e23b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1c33e23b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1c33e23b
Branch: refs/heads/master
Commit: 1c33e23b4c276674289750a12184cd0ee7b9d10f
Parents: d10be0b
Author: gurisxie <27...@qq.com>
Authored: Mon Oct 9 16:32:56 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c33e23b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
index ae43cd6..88c934c 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
@@ -521,7 +521,7 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
distance = scrollView.contentOffset.y - _lastScrollEventFiredOffset.y;
}
if (fabs(distance) >= _offsetAccuracy) {
-// [self fireEvent:@"scroll" params:@{@"contentSize":contentSizeData,@"contentOffset":contentOffsetData} domChanges:nil];
+ [self fireEvent:@"scroll" params:@{@"contentSize":contentSizeData,@"contentOffset":contentOffsetData} domChanges:nil];
_lastScrollEventFiredOffset = scrollView.contentOffset;
}
}
[09/14] incubator-weex git commit: * [ios] add more comments about
category
Posted by gu...@apache.org.
* [ios] add more comments about category
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/93c95f2a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/93c95f2a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/93c95f2a
Branch: refs/heads/master
Commit: 93c95f2ab96d66c71909ce6db62da3a04f10f62d
Parents: a8d3afc
Author: acton393 <zh...@gmail.com>
Authored: Mon Oct 9 19:46:20 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/93c95f2a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
index bf8021f..a7d042e 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
@@ -33,7 +33,6 @@
@implementation WXScrollerComponnetView
@end;
-// add a category compatible for new API
@interface WXScrollerComponnetView(WXScrollerComponnetView_ContentInsetAdjustmentBehavior)
@property(nonatomic, assign)NSUInteger contentInsetAdjustmentBehavior;
@end
@@ -166,7 +165,10 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
scrollView.alwaysBounceHorizontal = _alwaysScrollableHorizontal;
scrollView.alwaysBounceVertical = _alwaysScrollableVertical;
if (WX_SYS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
- // now use the runtime to forbid the contentInset being Adjusted
+ // now use the runtime to forbid the contentInset being Adjusted.
+ // here we add a category for scoller component view class compatible for new API,
+ // as we are concerning about weexSDK build as framework by Xcode8, using in Xcode9 project,
+ // so the the macro __IPHONE_11_0 will be useless in this case.
scrollView.contentInsetAdjustmentBehavior = 2;
}
[03/14] incubator-weex git commit: * [test] bugfix for unexpected
error
Posted by gu...@apache.org.
* [test] bugfix for unexpected error
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e904b629
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e904b629
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e904b629
Branch: refs/heads/master
Commit: e904b629932ee5fd833dc93c17f7f1dadff38e5a
Parents: 34b7b1b
Author: gurisxie <27...@qq.com>
Authored: Tue Oct 10 10:13:59 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
dangerfile.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e904b629/dangerfile.js
----------------------------------------------------------------------
diff --git a/dangerfile.js b/dangerfile.js
index 248276a..97c4146 100644
--- a/dangerfile.js
+++ b/dangerfile.js
@@ -418,7 +418,7 @@ function findBlameReviewers(fileToDeletedLinesMap, fileToNormalLinesMap, fileToB
}
deletedLines.forEach(lineNumber => {
var name = blames[lineNumber]
- if (!!reviewers) {
+ if (name && !!reviewers) {
reviewers[name] = (reviewers[name] || 0) + 3
}
})
@@ -433,7 +433,7 @@ function findBlameReviewers(fileToDeletedLinesMap, fileToNormalLinesMap, fileToB
}
normalLines.forEach(lineNumber => {
var name = blames[lineNumber]
- if (!!reviewers) {
+ if (name && !!reviewers) {
reviewers[name] = (reviewers[name] || 0) + 1
}
})
[08/14] incubator-weex git commit: * [ios] add
WXScrollerComponentView and compatible iOS 11 new API
Posted by gu...@apache.org.
* [ios] add WXScrollerComponentView and compatible iOS 11 new API
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/a8d3afc8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/a8d3afc8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/a8d3afc8
Branch: refs/heads/master
Commit: a8d3afc87503c0e04703e91adf57c42769bd99ab
Parents: 8cc0516
Author: acton393 <zh...@gmail.com>
Authored: Mon Oct 9 18:22:56 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 10 12:11:25 2017 +0800
----------------------------------------------------------------------
.../WeexSDK/Sources/Component/WXScrollerComponent.m | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a8d3afc8/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
index 88c934c..bf8021f 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
@@ -26,7 +26,15 @@
#import "WXUtility.h"
#import "WXLoadingComponent.h"
#import "WXRefreshComponent.h"
-@interface UIScrollView(WeexUIScrollerView_ContentInsetAdjustmentBehavior)
+
+@interface WXScrollerComponnetView:UIScrollView
+@end
+
+@implementation WXScrollerComponnetView
+@end;
+
+// add a category compatible for new API
+@interface WXScrollerComponnetView(WXScrollerComponnetView_ContentInsetAdjustmentBehavior)
@property(nonatomic, assign)NSUInteger contentInsetAdjustmentBehavior;
@end
@@ -139,14 +147,14 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
- (UIView *)loadView
{
- return [[UIScrollView alloc] init];
+ return [[WXScrollerComponnetView alloc] init];
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self setContentSize:_contentSize];
- UIScrollView* scrollView = (UIScrollView *)self.view;
+ WXScrollerComponnetView* scrollView = (WXScrollerComponnetView *)self.view;
scrollView.delegate = self;
scrollView.exclusiveTouch = YES;
scrollView.autoresizesSubviews = NO;