Search in sources :

Example 1 with MainWeexFragment

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

Example 2 with MainWeexFragment

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));
}
Also used : MainWeexFragment(com.eros.framework.fragment.MainWeexFragment)

Example 3 with MainWeexFragment

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();
}
Also used : MainWeexFragment(com.eros.framework.fragment.MainWeexFragment)

Example 4 with MainWeexFragment

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;
}
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)4 NavigatorModel (com.eros.framework.model.NavigatorModel)2 Bundle (android.os.Bundle)1 JSCallback (com.taobao.weex.bridge.JSCallback)1