/** Init Swipelayout */ private WXSwipeLayout createBounceView(Context context) { swipeLayout = new WXSwipeLayout(context); swipeLayout.setLayoutParams( new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); innerView = setInnerView(context); if (innerView == null) return null; swipeLayout.addView( innerView, new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); addView(swipeLayout, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); return swipeLayout; }
/** @param loading should be {@link WXRefreshView} */ public void setFooterView(WXComponent loading) { setLoadmoreEnable(true); if (swipeLayout != null) { if (swipeLayout.getFooterView() != null) { swipeLayout.setLoadingHeight((int) loading.getDomObject().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); } } } swipeLayout.getFooterView().setRefreshView(loading.getHostView()); } } }
public void setLoadmoreEnable(boolean enable) { if (swipeLayout != null) swipeLayout.setPullLoadEnable(enable); }
public void setRefreshEnable(boolean enable) { if (swipeLayout != null) swipeLayout.setPullRefreshEnable(enable); }
public void finishPullLoad() { if (swipeLayout != null) swipeLayout.finishPullLoad(); }
public void finishPullRefresh() { if (swipeLayout != null) swipeLayout.finishPullRefresh(); }
public void setOnLoadingListener(WXSwipeLayout.WXOnLoadingListener onLoadingListener) { if (swipeLayout != null) swipeLayout.setOnLoadingListener(onLoadingListener); }
public void setOnRefreshListener(WXSwipeLayout.WXOnRefreshListener onRefreshListener) { if (swipeLayout != null) swipeLayout.setOnRefreshListener(onRefreshListener); }