Skip to content

Commit

Permalink
Merge branch 'android-bugfix-NPE' of http://github.com/zshshr/incubat…
Browse files Browse the repository at this point in the history
…or-weex into 0.11-dev

This closes alibaba#31
  • Loading branch information
sospartan committed Mar 6, 2017
2 parents 3621001 + 040f4b8 commit 33ba60a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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){

}
Expand Down Expand Up @@ -621,6 +629,7 @@ protected MeasureOutput measure(int width, int height) {
}


@Deprecated
public void updateProperties(Map<String, Object> props) {
if (props == null || mHost == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
Expand All @@ -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());
}
}
}
Expand Down

0 comments on commit 33ba60a

Please sign in to comment.