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 07:57:35 UTC
[2/4] incubator-weex git commit: * [android] fix shadow remains after
component size changed
* [android] fix shadow remains after component size changed
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/d5731c2c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d5731c2c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d5731c2c
Branch: refs/heads/release-0.16
Commit: d5731c2caceb94f6b7cd942ae50683b38846d3c1
Parents: e777ac8
Author: misakuo <mi...@apache.org>
Authored: Wed Oct 11 18:10:48 2017 +0800
Committer: misakuo <mi...@apache.org>
Committed: Wed Oct 11 18:10:48 2017 +0800
----------------------------------------------------------------------
.../taobao/weex/ui/component/WXComponent.java | 29 ++++++++++++++++----
1 file changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d5731c2c/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 74e4db4..3c0c870 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
@@ -509,6 +509,8 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi
setWidgetParams(widget, UIImp, rawOffset, realWidth, realHeight, realLeft, realRight, realTop,
realBottom);
} else if (mHost != null) {
+ // clear box shadow before host's size changed
+ clearBoxShadow();
if (mDomObj.isFixed()) {
setFixedHostLayoutParams(mHost, realWidth, realHeight, realLeft, realRight, realTop,
realBottom);
@@ -520,6 +522,8 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi
mPreRealLeft = realLeft;
mPreRealTop = realTop;
onFinishLayout();
+ // restore box shadow
+ updateBoxShadow();
}
}
@@ -859,6 +863,15 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi
return;
}
+ View target = mHost;
+ if (this instanceof WXVContainer) {
+ target = ((WXVContainer) this).getBoxShadowHost();
+ }
+
+ if (target == null) {
+ return;
+ }
+
float[] radii = new float[] {0, 0, 0, 0, 0, 0, 0, 0};
WXStyle style = getDomObject().getStyles();
if (style != null) {
@@ -886,17 +899,23 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi
}
}
- View target = mHost;
- if (this instanceof WXVContainer) {
- target = ((WXVContainer) this).getBoxShadowHost();
- }
-
BoxShadowUtil.setBoxShadow(target, boxShadow.toString(), radii, getInstance().getInstanceViewPortWidth());
} else {
WXLogUtils.w("Can not resolve styles");
}
}
+ protected void clearBoxShadow() {
+ View target = mHost;
+ if (this instanceof WXVContainer) {
+ target = ((WXVContainer) this).getBoxShadowHost();
+ }
+
+ if (target != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
+ target.getOverlay().clear();
+ }
+ }
+
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
protected void setAriaHidden(boolean isHidden) {
View host = getHostView();