当前位置: 首页>>代码示例>>Java>>正文


Java OnItemChildClickListener类代码示例

本文整理汇总了Java中com.chad.library.adapter.base.listener.OnItemChildClickListener的典型用法代码示例。如果您正苦于以下问题:Java OnItemChildClickListener类的具体用法?Java OnItemChildClickListener怎么用?Java OnItemChildClickListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OnItemChildClickListener类属于com.chad.library.adapter.base.listener包,在下文中一共展示了OnItemChildClickListener类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initAdapter

import com.chad.library.adapter.base.listener.OnItemChildClickListener; //导入依赖的package包/类
private void initAdapter() {
    mAdapter = new WorksAdapter(mContext);
    //设置上滑自动建在的正在加载更多的自定义View
    View loadMoreView = LayoutInflater.from(mContext).inflate(R.layout.custom_loadmore_view, mRecyclerView, false);
    mAdapter.setLoadingView(loadMoreView);

    //当当前position等于PAGE_SIZE 时,就回调用onLoadMoreRequested() 自动加载下一页数据
    mAdapter.openLoadMore(PAGESIZE);
    mAdapter.openLoadAnimation();
    mAdapter.setOnLoadMoreListener(this);

    mRecyclerView.addOnItemTouchListener(new OnItemChildClickListener() {
        @Override
        public void SimpleOnItemChildClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
            ImageDetailActivity.launch(getActivity(),
                    (ImageView) view.findViewById(R.id.card_works_img),
                    mAdapter.getItem(i).getFile().getKey());
        }
    });
}
 
开发者ID:Glooory,项目名称:Calligraphy,代码行数:21,代码来源:WorksFragment.java

示例2: initAdapter

import com.chad.library.adapter.base.listener.OnItemChildClickListener; //导入依赖的package包/类
private void initAdapter() {
    mAdapter = new ITHomeAdapter(mContext);

    //正在加载的footer
    View loadingFooter = LayoutInflater.from(mContext).inflate(R.layout.view_loading_footer, mRecyclerView, false);
    mAdapter.setLoadingView(loadingFooter);
    mAdapter.setOnLoadMoreListener(this);

    mRecyclerView.addOnItemTouchListener(new OnItemChildClickListener() {
        @Override
        public void SimpleOnItemChildClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
            if (!GreenDaoUtils.isEntityExists(mITHomeDao, ITHomeItemBeanDao.Properties.Newsid.eq(mAdapter.getItem(i).getNewsid()))) {
                ((TextView) view.findViewById(R.id.tv_ithome_item_title))
                        .setTextColor(getResources().getColor(R.color.colorSecondaryText));
                GreenDaoUtils.insert(mITHomeDao, mAdapter.getItem(i), ITHomeItemBeanDao.Properties.IdPrimary);
            }
            ITContentActivity.launch(getActivity(), mAdapter.getItem(i));
        }
    });
}
 
开发者ID:Glooory,项目名称:FlatReader,代码行数:21,代码来源:ITHomeFragment.java

示例3: initAdapter

import com.chad.library.adapter.base.listener.OnItemChildClickListener; //导入依赖的package包/类
private void initAdapter() {
    mAdapter = new RibaoSectionAdapter(mContext);

    //正在加载的footer
    View loadingFooter = LayoutInflater.from(mContext).inflate(R.layout.view_loading_footer, mRecyclerView, false);
    mAdapter.setLoadingView(loadingFooter);

    mRecyclerView.addOnItemTouchListener(new OnItemChildClickListener() {
        @Override
        public void SimpleOnItemChildClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
            if (!GreenDaoUtils.isEntityExists(mRibaoDao,
                    RibaoStoryBeanDao.Properties.Id.eq(((RibaoStoryBean) mAdapter.getItem(i)).getId()))) {
                ((TextView) view.findViewById(R.id.tv_ribao_item_title))
                        .setTextColor(getResources().getColor(R.color.colorSecondaryText));
                GreenDaoUtils.insert(mRibaoDao, mAdapter.getItem(i), RibaoStoryBeanDao.Properties.IdPrimary);
            }
            StoryDetailActivity.launch(getActivity(),
                    String.valueOf(((RibaoStoryBean) mAdapter.getItem(i)).getId()),
                    (ImageView) view.findViewById(R.id.img_card_ribao_item));
        }
    });
}
 
