[3/3] incubator-weex-site git commit: Correct English guide page some wrong links (#109)

2018-03-19 Thread hanks
Correct English guide page some wrong links (#109)


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-weex-site/commit/abbb4506
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/tree/abbb4506
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/diff/abbb4506

Branch: refs/heads/master
Commit: abbb4506062f1dc7b945f768eae74622d71916f5
Parents: 93d63a5 8515da0
Author: Hanks 
Authored: Tue Mar 20 12:41:13 2018 +0800
Committer: Hanks 
Committed: Tue Mar 20 12:41:13 2018 +0800

--
 source/guide/advanced/app-architecture.md | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)
--




incubator-weex git commit: [WEEX-253][android]WXScroller Handler should use mainLooper ensure main thread

2018-03-19 Thread misakuo
Repository: incubator-weex
Updated Branches:
  refs/heads/master 0547dbaf6 -> 770110118


[WEEX-253][android]WXScroller Handler should use mainLooper ensure main thread


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/77011011
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/77011011
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/77011011

Branch: refs/heads/master
Commit: 770110118b1059d1b81a89cebfc7f504c8344ce3
Parents: 0547dba
Author: jianbai.gbj 
Authored: Tue Mar 20 10:56:12 2018 +0800
Committer: misakuo 
Committed: Tue Mar 20 12:41:27 2018 +0800

--
 .../src/main/java/com/taobao/weex/ui/component/WXScroller.java| 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/77011011/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
--
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java 
b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
index 4e3561d..f21d33b 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
@@ -24,6 +24,7 @@ import android.graphics.Point;
 import android.graphics.Rect;
 import android.os.Build;
 import android.os.Handler;
+import android.os.Looper;
 import android.support.annotation.NonNull;
 import android.text.TextUtils;
 import android.view.View;
@@ -107,7 +108,7 @@ public class WXScroller extends WXVContainer 
implements WXScrollViewL
   private int mContentHeight = 0;
 
   private WXStickyHelper stickyHelper;
-  private Handler handler=new Handler();
+  private Handler handler=new Handler(Looper.getMainLooper());
 
   private boolean isScrollable = true;
 



[2/3] incubator-weex-site git commit: Correct English guide page some wrong links

2018-03-19 Thread hanks
Correct English guide page some wrong links

Correct English guide page some wrong links and add some helpful links.

Project: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-weex-site/commit/8515da09
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/tree/8515da09
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/diff/8515da09

Branch: refs/heads/master
Commit: 8515da0997019e58cce43c63b5af51ffe06ea9ef
Parents: b92ac3c
Author: shikechen <806335...@qq.com>
Authored: Mon Mar 19 12:36:00 2018 +0800
Committer: GitHub 
Committed: Mon Mar 19 12:36:00 2018 +0800

--
 source/guide/advanced/app-architecture.md | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/8515da09/source/guide/advanced/app-architecture.md
--
diff --git a/source/guide/advanced/app-architecture.md 
b/source/guide/advanced/app-architecture.md
index d800974..135a7a8 100644
--- a/source/guide/advanced/app-architecture.md
+++ b/source/guide/advanced/app-architecture.md
@@ -58,5 +58,7 @@ If the feature of WeexSDK is limited to your mobile app. You 
can extend your own
 
 **Links**
 
-* [Extend to iOS](../../references/advanced/extend-to-ios.html)
-* [Extend to Android](../../references/advanced/extend-to-android.html)
+* [Extend iOS](../extend-ios.html)
+* [Extend Android](../extend-android.html)
+* [Extend Web Renderer](../extend-web-render.html)
+* [Extend JS framework](../extend-js-framework.html)



[1/3] incubator-weex-site git commit: Correct some wrong links

2018-03-19 Thread hanks
Repository: incubator-weex-site
Updated Branches:
  refs/heads/master b92ac3c6f -> abbb45060


Correct some wrong links

Correct some wrong links and add some helpful links.

Project: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-weex-site/commit/93d63a54
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/tree/93d63a54
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/diff/93d63a54

Branch: refs/heads/master
Commit: 93d63a545330dc0aa1f8919911a94b9c0f658c98
Parents: b92ac3c
Author: shikechen <806335...@qq.com>
Authored: Mon Mar 19 12:20:40 2018 +0800
Committer: GitHub 
Committed: Mon Mar 19 12:20:40 2018 +0800

--
 source/cn/guide/advanced/app-architecture.md | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/93d63a54/source/cn/guide/advanced/app-architecture.md
--
diff --git a/source/cn/guide/advanced/app-architecture.md 
b/source/cn/guide/advanced/app-architecture.md
index b3ed1dc..14711dc 100644
--- a/source/cn/guide/advanced/app-architecture.md
+++ b/source/cn/guide/advanced/app-architecture.md
@@ -58,5 +58,7 @@ version: 2.1
 
 **相关链接**
 
-* [如何扩展 iOS](../../references/advanced/extend-to-ios.html)
-* [如何扩展 Android](../../references/advanced/extend-to-android.html)
+* [如何扩展 iOS](../extend-ios.html)
+* [如何扩展 Android](../extend-android.html)
+* [如何扩展 HTML5](../extend-web-render.html)
+* [如何扩展前端框架](../extend-js-framework.html)



[2/2] incubator-weex git commit: [WEEX-244][android]Weex Android Support W3c Force Api

2018-03-19 Thread misakuo
[WEEX-244][android]Weex Android Support W3c Force 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/d7a12fd2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d7a12fd2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d7a12fd2

Branch: refs/heads/master
Commit: d7a12fd24002863ae1cf4b9dc00163cf411a27cc
Parents: bdd6c2e
Author: jianbai.gbj 
Authored: Fri Mar 9 11:19:47 2018 +0800
Committer: misakuo 
Committed: Tue Mar 20 12:40:31 2018 +0800

--
 .../main/java/com/taobao/weex/ui/view/gesture/WXGesture.java  | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d7a12fd2/android/sdk/src/main/java/com/taobao/weex/ui/view/gesture/WXGesture.java
--
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/ui/view/gesture/WXGesture.java 
b/android/sdk/src/main/java/com/taobao/weex/ui/view/gesture/WXGesture.java
index 1bac140..3335d9e 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/gesture/WXGesture.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/gesture/WXGesture.java
@@ -383,7 +383,12 @@ public class WXGesture extends 
GestureDetector.SimpleOnGestureListener implement
   pageXY = getEventLocInPageCoordinate(motionEvent, pointerIndex, pos);
   screenXY = getEventLocInScreenCoordinate(motionEvent, pointerIndex, pos);
 }
