use of com.eros.framework.fragment.MainWeexFragment in project WeexErosFramework by bmfe.
the class TableView method initFragment.
/**
* 初始化 Fragment
*/
private void initFragment(PlatformConfigBean.TabItem item, int index) {
MainWeexFragment fragment = new MainWeexFragment();
Bundle bundle = new Bundle();
bundle.putString(MainWeexFragment.PAGE_URL, item.getPagePath());
fragment.setArguments(bundle);
fragments.add(fragment);
NavigatorModel model = new NavigatorModel();
model.navigatorModel = getNavStr(item);
navigatorArray.append(index, model);
}
use of com.eros.framework.fragment.MainWeexFragment in project WeexErosFramework by bmfe.
the class TableView method setCurrentItem.
/**
* ViewPager 滑动时 动态切换底部按钮的 文字颜色和 图片
*
* @param index
*/
private void setCurrentItem(int index) {
for (int i = 0; i < llTabBar.getChildCount(); i++) {
TableItemView itemView = (TableItemView) llTabBar.getChildAt(i);
itemView.setSelector(index);
}
MainWeexFragment fragment = fragments.get(index);
fragment.setNavigator(navigatorArray.get(index));
}
use of com.eros.framework.fragment.MainWeexFragment in project WeexErosFramework by bmfe.
the class TableView method refresh.
public void refresh() {
MainWeexFragment fragment = fragments.get(viewpager.getCurrentItem());
fragment.refresh();
}
use of com.eros.framework.fragment.MainWeexFragment in project WeexErosFramework by bmfe.
the class TableView method setNaigation.
/**
* 接通 navigator ,前端可以直接 使用 navigator 设置到 fragment
*
* @param weexEventBean 参数对象
* @return
*/
public boolean setNaigation(WeexEventBean weexEventBean) {
String params = weexEventBean.getJsParams();
JSCallback jsCallback = weexEventBean.getJscallback();
String type = weexEventBean.getKey();
int currentIndex = viewpager.getCurrentItem();
for (int i = 0; i < fragments.size(); i++) {
MainWeexFragment fragment = fragments.get(i);
if (fragment.getWxInstanseHasCode() == (int) weexEventBean.getExpand()) {
NavigatorModel navigatorModel = navigatorArray.get(i);
switch(type) {
case // setNavigationInfo
WXEventCenter.EVENT_NAVIGATIONINFO:
navigatorModel.navigatorModel = params;
if (currentIndex == i) {
DefaultNavigationAdapter.setNavigationInfo(params, jsCallback);
}
break;
case // setLeftItem
WXEventCenter.EVENT_LEFTITEM:
navigatorModel.leftNavigatorbarModel = params;
navigatorModel.leftItemJsCallback = jsCallback;
if (currentIndex == i) {
DefaultNavigationAdapter.setLeftItem(params, jsCallback);
}
break;
case // setRightItem
WXEventCenter.EVENT_RIGHTITEM:
navigatorModel.rightNavigatorbarModel = params;
navigatorModel.rightItemJsCallback = jsCallback;
if (currentIndex == i) {
DefaultNavigationAdapter.setRightItem(params, jsCallback);
}
break;
case // setCenterItem
WXEventCenter.EVENT_CENTERITEM:
navigatorModel.centerNavigatorBarModel = params;
navigatorModel.centerItemJsCallback = jsCallback;
if (currentIndex == i) {
DefaultNavigationAdapter.setCenterItem(params, jsCallback);
}
break;
}
if (currentIndex == i) {
DefaultNavigationAdapter.setTabbarNavigation(activity, navigatorModel);
}
}
}
return true;
}
Aggregations