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 8586b60a34..320a23c3b3 100755 --- 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 @@ -443,12 +443,20 @@ public void bindData(WXComponent component){ component = this; } mCurrentRef = component.getDomObject().getRef(); - updateProperties(component.getDomObject().getStyles()); - updateProperties(component.getDomObject().getAttrs()); + updateStyle(component); + updateAttrs(component); updateExtra(component.getDomObject().getExtra()); } } + public void updateStyle(WXComponent component){ + updateProperties(component.getDomObject().getStyles()); + } + + public void updateAttrs(WXComponent component){ + updateProperties(component.getDomObject().getAttrs()); + } + public void refreshData(WXComponent component){ } @@ -621,6 +629,7 @@ protected MeasureOutput measure(int width, int height) { } + @Deprecated public void updateProperties(Map props) { if (props == null || mHost == null) { return; diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BaseBounceView.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BaseBounceView.java index 1809a78d02..c8a47a0d3c 100644 --- a/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BaseBounceView.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BaseBounceView.java @@ -304,21 +304,24 @@ public T getInnerView() { public void setHeaderView(WXComponent refresh) { setRefreshEnable(true); if (swipeLayout != null) { - if (swipeLayout.getHeaderView() != null) { - swipeLayout.setRefreshHeight((int) refresh.getDomObject().getLayoutHeight()); - - String colorStr = (String) refresh.getDomObject().getStyles().get(Constants.Name.BACKGROUND_COLOR); - String bgColor = WXUtils.getString(colorStr, null); - - if (bgColor != null) { - if (!TextUtils.isEmpty(bgColor)) { - int colorInt = WXResourceUtils.getColor(bgColor); - if (!(colorInt == Color.TRANSPARENT)) { - swipeLayout.setRefreshBgColor(colorInt); + WXRefreshView refreshView = swipeLayout.getHeaderView(); + if (refreshView != null) { + ImmutableDomObject immutableDomObject = refresh.getDomObject(); + if (immutableDomObject != null) { + int refreshHeight = (int) immutableDomObject.getLayoutHeight(); + swipeLayout.setRefreshHeight(refreshHeight); + String colorStr = (String) immutableDomObject.getStyles().get(Constants.Name.BACKGROUND_COLOR); + String bgColor = WXUtils.getString(colorStr, null); + if (bgColor != null) { + if (!TextUtils.isEmpty(bgColor)) { + int colorInt = WXResourceUtils.getColor(bgColor); + if (!(colorInt == Color.TRANSPARENT)) { + swipeLayout.setRefreshBgColor(colorInt); + } } } + refreshView.setRefreshView(refresh.getHostView()); } - swipeLayout.getHeaderView().setRefreshView(refresh.getHostView()); } } } @@ -330,22 +333,24 @@ public void setHeaderView(WXComponent refresh) { public void setFooterView(WXComponent loading) { setLoadmoreEnable(true); if (swipeLayout != null) { - ImmutableDomObject domObject; - if (swipeLayout.getFooterView() != null && (domObject = loading.getDomObject()) != null) { - swipeLayout.setLoadingHeight((int) domObject.getLayoutHeight()); - - String colorStr = (String) loading.getDomObject().getStyles().get(Constants.Name.BACKGROUND_COLOR); - String bgColor = WXUtils.getString(colorStr, null); - - if (bgColor != null) { - if (!TextUtils.isEmpty(bgColor)) { - int colorInt = WXResourceUtils.getColor(bgColor); - if (!(colorInt == Color.TRANSPARENT)) { - swipeLayout.setLoadingBgColor(colorInt); + WXRefreshView refreshView = swipeLayout.getFooterView(); + if (refreshView != null) { + ImmutableDomObject immutableDomObject = loading.getDomObject(); + if (immutableDomObject != null) { + int loadingHeight = (int) immutableDomObject.getLayoutHeight(); + swipeLayout.setLoadingHeight(loadingHeight); + String colorStr = (String) immutableDomObject.getStyles().get(Constants.Name.BACKGROUND_COLOR); + String bgColor = WXUtils.getString(colorStr, null); + if (bgColor != null) { + if (!TextUtils.isEmpty(bgColor)) { + int colorInt = WXResourceUtils.getColor(bgColor); + if (!(colorInt == Color.TRANSPARENT)) { + swipeLayout.setLoadingBgColor(colorInt); + } } } + refreshView.setRefreshView(loading.getHostView()); } - swipeLayout.getFooterView().setRefreshView(loading.getHostView()); } } }