Search in sources :

Example 1 with NavigatorModel

use of com.eros.framework.model.NavigatorModel 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);
}
Also used : MainWeexFragment(com.eros.framework.fragment.MainWeexFragment) Bundle(android.os.Bundle) NavigatorModel(com.eros.framework.model.NavigatorModel)

Example 2 with NavigatorModel

use of com.eros.framework.model.NavigatorModel 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;
}
Also used : MainWeexFragment(com.eros.framework.fragment.MainWeexFragment) NavigatorModel(com.eros.framework.model.NavigatorModel) JSCallback(com.taobao.weex.bridge.JSCallback)

Aggregations

MainWeexFragment (com.eros.framework.fragment.MainWeexFragment)2 NavigatorModel (com.eros.framework.model.NavigatorModel)2 Bundle (android.os.Bundle)1 JSCallback (com.taobao.weex.bridge.JSCallback)1