-return createJSONObject(screenXY, pageXY, (float) 
motionEvent.getPointerId(pointerIndex));
+JSONObject map = createJSONObject(screenXY, pageXY, (float) 
motionEvent.getPointerId(pointerIndex));
+float force = motionEvent.getPressure();
+if(force > 0 && force < 1) {
+  map.put("force", motionEvent.getPressure());
+}
+return map;
   }
 
   /**



[1/2] incubator-weex git commit: [WEEX-244][android]Weex Android Support W3c Force Api & wson improve for JSONField

2018-03-19 Thread misakuo
Repository: incubator-weex
Updated Branches:
  refs/heads/master bdd6c2e6b -> 0547dbaf6


[WEEX-244][android]Weex Android Support W3c Force Api & wson improve for 
JSONField


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/0547dbaf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/0547dbaf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/0547dbaf

Branch: refs/heads/master
Commit: 0547dbaf62f8f29a71a87915d8eacfcfd50008ef
Parents: d7a12fd
Author: jianbai.gbj 
Authored: Fri Mar 9 16:23:44 2018 +0800
Committer: misakuo 
Committed: Tue Mar 20 12:40:31 2018 +0800

--
 .../main/java/com/taobao/weex/wson/Wson.java| 29 +-
 .../java/com/taobao/weex/wson/AnnoTest.java | 41 
 .../test/java/com/taobao/weex/wson/Person.java  | 30 ++
 3 files changed, 98 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0547dbaf/android/sdk/src/main/java/com/taobao/weex/wson/Wson.java
--
diff --git a/android/sdk/src/main/java/com/taobao/weex/wson/Wson.java 
b/android/sdk/src/main/java/com/taobao/weex/wson/Wson.java
index 5741f8a..85d740f 100644
--- a/android/sdk/src/main/java/com/taobao/weex/wson/Wson.java
+++ b/android/sdk/src/main/java/com/taobao/weex/wson/Wson.java
@@ -24,6 +24,7 @@ import android.support.v4.util.LruCache;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.annotation.JSONField;
 import com.taobao.weex.utils.WXLogUtils;
 
 import java.lang.reflect.Array;
@@ -499,7 +500,7 @@ public class Wson {
 if(object.getClass().isEnum()){
 writeObject(JSON.toJSONString(object));
 }else{
-writeMap(toMap(object));
+writeAdapterObject(object);
 }
 refs.remove(refs.size()-1);
 }
@@ -600,6 +601,19 @@ public class Wson {
 position++;
 }
 
+private final void writeAdapterObject(Object object){
+if(specialClass.get(object.getClass().getName()) != null){
+writeObject(JSON.toJSON(object));
+return;
+}
+try{
+writeMap(toMap(object));
+}catch (Exception e){
+specialClass.put(object.getClass().getName(), true);
+writeObject(JSON.toJSON(object));
+}
+}
+
 private  final Map  toMap(Object object){
 Map map = new JSONObject();
 try {
@@ -637,7 +651,11 @@ public class Wson {
 map.put(fieldName, value);
 }
 }catch (Exception e){
-throw  new RuntimeException(e);
+if(e instanceof  RuntimeException){
+throw  (RuntimeException)e;
+}else{
+throw  new RuntimeException(e);
+}
 }
 return  map;
 }
@@ -749,6 +767,7 @@ public class Wson {
 private static final String METHOD_PREFIX_IS = "is";
 private static LruCache methodsCache = new 
LruCache<>(128);
 private static LruCache fieldsCache = new 
LruCache<>(128);
+private static LruCache specialClass = new LruCache<>(16);
 
 
 private static final List getBeanMethod(String key, Class 
targetClass){
@@ -766,6 +785,9 @@ public class Wson {
 String methodName = method.getName();
 if(methodName.startsWith(METHOD_PREFIX_GET)
 || methodName.startsWith(METHOD_PREFIX_IS)) {
+if(method.getAnnotation(JSONField.class) != null){
+throw new UnsupportedOperationException("getBeanMethod 
JSONField Annotation Not Handled, Use toJSON");
+}
 methods.add(method);
 }
 }
@@ -785,6 +807,9 @@ public class Wson {
 if((field.getModifiers() & Modifier.STATIC) != 0){
 continue;
 }
+if(field.getAnnotation(JSONField.class) != null){
+throw new UnsupportedOperationException("getBeanMethod 
JSONField Annotation Not Handled, Use toJSON");
+}
 fieldList.add(field);
 }
 fieldsCache.put(key, fieldList);

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0547dbaf/android/sdk/src/test/java/com/taobao/weex/wson/AnnoTest.java

incubator-weex git commit: [WEEX-230][android] Weex Input Value Filter By Diff Update

2018-03-19 Thread misakuo
Repository: incubator-weex
Updated Branches:
  refs/heads/master dd2e5e8f9 -> bdd6c2e6b


[WEEX-230][android] Weex Input Value Filter By Diff Update


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/bdd6c2e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/bdd6c2e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/bdd6c2e6

Branch: refs/heads/master
Commit: bdd6c2e6b9da106bd16ec93a6cf7a4bc948fef35
Parents: dd2e5e8
Author: jianbai.gbj 
Authored: Tue Mar 6 17:01:00 2018 +0800
Committer: misakuo 
Committed: Tue Mar 20 12:39:16 2018 +0800

--
 android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/bdd6c2e6/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 397be0c..5e8b5bb 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
@@ -828,6 +828,7 @@ public class WXDomObject extends CSSNode implements 
Cloneable,ImmutableDomObject
 if(updates == null){
   return  false;
 }
+/**
 Set> entries = updates.entrySet();
 Iterator> it = entries.iterator();
 while (it.hasNext()){
@@ -844,7 +845,7 @@ public class WXDomObject extends CSSNode implements 
Cloneable,ImmutableDomObject
 it.remove();
 continue;
   }
-}
+}*/
 return updates.size() > 0;
   }
 



