use of vip.kuaifan.weiui.ui.component.tabbar.entity.TabbarEntity in project weiui by kuaifan.
the class Tabbar method addPageView.
/**
* 添加页面
* @param barBean
*/
private void addPageView(TabbarBean barBean) {
View view = ((Activity) getContext()).getLayoutInflater().inflate(R.layout.layout_weiui_tabbar_page, null);
SwipeRefreshLayout v_swipeRefresh = view.findViewById(R.id.v_swipeRefresh);
FrameLayout v_container = view.findViewById(R.id.v_container);
ProgressBar v_progress = view.findViewById(R.id.v_progress);
//
WXSDKBean sdkBean = new WXSDKBean();
sdkBean.setSwipeRefresh(v_swipeRefresh);
sdkBean.setContainer(v_container);
sdkBean.setProgress(v_progress);
sdkBean.setView(barBean.getView());
if (barBean.getView() instanceof String) {
sdkBean.setType("urlView");
WXSDKList.put(barBean.getTabName(), sdkBean);
addWXSDKView(barBean.getTabName());
} else if (barBean.getView() instanceof TabbarPageView) {
sdkBean.setType("pageView");
WXSDKList.put(barBean.getTabName(), sdkBean);
addWXPageView(barBean.getTabName());
}
//
if (getDomObject().getEvents().contains(weiuiConstants.Event.REFRESH_LISTENER)) {
sdkBean.getSwipeRefresh().setColorSchemeResources(android.R.color.holo_blue_light, android.R.color.holo_red_light, android.R.color.holo_orange_light, android.R.color.holo_green_light);
sdkBean.getSwipeRefresh().setOnRefreshListener(() -> {
Map<String, Object> data = new HashMap<>();
data.put("tabName", barBean.getTabName());
data.put("position", getTabPosition(barBean.getTabName()));
fireEvent(weiuiConstants.Event.REFRESH_LISTENER, data);
});
sdkBean.setSwipeRefreshEnable(true);
} else {
sdkBean.setSwipeRefreshEnable(false);
sdkBean.getSwipeRefresh().setEnabled(false);
}
//
mTabEntity.add(new TabbarEntity(barBean));
mViewList.add(view);
mTabPagerAdapter.setListViews(mViewList);
mTabPagerAdapter.notifyDataSetChanged();
}
Aggregations