开发者ID:Glooory,项目名称:FlatReader,代码行数:23,代码来源:RibaoFragment.java

示例4: onListener

import com.chad.library.adapter.base.listener.OnItemChildClickListener; //导入依赖的package包/类
@Override
    protected void onListener() {
        super.onListener();
        rvComments.addOnItemTouchListener(new OnItemChildClickListener() {

            @Override
            public void SimpleOnItemChildClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
                switch (view.getId()) {
                    case R.id.btnReply:
                        List<MultiItemEntity> res = baseQuickAdapter.getData();
                        CommentFill commentFill = (CommentFill) res.get(i);
                        Comment comment = commentFill.getComment();
                        clickReply(comment.getUser(), comment);
                        break;
                    case R.id.imgHead:
//                        ToastUtil.getInstance().showLongT("点击头像,跳转用户信息界面");
                        break;
                    case R.id.tvReplyUser:
                        if (!(baseQuickAdapter.getData().get(i) instanceof ReplyFill)) {
                            break;
                        }
                        ReplyFill replyFill = (ReplyFill) baseQuickAdapter.getData().get(i);
                        Reply reply = replyFill.getReply();
                        clickReply(reply.getSpeakUser(), reply.getComment());
                        break;
                    case R.id.tvReplyWho:
                        if (!(baseQuickAdapter.getData().get(i) instanceof ReplyFill)) {
                            break;
                        }
                        ReplyFill replyFillWho = (ReplyFill) baseQuickAdapter.getData().get(i);
                        Reply replyWho = replyFillWho.getReply();
                        clickReply(replyWho.getReplyUser(), replyWho.getComment());
                        break;
                }
            }
        });
    }
 
开发者ID:weimin96,项目名称:shareNote,代码行数:38,代码来源:ReadArticleActivity.java

示例5: onListener

import com.chad.library.adapter.base.listener.OnItemChildClickListener; //导入依赖的package包/类
@Override
protected void onListener() {
    super.onListener();
    mainBottomRecycler.addOnItemTouchListener(new OnItemChildClickListener() {
        @Override
        public void SimpleOnItemChildClick(BaseQuickAdapter adapter, View view, int i) {
            switch (view.getId()) {
                case R.id.btnLike:
                    if (DataFiller.getLocalUser().getObjectId().equals(user.getObjectId())) {
                        Post post = (Post) adapter.getData().get(i);
                        presenter.requestLike(post);
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                onRefresh();
                            }
                        },20);
                    }
                    break;
                case R.id.layoutBaseArticle:
                    saveData(Config.data.KEY_POST, adapter.getData().get(i));
                    startActivity(new Intent(CollectActivity.this, ReadArticleActivity.class));
                    break;
            }
        }
    });
}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:28,代码来源:CollectActivity.java

示例6: onListener

import com.chad.library.adapter.base.listener.OnItemChildClickListener; //导入依赖的package包/类
@Override
protected void onListener() {
    super.onListener();
    mainBottomRecycler.addOnItemTouchListener(new OnItemChildClickListener() {
        @Override
        public void SimpleOnItemChildClick(BaseQuickAdapter adapter, View view, int i) {
            switch (view.getId()){
                case R.id.btnLike:
                    if (DataFiller.getLocalUser().getObjectId().equals(user.getObjectId())) {
                        Post post = (Post) adapter.getData().get(i);
                        presenter.requestDeletePost(post);
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                onRefresh();
                            }
                        },20);

                    }
                    break;
                case R.id.layoutBaseArticle:
                    BaseMainFragment.saveData(Config.data.KEY_POST, adapter.getData().get(i));
                    startActivity(new Intent(ReleaseActivity.this, ReadArticleActivity.class));
                    break;
            }
        }
    });
}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:29,代码来源:ReleaseActivity.java

