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/18 11:59:53 UTC

[1/2] incubator-weex git commit: * [android] fix crash when set box-shadow on horizontal scroller

Repository: incubator-weex
Updated Branches:
  refs/heads/release-0.16 fc7b90e3e -> 54719936f


* [android] fix crash when set box-shadow on horizontal scroller


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

Branch: refs/heads/release-0.16
Commit: 7f6203c9b6a4c398cce6584cd9da1689bb14e5ba
Parents: 61ead2a
Author: misakuo <mi...@apache.org>
Authored: Wed Oct 18 19:44:50 2017 +0800
Committer: misakuo <mi...@apache.org>
Committed: Wed Oct 18 19:44:50 2017 +0800

----------------------------------------------------------------------
 .../taobao/weex/ui/component/WXVContainer.java  | 35 +++++++++++++++-----
 1 file changed, 26 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7f6203c9/android/sdk/src/main/java/com/taobao/weex/ui/component/WXVContainer.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXVContainer.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXVContainer.java
index 4570729..001509e 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXVContainer.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXVContainer.java
@@ -25,10 +25,13 @@ import android.util.Pair;
 import android.view.Menu;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.HorizontalScrollView;
+import android.widget.ScrollView;
 
 import com.taobao.weex.WXSDKInstance;
 import com.taobao.weex.common.Constants;
 import com.taobao.weex.dom.WXDomObject;
+import com.taobao.weex.utils.WXLogUtils;
 import com.taobao.weex.utils.WXViewUtils;
 
 import java.util.ArrayList;
@@ -481,15 +484,29 @@ public abstract class WXVContainer<T extends ViewGroup> extends WXComponent<T> {
    ********************************************************/
 
   public @Nullable View getBoxShadowHost() {
-    if (mBoxShadowHost == null) {
-      mBoxShadowHost = new BoxShadowHost(getContext());
-      WXViewUtils.setBackGround(mBoxShadowHost, null);
-      mBoxShadowHost.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
-      getHostView().addView(mBoxShadowHost);
-    }
-    getHostView().removeView(mBoxShadowHost);
-    getHostView().addView(mBoxShadowHost);
-    return mBoxShadowHost;
+    ViewGroup hostView = getHostView();
+    if (hostView == null) {
+      return null;
+    }
+
+    if (hostView instanceof ScrollView || hostView instanceof HorizontalScrollView) {
+      return hostView;
+    }
+
+    try {
+      if (mBoxShadowHost == null) {
+        mBoxShadowHost = new BoxShadowHost(getContext());
+        WXViewUtils.setBackGround(mBoxShadowHost, null);
+        mBoxShadowHost.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+        hostView.addView(mBoxShadowHost);
+      }
+      hostView.removeView(mBoxShadowHost);
+      hostView.addView(mBoxShadowHost);
+      return mBoxShadowHost;
+    } catch (Throwable t) {
+      WXLogUtils.w("BoxShadow", t);
+    }
+    return hostView;
   }
 
   private class BoxShadowHost extends View {


[2/2] incubator-weex git commit: * [android] fix crash when set box-shadow on horizontal scroller

Posted by gu...@apache.org.
* [android] fix crash when set box-shadow on horizontal scroller


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

Branch: refs/heads/release-0.16
Commit: 54719936fa4f14d4a9680130489e7d71f347680e
Parents: fc7b90e 7f6203c
Author: gurisxie <27...@qq.com>
Authored: Wed Oct 18 19:59:49 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Wed Oct 18 19:59:49 2017 +0800

----------------------------------------------------------------------
 .../taobao/weex/ui/component/WXVContainer.java  | 35 +++++++++++++++-----
 1 file changed, 26 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/54719936/android/sdk/src/main/java/com/taobao/weex/ui/component/WXVContainer.java
----------------------------------------------------------------------