Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into release-0.19-bugfix0619
Browse files Browse the repository at this point in the history
  • Loading branch information
gubaojian authored Jun 27, 2018
2 parents 42f6c73 + 049d19f commit 9927930
Show file tree
Hide file tree
Showing 40 changed files with 217 additions and 164 deletions.
11 changes: 1 addition & 10 deletions POSSIBLE-NOTICES-FOR-BIN-DIST
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,13 @@ by Tom Preston-Werner , licensed under the Creative Commons - CC BY 3.0 License.
This product contains software core-js(https://github.com/zloirock/core-js) developed
by Denis Pushkarev , licensed under the MIT License.

This product contains software autoprefixer(https://github.com/postcss/autoprefixer) developed
by postcss , licensed under the MIT License.

This product contains software query-string(https://github.com/sindresorhus/query-string) developed
by sindresorhus , licensed under the MIT License.

This product contains software weex-picker(https://github.com/weexteam/weex-picker) developed
by abigtree , licensed under the Apache 2.0 License.

This product contains software weex-rax-framework(https://github.com/alibaba/rax) developed
by yuanyan , licensed under the BSD-3-Clause License.

This product contains software weex-vue-framework(https://github.com/vuejs/vue) developed
by fkysly , licensed under the MIT License.

This product contains software weex-vue-render(https://github.com/vuejs/vue) developed
This product contains software weex-vue-render(https://github.com/weexteam/weex-vue-render) developed
by MrRaindrop , licensed under the Apache 2.0 License.

This product contains software weex-styler(https://github.com/weexteam/weex-styler) developed
Expand Down
84 changes: 41 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Weex

A framework for building Mobile cross-platform UI.
A framework for building mobile cross-platform UI.

[![CircleCI](https://circleci.com/gh/alibaba/weex/tree/dev.svg?style=svg&circle-token=b83b047a3a01f6ec26458a455530a5ddc261925f)](https://circleci.com/gh/alibaba/weex/tree/dev)

Expand All @@ -10,80 +10,78 @@ A framework for building Mobile cross-platform UI.
| iOS | [![Pod version](https://badge.fury.io/co/WeexSDK.svg)](https://cocoapods.org/pods/WeexSDK) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) |
| [Mobile Web](https://github.com/weexteam/weex-vue-render) | [![npm version](https://badge.fury.io/js/weex-html5.svg)](https://www.npmjs.com/package/weex-vue-render) |

Support Android 4.1 (API 16), iOS 8.0+ and WebKit 534.30+.
Supports Android 4.1 (API 16), iOS 8.0+ and WebKit 534.30+.

## For Windows

Please ***INSTALL [Git for Windows](https://git-scm.com/download/win)*** and run all the following commands in git-bash.

## Meet Weex

* Install [Weex Playground App](https://weex.apache.org/tools/playground.html) to see examples we already written.
* If you want to write a demo, install [weex-toolkit](https://www.npmjs.com/package/weex-toolkit) in [Node.js](http://nodejs.org/) 4.0+ and
* Run `weex init` to generate & start a simple project in an empty folder.
* Follow the instructions in the project README.
* Install [Weex Playground App](https://weex.apache.org/tools/playground.html) to see existing examples.
* Create your own examples by install [weex-toolkit](https://www.npmjs.com/package/weex-toolkit) with [Node.js](http://nodejs.org/) 8.0+.
* Run `weex init` command on an empty folder to generate & start a new project.
* Follow the instructions from in the project's README file.
* [Add an example](./examples/README.md#add-an-example).
* Enjoy it.

## Use Weex

* [Tutorial](http://weex.apache.org/guide/)
* [Documents](http://weex.apache.org/references)

### Android
### Prerequisites for All Platforms

* Install [Node.js](http://nodejs.org/) 8.0+
* Under the project's root directory, in terminal:
* Run `npm install` command, to install project dependencies.
* Run `./start` command.

### Android
* Prerequisites
* Install [Node.js](http://nodejs.org/) 4.0+
* Under project root
* `npm install`, install project
* `./start`
* Install [Android Environment](http://developer.android.com/training/basics/firstapp/index.html)
* Run playground, In Android Studio
* Install [Android Environment](http://developer.android.com/training/basics/firstapp/index.html)
* Run playground in Android Studio
* Open `android/playground`
* In `app/java/com.alibaba.weex/IndexActivity`, modify `CURRENT_IP` to your local IP
* Click <img src="http://gtms04.alicdn.com/tps/i4/TB1wCcqMpXXXXakXpXX3G7tGXXX-34-44.png" height="16" > (`Run` button)
* [Add an example](./examples/README.md#add-an-example)

#### Runtime

On Android Platform , Weex code is executed in [weex_v8core](https://github.com/alibaba/weex_v8core) which is based on Google V8 JavaScript engine.
On Android Platform, Weex code is executed in [weex_v8core](https://github.com/alibaba/weex_v8core) which is based on Google V8 JavaScript engine.

### iOS
* run playground
* Prerequisites
* Install [Node.js](http://nodejs.org/) 4.0+
* Under project root
* `npm install`, install project
* `./start`
* Install [iOS Environment](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppStoreDistributionTutorial/Setup/Setup.html)
* Install [CocoaPods](https://guides.cocoapods.org/using/getting-started.html)
* Run playground
* `cd ios/playground`
* `pod install`
* Open `WeexDemo.xcworkspace` in Xcode
* Click <img src="http://img1.tbcdn.cn/L1/461/1/5470b677a2f2eaaecf412cc55eeae062dbc275f9" height="16" > (`Run` button) or use default shortcut `cmd + r` in Xcode
* If you want to run the demo on your device, don't need to modify `CURRENT_IP` manually. ~~In `DemoDefine.h`(you can search this file by Xcode default shortcut `cmd + shift + o`), modify `CURRENT_IP` to your local IP~~
* [Add an example](./examples/README.md#add-an-example)
* integrate to your application

* Prerequisites
* Install [iOS Environment](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppStoreDistributionTutorial/Setup/Setup.html)
* Install [CocoaPods](https://guides.cocoapods.org/using/getting-started.html)

* Run playground
* `cd ios/playground`
* `pod install`
* Open `WeexDemo.xcworkspace` in Xcode
* Click <img src="http://img1.tbcdn.cn/L1/461/1/5470b677a2f2eaaecf412cc55eeae062dbc275f9" height="16" > (`Run` button) or use default shortcut `cmd + r` in Xcode
* If you want to run the demo on your device, don't need to modify `CURRENT_IP` manually. ~~In `DemoDefine.h`(you can search this file by Xcode default shortcut `cmd + shift + o`), modify `CURRENT_IP` to your local IP~~

* Integrate to your application
- **[CocoaPods](https://cocoapods.org)**
Add the following line to your Podfile:
```
pod 'WeexSDK'
```

Add the following line to your Podfile:
```
pod 'WeexSDK'
```
run `pod install`
- **[Carthage](https://github.com/carthage/carthage)**
Add the following line to your Cartfile:
```
github "apache/incubator-weex"
```
Run `carthage update`, and you should now have the latest version of `WeexSDK` in your `Carthage` folder.
```
github "apache/incubator-weex"
```
Run `carthage update`, and you should now have the latest version of `WeexSDK` in your `Carthage` folder.
### Mobile Web
see [weex-vue-render](https://github.com/weexteam/weex-vue-render).
See [weex-vue-render](https://github.com/weexteam/weex-vue-render).
## Scripts
Expand Down
2 changes: 1 addition & 1 deletion android/sdk/assets/weex-main-jsfm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion android/sdk/assets/weex-rax-api.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public class WXSDKInstance implements IWXActivityStateListener,View.OnLayoutChan

//Performance
public boolean mEnd = false;
public boolean isJSCreateFinish =false;
public static final String BUNDLE_URL = "bundleUrl";
private IWXUserTrackAdapter mUserTrackAdapter;
private IWXRenderListener mRenderListener;
Expand Down Expand Up @@ -1121,6 +1122,7 @@ public void runOnUiThread(Runnable action) {
}

public void onRenderSuccess(final int width, final int height) {
isJSCreateFinish = true;
firstScreenRenderFinished();

long time = System.currentTimeMillis() - mRenderStartTime;
Expand Down Expand Up @@ -1181,10 +1183,10 @@ public void run() {
}

/**
* when add/rm/mv element
* when add/rm element
*/
public void onElementChange(){
if (isDestroy() || !mEnd ||null == mRenderContainer || mRenderContainer.isPageHasEvent() ||
public void onElementChange(boolean afterJSCreateFinish){
if (isDestroy() || !afterJSCreateFinish ||null == mRenderContainer || mRenderContainer.isPageHasEvent() ||
mWXPerformance == null){
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.taobao.weex.common.Destroyable;
import com.taobao.weex.common.WXErrorCode;
import com.taobao.weex.common.WXException;
import com.taobao.weex.common.WXInstanceWrap;
import com.taobao.weex.common.WXModule;
import com.taobao.weex.ui.config.ConfigModuleFactory;
import com.taobao.weex.ui.module.WXDomModule;
Expand Down Expand Up @@ -183,7 +184,7 @@ static Object callModuleMethod(final String instanceId, String moduleStr, String
WXLogUtils.e("callModuleMethod >>> invoke module:" + moduleStr + ", method:" + methodStr + " failed. ", e);
return null;
} finally {
if (wxModule instanceof WXDomModule || wxModule instanceof WXTimerModule) {
if (wxModule instanceof WXDomModule || wxModule instanceof WXTimerModule || wxModule instanceof WXInstanceWrap) {
wxModule.mWXSDKInstance = null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class GraphicActionAddElement extends GraphicActionAbstractAddElement {
private WXComponent child;
private GraphicPosition layoutPosition;
private GraphicSize layoutSize;
private boolean isJSCreateFinish = false;

public GraphicActionAddElement(String pageId, String ref,
String componentType, String parentRef,
Expand Down Expand Up @@ -72,6 +73,7 @@ public GraphicActionAddElement(String pageId, String ref,
mParentRef);
child = createComponent(instance, parent, basicComponentData);
child.setTransition(WXTransition.fromMap(child.getStyles(), child));
isJSCreateFinish = instance.isJSCreateFinish;

if (child == null || parent == null) {
return;
Expand Down Expand Up @@ -122,7 +124,7 @@ public void executeAction() {
child.bindData(child);
WXSDKInstance instance = WXSDKManager.getInstance().getWXRenderManager().getWXSDKInstance(getPageId());
if (null!=instance){
instance.onElementChange();
instance.onElementChange(isJSCreateFinish);
// instance.setma
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public class GraphicActionAnimation extends BasicGraphicAction {

private final static String TAG = "GraphicActionAnimation";

private final boolean styleNeedInit;

@Nullable
private
final String callback;
Expand All @@ -71,13 +73,15 @@ public class GraphicActionAnimation extends BasicGraphicAction {

public GraphicActionAnimation(@NonNull String pageId, @NonNull String ref, @NonNull WXAnimationBean animationBean) {
super(pageId, ref);
this.styleNeedInit = false;
this.callback = null;
this.mAnimationBean = animationBean;
}

public GraphicActionAnimation(@NonNull String pageId, @NonNull String ref, @Nullable String animation,
@Nullable final String callBack) {
super(pageId, ref);
this.styleNeedInit = true;
this.callback = callBack;
if (!TextUtils.isEmpty(animation)) {
this.mAnimationBean = JSONObject.parseObject(animation, WXAnimationBean.class);
Expand All @@ -86,6 +90,7 @@ public GraphicActionAnimation(@NonNull String pageId, @NonNull String ref, @Null
public GraphicActionAnimation(@NonNull String pageId, @NonNull String ref, @NonNull WXAnimationBean animationBean,
@Nullable final String callBack) {
super(pageId, ref);
this.styleNeedInit = false;
this.mAnimationBean = animationBean;
this.callback = callBack;
}
Expand All @@ -107,9 +112,12 @@ public void executeAction() {
}

if (null != mAnimationBean.styles) {
mAnimationBean.styles.init(mAnimationBean.styles.transformOrigin,
mAnimationBean.styles.transform, (int) component.getLayoutWidth(), (int) component.getLayoutHeight(),
instance.getInstanceViewPortWidth(), instance);
if(styleNeedInit) {
mAnimationBean.styles.init(mAnimationBean.styles.transformOrigin,
mAnimationBean.styles.transform, (int) component.getLayoutWidth(),
(int) component.getLayoutHeight(),
instance.getInstanceViewPortWidth());
}
startAnimation(instance, component);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package com.taobao.weex.ui.action;

import com.taobao.weex.WXSDKInstance;
import com.taobao.weex.WXSDKManager;
import com.taobao.weex.ui.component.WXComponent;
import com.taobao.weex.ui.component.WXVContainer;
Expand Down Expand Up @@ -49,9 +48,5 @@ public void executeAction() {
if (!component.isVirtualComponent()) {
((WXVContainer) newParent).addSubView(component.getHostView(), mIndex);
}
WXSDKInstance instance = WXSDKManager.getInstance().getWXRenderManager().getWXSDKInstance(getPageId());
if (null!=instance){
instance.onElementChange();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@

public class GraphicActionRemoveElement extends BasicGraphicAction {

private boolean isJSCreateFinish = false;

public GraphicActionRemoveElement(String pageId, String ref) {
super(pageId, ref);
WXSDKInstance instance = WXSDKManager.getInstance().getWXRenderManager().getWXSDKInstance(getPageId());
if (null != instance){
isJSCreateFinish = instance.isJSCreateFinish;
}

}

@Override
Expand Down Expand Up @@ -55,7 +62,7 @@ private void clearRegistryForComponent(WXComponent component) {
}
WXSDKInstance instance = WXSDKManager.getInstance().getWXRenderManager().getWXSDKInstance(getPageId());
if (null!=instance){
instance.onElementChange();
instance.onElementChange(isJSCreateFinish);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
import com.taobao.weex.ui.animation.WXAnimationModule;
import com.taobao.weex.ui.component.basic.WXBasicComponent;
import com.taobao.weex.ui.component.binding.Statements;
import com.taobao.weex.ui.component.list.WXCell;
import com.taobao.weex.ui.component.list.template.jni.NativeRenderObjectUtils;
import com.taobao.weex.ui.component.pesudo.OnActivePseudoListner;
import com.taobao.weex.ui.component.pesudo.PesudoStatus;
Expand Down Expand Up @@ -929,7 +930,7 @@ public final void setLayout(WXComponent component) {
return;
}

if (realHeight >= WXPerformance.VIEW_LIMIT_HEIGHT && realWidth>=WXPerformance.VIEW_LIMIT_WIDTH){
if (this instanceof WXCell && realHeight >= WXPerformance.VIEW_LIMIT_HEIGHT && realWidth>=WXPerformance.VIEW_LIMIT_WIDTH){
mInstance.getWXPerformance().cellExceedNum++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,19 @@ public WXTimerModule() {
public void setTimeout(@IntRange(from = 1) int funcId, @FloatRange(from = 0) float delay) {
if(mWXSDKInstance != null) {
postOrHoldMessage(MODULE_TIMEOUT, funcId, (int) delay, WXUtils.parseInt(mWXSDKInstance.getInstanceId()));
WXSDKManager.getInstance().postOnUiThread(new Runnable() {
@Override
public void run() {
if (null != mWXSDKInstance){
mWXSDKInstance.getWXPerformance().timerInvokeCount++;
}
}
},0);
if (null != mWXSDKInstance.getWXPerformance()){
mWXSDKInstance.getWXPerformance().timerInvokeCount++;
}
}
}

@JSMethod(uiThread = false)
public void setInterval(@IntRange(from = 1) int funcId, @FloatRange(from = 0) float interval) {
if(mWXSDKInstance != null) {
postOrHoldMessage(MODULE_INTERVAL, funcId, (int) interval, WXUtils.parseInt(mWXSDKInstance.getInstanceId()));
WXSDKManager.getInstance().postOnUiThread(new Runnable() {
@Override
public void run() {
if (null != mWXSDKInstance){
mWXSDKInstance.getWXPerformance().timerInvokeCount++;
}
}
},0);
if (null != mWXSDKInstance.getWXPerformance()){
mWXSDKInstance.getWXPerformance().timerInvokeCount++;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/vue/include/base-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exports.getBaseURL = function (vm) {
}
nativeBase = 'http://' + host + '/' + vm.dir + '/build/';
}
var h5Base = './vue.html?page=./' + vm.dir + '/build/';
var h5Base = './index.html?page=./' + vm.dir + '/build/';
// in Native
var base = nativeBase;
if (typeof window === 'object') {
Expand Down
Loading

0 comments on commit 9927930

Please sign in to comment.