RModelAdapter.java 文件源码

java
阅读 45 收藏 0 点赞 0 评论 0

项目:RLibrary 作者:
/**
 * 在执行 {@link #onUnSelectorPosition(RBaseViewHolder, int, boolean)}后, 调用此方法, 可以便捷的取消 CompoundButton 的状态
 */
public void unSelector(@NonNull List<Integer> list, @NonNull RRecyclerView recyclerView, @IdRes int viewId) {
    boolean notify = false;

    for (Integer pos : list) {
        removeSelectorPosition(pos);
        RBaseViewHolder vh = (RBaseViewHolder) recyclerView.findViewHolderForAdapterPosition(pos);
        if (vh != null) {
            final View view = vh.v(viewId);
            if (view != null) {
                if (view instanceof CompoundButton) {
                    checkedButton((CompoundButton) view, false);
                } else if (view instanceof RCheckGroup.ICheckView) {
                    ((RCheckGroup.ICheckView) view).setChecked(false);
                }
                notify = true;
            }
        } else {
            notifyItemChanged(pos);
        }
    }

    if (notify) {
        //防止在视图还没有加载的时候,通知事件
        notifySelectorChange();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号