示例7: onListener

import com.chad.library.adapter.base.listener.OnItemChildClickListener; //导入依赖的package包/类
@Override
    protected void onListener() {
        super.onListener();
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                clickBack();
            }
        });
        rvComments.addOnItemTouchListener(new OnItemChildClickListener() {

            @Override
            public void SimpleOnItemChildClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
                switch (view.getId()) {
                    case R.id.btnReply:
                        List<MultiItemEntity> res = baseQuickAdapter.getData();
                        CommentFill commentFill = (CommentFill) res.get(i);
                        Comment comment = commentFill.getComment();
                        clickReply(comment.getUser(), comment);
                        break;
                    case R.id.imgHead:
                        ToastUtil.getInstance().showLongT("点击头像,跳转用户信息界面");
                        break;
                    case R.id.tvReplyUser:
                        if (!(baseQuickAdapter.getData().get(i) instanceof ReplyFill)) {
                            break;
                        }
                        ReplyFill replyFill = (ReplyFill) baseQuickAdapter.getData().get(i);
                        Reply reply = replyFill.getReply();
                        clickReply(reply.getSpeakUser(), reply.getComment());
//                        clickReply(reply.getSpeakUser(), comment);
                        break;
                    case R.id.tvReplyWho:
                        if (!(baseQuickAdapter.getData().get(i) instanceof ReplyFill)) {
                            break;
                        }
                        ReplyFill replyFillWho = (ReplyFill) baseQuickAdapter.getData().get(i);
                        Reply replyWho = replyFillWho.getReply();
                        clickReply(replyWho.getReplyUser(), replyWho.getComment());
                        break;
                }
            }
        });
    }
 
开发者ID:xujiaji,项目名称:HaiNaBaiChuan,代码行数:45,代码来源:ReadArticleFragment.java

示例8: onViewCreated

import com.chad.library.adapter.base.listener.OnItemChildClickListener; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    ButterKnife.bind(this, view);

    mAdapter = new CommentAdapter();
    if (PreferenceHelper.getInstance().inAnimationMode()) {
        mAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_BOTTOM);
    }

    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
    mRecyclerView.addOnItemTouchListener(new OnItemChildClickListener() {
        @Override
        public void onSimpleItemChildClick(BaseQuickAdapter adapter, View v, int position) {
            if (!mPresenter.isCommentEnable()) {
                return;
            }

            Comment c = mAdapter.get(position);
            switch (v.getId()) {
                case R.id.support:
                    mPresenter.support(c);
                    break;
                case R.id.against:
                    mPresenter.against(c);
                    break;
                case R.id.reply:
                    mPresenter.replyComment(c);
                    break;
            }
        }
    });

    mSwipeRefreshLayout.setColorSchemeColors(
            ResourcesCompat.getColor(getResources(), R.color.colorAccent, getContext().getTheme()));
    mSwipeRefreshLayout.setOnRefreshListener(this);
    showNoCommentTipsIfNeed();

    mPresenter = new CommentPresenter(getArguments().getInt(KEY_SID));
    mPresenter.subscribe(this);
    if (mTmpSN != null && mTmpTokenForReadComment != null) {
        handleSetupMessage(mTmpSN, mTmpTokenForReadComment);
        mTmpSN = null;
        mTmpTokenForReadComment = null;
    }
}
 
开发者ID:ChaosLeong,项目名称:FxcnBeta,代码行数:49,代码来源:CommentFragment.java


注:本文中的com.chad.library.adapter.base.listener.OnItemChildClickListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。