[GitHub] incubator-weex issue #1058: [WEEX-233] [android] More enhanced about c...

2018-03-19 Thread misakuo
Github user misakuo commented on the issue:

https://github.com/apache/incubator-weex/pull/1058
  
This pull request has been merged, please close it manually 🤝 
@TheKingOfGods 


---


[2/3] incubator-weex git commit: + [android] support call reload、goForward、goBack、postMessage methods by component

2018-03-19 Thread misakuo
+ [android] support call reload、goForward、goBack、postMessage methods by 
 component


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/c542c2c4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/c542c2c4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/c542c2c4

Branch: refs/heads/master
Commit: c542c2c49c4622b5b613c9b0ea24e6e32a464c1d
Parents: fbaffef
Author: 南麓 
Authored: Thu Mar 8 16:03:42 2018 +0800
Committer: misakuo 
Committed: Tue Mar 20 12:36:08 2018 +0800

--
 .../com/taobao/weex/ui/component/WXWeb.java | 43 ++
 .../java/com/taobao/weex/ui/view/IWebView.java  |  6 +-
 .../java/com/taobao/weex/ui/view/WXWebView.java | 89 ++--
 3 files changed, 75 insertions(+), 63 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c542c2c4/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java
--
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java 
b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java
index 81c649a..ae910d0 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java
@@ -28,6 +28,7 @@ import com.taobao.weex.WXSDKInstance;
 import com.taobao.weex.WXSDKManager;
 import com.taobao.weex.annotation.Component;
 import com.taobao.weex.adapter.URIAdapter;
