Search in sources :

Example 1 with HierachyClassifyDetailAdapter

use of com.knight.wanandroid.module_hierachy.module_adapter.HierachyClassifyDetailAdapter in project wanandroid by KnightAndroid.

the class HierachyRightFragment method initView.

@Override
protected void initView(Bundle savedInstanceState) {
    isNavigate = getArguments().getBoolean("isNavigate");
    mDatabind.hierachyRightRv.addOnScrollListener(new RecyclerViewListener());
    mManager = new FlexboxLayoutManager(getActivity());
    mManager.setFlexDirection(FlexDirection.ROW);
    // 左对齐
    mManager.setJustifyContent(JustifyContent.FLEX_START);
    mManager.setAlignItems(AlignItems.CENTER);
    mDatabind.hierachyRightRv.setLayoutManager(mManager);
    mHierachyClassifyDetailAdapter = new HierachyClassifyDetailAdapter(getActivity(), mDatas, new RvListener() {

        @Override
        public void onItemClick(int id, int position) {
            if (id == R.id.hierachy_root) {
                if (!isNavigate) {
                    ARouter.getInstance().build(RoutePathActivity.Hierachy.HierachyTab).withStringArrayList("childrenNames", mDatas.get(position).getChildrenName()).withIntegerArrayList("cids", mDatas.get(position).getCid()).withString("titleName", mDatas.get(position).getTitleName()).navigation();
                }
            } else if (id == R.id.hierachy_tv_content) {
                if (isNavigate) {
                    ARouterUtils.startWeb(mDatas.get(position).getLink(), mDatas.get(position).getName(), mDatas.get(position).getId(), mDatas.get(position).isCollect(), "", "", mDatas.get(position).getName(), mDatas.get(position).getName());
                } else {
                    ARouter.getInstance().build(RoutePathActivity.Hierachy.HierachyDetail).withInt("cid", mDatas.get(position).getId()).withString("titleName", mDatas.get(position).getName()).navigation();
                }
            }
        }
    });
}
Also used : RvListener(com.knight.wanandroid.module_hierachy.module_listener.RvListener) FlexboxLayoutManager(com.google.android.flexbox.FlexboxLayoutManager) HierachyClassifyDetailAdapter(com.knight.wanandroid.module_hierachy.module_adapter.HierachyClassifyDetailAdapter)

Aggregations

FlexboxLayoutManager (com.google.android.flexbox.FlexboxLayoutManager)1 HierachyClassifyDetailAdapter (com.knight.wanandroid.module_hierachy.module_adapter.HierachyClassifyDetailAdapter)1 RvListener (com.knight.wanandroid.module_hierachy.module_listener.RvListener)1