+import com.taobao.weex.annotation.JSMethod;
 import com.taobao.weex.common.Constants;
 import com.taobao.weex.dom.WXDomObject;
 import com.taobao.weex.ui.view.IWebView;
@@ -56,8 +57,20 @@ public class WXWeb extends WXComponent {
 createWebView();
 }
 
-protected void  createWebView(){
-mWebView = new WXWebView(getContext());
+protected void createWebView(){
+String origin = null;
+try {
+String bundleUrl = 
WXSDKManager.getInstance().getSDKInstance(getInstanceId()).getBundleUrl();
+Uri uri = Uri.parse(bundleUrl);
+String scheme = uri.getScheme();
+String authority = uri.getAuthority();
+if (!TextUtils.isEmpty(scheme) && !TextUtils.isEmpty(authority)) {
+origin = scheme + "://" + authority;
+}
+} catch (Exception e) {
+// do noting
+}
+mWebView = new WXWebView(getContext(), origin);
 }
 
 @Override
@@ -100,9 +113,7 @@ public class WXWeb extends WXComponent {
 });
 mWebView.setOnMessageListener(new IWebView.OnMessageListener() {
 @Override
-public void onMessage(Object msg) {
-Map params = new HashMap<>();
-params.put("data", msg);
+public void onMessage(Map params) {
 fireEvent(Constants.Event.ONMESSAGE, params);
 }
 });
@@ -187,30 +198,26 @@ public class WXWeb extends WXComponent {
 }
 
 private void loadDataWithBaseURL(String source) {
-String baseUrl = null;
-try {
-String bundleUrl = 
WXSDKManager.getInstance().getSDKInstance(getInstanceId()).getBundleUrl();
-Uri uri = Uri.parse(bundleUrl);
-baseUrl = uri.getScheme() + "://" + uri.getAuthority();
-} catch (Exception e) {
-// do noting
-}
-getWebView().loadDataWithBaseURL(source, baseUrl);
+getWebView().loadDataWithBaseURL(source);
 }
 
-private void reload() {
+@JSMethod
+public void reload() {
 getWebView().reload();
 }
 
-private void goForward() {
+@JSMethod
+public void goForward() {
 getWebView().goForward();
 }
 
-private void goBack() {
+@JSMethod
+public void goBack() {
 getWebView().goBack();
 }
 
-private void postMessage(Object msg) {
+@JSMethod
+public void postMessage(Object msg) {
 getWebView().postMessage(msg);
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c542c2c4/android/sdk/src/main/java/com/taobao/weex/ui/view/IWebView.java
--
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/IWebView.java 
b/android/sdk/src/main/java/com/taobao/weex/ui/view/IWebView.java
index 5b0d332..e38c3ca 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/IWebView.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/IWebView.java
@@ -20,11 +20,13 @@ package com.taobao.weex.ui.view;
 
 import android.view.View;
 
+import java.util.Map;
+
 public interface IWebView {
 public View getView();
 public 

[1/3] incubator-weex git commit: + [android] update test case about component

2018-03-19 Thread misakuo
Repository: incubator-weex
Updated Branches:
  refs/heads/master 4a3b952f4 -> dd2e5e8f9


+ [android] update test case about  component


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/dd2e5e8f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/dd2e5e8f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/dd2e5e8f

Branch: refs/heads/master
Commit: dd2e5e8f95a8135c1485052fa8cf14bb60359503
Parents: c542c2c
Author: 南麓 
Authored: Fri Mar 9 11:32:00 2018 +0800
Committer: misakuo 
Committed: Tue Mar 20 12:36:08 2018 +0800

--
 .../com/taobao/weex/ui/component/WXWebTest.java | 33 ++--
 .../com/taobao/weex/ui/view/WXWebViewTest.java  | 20 +++-
 2 files changed, 49 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dd2e5e8f/android/sdk/src/test/java/com/taobao/weex/ui/component/WXWebTest.java
--
diff --git 
a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXWebTest.java 
b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXWebTest.java
index a582ac0..56b0b72 100644
--- a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXWebTest.java
+++ b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXWebTest.java
@@ -34,6 +34,8 @@ import org.robolectric.RobolectricTestRunner;
 import org.robolectric.annotation.Config;
 
 import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
 
 import static org.junit.Assert.*;
 
@@ -56,6 +58,7 @@ public class WXWebTest {
 IWebView mIWebView;
 OnPageListener mOnPageListener;
 OnErrorListener mOnErrorListener;
+OnMessageListener mOnMessageListener;
 
 ProxyWebView(IWebView proxy){
   mIWebView = proxy;
@@ -77,6 +80,11 @@ public class WXWebTest {
 }
 
 @Override
+public void loadDataWithBaseURL(String source) {
+  mIWebView.loadDataWithBaseURL(source);
+}
+
+@Override
 public void reload() {
   mIWebView.reload();
 }
@@ -92,6 +100,9 @@ public class WXWebTest {
 }
 
 @Override
+public void postMessage(Object msg) {}
+
+@Override
 public void setShowLoading(boolean shown) {
   mIWebView.setShowLoading(shown);
 }
@@ -107,6 +118,12 @@ public class WXWebTest {
   mIWebView.setOnPageListener(listener);
   mOnPageListener = listener;
 }
+
+@Override
+public void setOnMessageListener(OnMessageListener listener) {
+  mIWebView.setOnMessageListener(listener);
+  mOnMessageListener = listener;
+}
   }
 
   @Before
@@ -127,24 +144,34 @@ public class WXWebTest {
   public void testSetProperty() throws Exception {
 component.setProperty(Constants.Name.SHOW_LOADING,true);
 component.setProperty(Constants.Name.SRC,"http://taobao.com;);
+component.setProperty(Constants.Name.SOURCE, "hello 
weex");
   }
 
   @Test
   public void testSetAction() throws Exception {
-component.setAction(WXWeb.GO_BACK);
-component.setAction(WXWeb.GO_FORWARD);
-component.setAction(WXWeb.RELOAD);
+Map msg = new HashMap<>();
+msg.put("test1", 1);
+msg.put("test2", "2");
+component.setAction(WXWeb.GO_BACK, null);
+component.setAction(WXWeb.GO_FORWARD, null);
+component.setAction(WXWeb.RELOAD, null);
+component.setAction(WXWeb.POST_MESSAGE, msg);
   }
 
   @Test
   public void testListener() throws Exception {
+Map msg = new HashMap<>();
+msg.put("test1", 1);
+msg.put("test2", "2");
 component.addEvent(Constants.Event.RECEIVEDTITLE);
 component.addEvent(Constants.Event.PAGESTART);
 component.addEvent(Constants.Event.PAGEFINISH);
 component.addEvent(Constants.Event.ERROR);
+component.addEvent(Constants.Event.ONMESSAGE);
 mWebView.mOnPageListener.onPageFinish("http://taobao.com",true,true);
 mWebView.mOnPageListener.onReceivedTitle("test");
 mWebView.mOnPageListener.onPageStart("http://taobao.com;);
 mWebView.mOnErrorListener.onError("test","error occurred");
+mWebView.mOnMessageListener.onMessage(msg);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dd2e5e8f/android/sdk/src/test/java/com/taobao/weex/ui/view/WXWebViewTest.java
--
diff --git 
a/android/sdk/src/test/java/com/taobao/weex/ui/view/WXWebViewTest.java 
b/android/sdk/src/test/java/com/taobao/weex/ui/view/WXWebViewTest.java
index fe1913c..7b8b5cd 100644
--- a/android/sdk/src/test/java/com/taobao/weex/ui/view/WXWebViewTest.java
+++ b/android/sdk/src/test/java/com/taobao/weex/ui/view/WXWebViewTest.java
@@ -38,6 +38,9 @@ import 

[3/3] incubator-weex git commit: + [android] support communication between weex and web

2018-03-19 Thread misakuo
+ [android] support communication between weex and web


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/fbaffef2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/fbaffef2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/fbaffef2

Branch: refs/heads/master
Commit: fbaffef2e304448761a494451f505cf2c6c04bc9
Parents: 4a3b952
Author: 南麓 
Authored: Wed Mar 7 19:09:53 2018 +0800
Committer: misakuo 
Committed: Tue Mar 20 12:36:08 2018 +0800

--
 .../java/com/taobao/weex/common/Constants.java  |   6 +-
 .../com/taobao/weex/ui/component/WXWeb.java |  42 +-
 .../taobao/weex/ui/module/WXWebViewModule.java  |  21 ++-
 .../java/com/taobao/weex/ui/view/IWebView.java  |   7 +
 .../java/com/taobao/weex/ui/view/WXWebView.java | 138 ++-
 5 files changed, 201 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/fbaffef2/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
--
diff --git a/android/sdk/src/main/java/com/taobao/weex/common/Constants.java 
b/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
index a994663..4873f1f 100644
--- a/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
+++ b/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
@@ -108,6 +108,7 @@ public class Constants {
 String FILTER = "filter";
 String QUALITY = "quality";
 String SRC = "src";
+String SOURCE = "source";
 String PLACE_HOLDER = "placeHolder";
 String RESIZE_MODE = "resizeMode";
 String AUTO_RECYCLE = "autoBitmapRecycle";
@@ -326,11 +327,8 @@ public class Constants {
   String DESTORY = "destroy";
 }
 
-
 String STOP_PROPAGATION = "stopPropagation";
-
-
-
+String ONMESSAGE = "message";
   }
 
   public interface PSEUDO {

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/fbaffef2/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java
--
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java 
b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java
index d2fe72b..81c649a 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java
@@ -25,6 +25,7 @@ import android.text.TextUtils;
 import android.view.View;
 
 import com.taobao.weex.WXSDKInstance;
+import com.taobao.weex.WXSDKManager;
 import com.taobao.weex.annotation.Component;
 import com.taobao.weex.adapter.URIAdapter;
 import com.taobao.weex.common.Constants;
@@ -42,6 +43,7 @@ public class WXWeb extends WXComponent {
 public static final String GO_BACK = "goBack";
 public static final String GO_FORWARD = "goForward";
 public static final String RELOAD = "reload";
+public static final String POST_MESSAGE = "postMessage";
 protected IWebView mWebView;
 
 @Deprecated
@@ -96,6 +98,14 @@ public class WXWeb extends WXComponent {
 }
 }
 });
+mWebView.setOnMessageListener(new IWebView.OnMessageListener() {
+@Override
+public void onMessage(Object msg) {
+Map params = new HashMap<>();
+params.put("data", msg);
+fireEvent(Constants.Event.ONMESSAGE, params);
+}
+});
 return mWebView.getView();
 }
 
@@ -118,6 +128,11 @@ public class WXWeb extends WXComponent {
 if (src != null)
 setUrl(src);
 return true;
+case Constants.Name.SOURCE:
+String source = WXUtils.getString(param,null);
+if (source != null)
+setSource(source);
+return true;
 }
 return super.setProperty(key,param);
 }
@@ -137,7 +152,14 @@ public class WXWeb extends WXComponent {
 }
 }
 
-public void setAction(String action) {
+@WXComponentProp(name = Constants.Name.SOURCE)
+public void setSource(String source) {
+if (!TextUtils.isEmpty(source) && getHostView() != null) {
+loadDataWithBaseURL(source);
+}
+}
+
+public void setAction(String action, Object data) {
 if (!TextUtils.isEmpty(action)) {
 if (action.equals(GO_BACK)) {
 goBack();
@@ -145,6 +167,8 @@ public class WXWeb extends WXComponent {
 goForward();
 } else if (action.equals(RELOAD)) {
 reload();
+} else if (action.equals(POST_MESSAGE)) {
+

[GitHub] incubator-weex pull request #1074: [WEEX-253][android]WXScroller Handler sho...

2018-03-19 Thread gubaojian
GitHub user gubaojian reopened a pull request:

https://github.com/apache/incubator-weex/pull/1074

[WEEX-253][android]WXScroller Handler should use mainLooper ensure main 
thread

[WEEX-253][android]WXScroller Handler should use mainLooper ensure main 
thread

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/gubaojian/incubator-weex release-0.18-scroller

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-weex/pull/1074.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1074


commit 8e6299d37750a54bf88d33f7cfefe108febae666
Author: jianbai.gbj 
Date:   2018-03-20T02:56:12Z

[WEEX-253][android]WXScroller Handler should use mainLooper ensure main 
thread




---


[GitHub] incubator-weex issue #1074: [WEEX-253][android]WXScroller Handler should use...

2018-03-19 Thread weex-bot
Github user weex-bot commented on the issue:

https://github.com/apache/incubator-weex/pull/1074
  





  

  
  Warnings

  
  
  :warning:
  No Changelog changes!

  




  

  
  Messages

  
  
  :book:
  danger test finished.

  




  Generated by :no_entry_sign: http://github.com/danger/danger-js/;>dangerJS




---


[GitHub] incubator-weex pull request #1074: [WEEX-253][android]WXScroller Handler sho...

2018-03-19 Thread gubaojian
GitHub user gubaojian opened a pull request:

https://github.com/apache/incubator-weex/pull/1074

[WEEX-253][android]WXScroller Handler should use mainLooper ensure main 
thread

[WEEX-253][android]WXScroller Handler should use mainLooper ensure main 
thread

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/gubaojian/incubator-weex release-0.18-scroller

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-weex/pull/1074.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1074


commit 8e6299d37750a54bf88d33f7cfefe108febae666
Author: jianbai.gbj 
Date:   2018-03-20T02:56:12Z

[WEEX-253][android]WXScroller Handler should use mainLooper ensure main 
thread




---