Java Code Examples for android.support.v7.widget.RecyclerView#getTag()

The following examples show how to use android.support.v7.widget.RecyclerView#getTag() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorkWorldDetailsAdapter.java    From imsdk-android with MIT License 6 votes vote down vote up
public void updateCommentItem(WorkWorldNewCommentBean workWorldNewCommentBean, int position) {
//        RecyclerView recyclerView = (RecyclerView) getViewByPosition(position+getHeaderLayoutCount(),R.id.child_comment_rc);
//       TextView textView = (TextView) getViewByPosition(position+getHeaderLayoutCount(),R.id.comment_item_text);
//       int a = linearLayoutManager.findFirstCompletelyVisibleItemPosition();
//        linearLayoutManager.findViewByPosition()
        try {
            TextView textView = linearLayoutManager.findViewByPosition(position + getHeaderLayoutCount()).findViewById(R.id.comment_item_text);
////
            RecyclerView recyclerView = linearLayoutManager.findViewByPosition(position + getHeaderLayoutCount()).findViewById(R.id.child_comment_rc);

//
            textView.setText(workWorldNewCommentBean.getContent());
            recyclerView.setVisibility(View.VISIBLE);
//       LinearLayoutManager linearLayoutManager = getl
            WorkWorldDetailsAdapter adapter = (WorkWorldDetailsAdapter) recyclerView.getTag();
            List<? extends MultiItemEntity> list = workWorldNewCommentBean.getNewChild();
            adapter.setNewData((List<MultiItemEntity>) list);
        } catch (Exception e) {
//            notifyItemInserted(position + getHeaderLayoutCount());
            notifyItemChanged(position + getHeaderLayoutCount());
            compatibilityDataSizeChanged(1);
//            addData(i,data);
//            notifyItemChanged(position);
        }

    }
 
Example 2
Source File: RecyclerViewAdapter.java    From MVVM-JueJin with MIT License 5 votes vote down vote up
/**
 * (伪)双向 databinding: 自动调用 {@link TwoWayListVM#getLoadTask()},
 *      并自动触发 {@link TwoWayListVM#setData(ObservableArrayList)}
 *      然后自动更新 RecyclerView
 *
 * @param container
 * @param vm
 * @param datas
 * @param <T>
 */
@BindingAdapter({"vm", "data"})
public static <T> void setDataTwoWay(final RecyclerView container, final ListVM<T> vm, List<T> datas){
    if(vm == null){
        return ;
    }
    setData(container, vm, datas);

    if(vm instanceof TwoWayListVM) {
        boolean isInited = container.getTag(R.id.db_inited) != null;
        if (!isInited) {
            container.setTag(R.id.db_inited, true);

            final TwoWayListVM<T> _vm = ((TwoWayListVM<T>) vm);

            loadData(container, _vm, null, null);
            // 若 parent 可下拉刷新,设置回调
            ViewParent parent = container.getParent();
            if (parent != null && parent instanceof TwoWayListVM.Refreshable) {
                final TwoWayListVM.Refreshable refreshable = (TwoWayListVM.Refreshable) parent;
                ((TwoWayListVM.Refreshable) parent).setOnRefresh(new TwoWayListVM.Refreshable.CallBack() {
                    @Override
                    public void onRefresh() {
                        loadData(container, _vm, null, refreshable);
                    }

                    @Override
                    public void onLoadMore() {
                        List<T> data = _vm.getData();
                        if (data.size() - 1 >= 0) {
                            loadData(container, _vm, data.get(data.size() - 1), refreshable);
                        }
                    }
                });
            }
        }
    }
}
 
Example 3
Source File: ItemClickSupport.java    From firebase-chat with MIT License 5 votes vote down vote up
public static ItemClickSupport addTo(RecyclerView view) {
    ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
    if (support == null) {
        support = new ItemClickSupport(view);
    }
    return support;
}
 
Example 4
Source File: ItemClickSupport.java    From MultiView with Apache License 2.0 5 votes vote down vote up
public static ItemClickSupport from(RecyclerView recyclerView) {
    if (recyclerView == null) {
        return null;
    }

    return (ItemClickSupport) recyclerView.getTag(io.apptik.multiview.extras.R.id.multiview_item_click_support);
}
 
Example 5
Source File: ItemClickSupport.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static ItemClickSupport from(RecyclerView recyclerView) {
    if (recyclerView == null) {
        return null;
    }

    return (ItemClickSupport) recyclerView.getTag(R.id.twowayview_item_click_support);
}
 
Example 6
Source File: ItemClickSupport.java    From FirebaseMessagingApp with GNU General Public License v3.0 5 votes vote down vote up
public static ItemClickSupport removeFrom(RecyclerView view) {
    ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
    if (support != null) {
        support.detach(view);
    }
    return support;
}
 
Example 7
Source File: ItemSelectionSupport.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static ItemSelectionSupport from(RecyclerView recyclerView) {
    if (recyclerView == null) {
        return null;
    }

    return (ItemSelectionSupport) recyclerView.getTag(R.id.twowayview_item_selection_support);
}
 
Example 8
Source File: ItemClickSupport.java    From conference-app with Apache License 2.0 5 votes vote down vote up
public static ItemClickSupport addTo(RecyclerView view) {
    ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
    if (support == null) {
        support = new ItemClickSupport(view);
    }
    return support;
}
 
Example 9
Source File: RecycleClick.java    From RecycleClick with Apache License 2.0 5 votes vote down vote up
public static RecycleClick addTo(RecyclerView view) {
    RecycleClick support = (RecycleClick) view.getTag(R.id.item_click_support);
    if (support == null) {
        support = new RecycleClick(view);
    }
    return support;
}
 
Example 10
Source File: ItemClickSupport.java    From ratebeer with GNU General Public License v3.0 5 votes vote down vote up
public static ItemClickSupport removeFrom(RecyclerView view) {
	ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
	if (support != null) {
		support.detach(view);
	}
	return support;
}
 
Example 11
Source File: RecyclerViewItemClickSupport.java    From Android-MVVMFramework with Apache License 2.0 5 votes vote down vote up
public static RecyclerViewItemClickSupport removeFrom(RecyclerView view) {
    RecyclerViewItemClickSupport support = (RecyclerViewItemClickSupport) view.getTag(R.id.item_click_support);
    if (support != null) {
        support.detach(view);
    }
    return support;
}
 
Example 12
Source File: ItemClickSupport.java    From android-auto-call-recorder with MIT License 5 votes vote down vote up
public static ItemClickSupport addTo(RecyclerView view) {
    ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
    if (support == null) {
        support = new ItemClickSupport(view);
    }
    return support;
}
 
Example 13
Source File: ItemClickSupport.java    From SABS with MIT License 5 votes vote down vote up
public static ItemClickSupport removeFrom(RecyclerView view) {
    ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
    if (support != null) {
        support.detach(view);
    }
    return support;
}
 
Example 14
Source File: ItemClickSupport.java    From Mover with Apache License 2.0 5 votes vote down vote up
public static ItemClickSupport from(RecyclerView recyclerView) {
    if (recyclerView == null) {
        return null;
    }

    return (ItemClickSupport) recyclerView.getTag(R.id.watchme_item_click_support);
}
 
Example 15
Source File: ItemClickSupport.java    From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 5 votes vote down vote up
public static ItemClickSupport removeFrom(RecyclerView view) {
    ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
    if (support != null) {
        support.detach(view);
    }
    return support;
}
 
Example 16
Source File: ItemSelectionSupport.java    From MultiView with Apache License 2.0 5 votes vote down vote up
public static ItemSelectionSupport from(RecyclerView recyclerView) {
    if (recyclerView == null) {
        return null;
    }

    return (ItemSelectionSupport) recyclerView.getTag(io.apptik.multiview.extras.R.id.multiview_item_selection_support);
}
 
Example 17
Source File: RecyclerViewItemClickSupport.java    From Android-MVVMFramework with Apache License 2.0 5 votes vote down vote up
public static RecyclerViewItemClickSupport addTo(RecyclerView view) {
    RecyclerViewItemClickSupport support = (RecyclerViewItemClickSupport) view.getTag(R.id.item_click_support);
    if (support == null) {
        support = new RecyclerViewItemClickSupport(view);
    }
    return support;
}
 
Example 18
Source File: ItemClickSupport.java    From notSABS with MIT License 5 votes vote down vote up
public static ItemClickSupport addTo(RecyclerView view) {
    ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
    if (support == null) {
        support = new ItemClickSupport(view);
    }
    return support;
}
 
Example 19
Source File: WorkWorldDetailsAdapter.java    From imsdk-android with MIT License 5 votes vote down vote up
public void deleteCommentItem(int position, WorkWorldDeleteResponse.CommentDeleteInfo data) {

        if (data.getDeleteType() == 1) {
            try {
                RecyclerView recyclerView = linearLayoutManager.findViewByPosition(position + getHeaderLayoutCount()).findViewById(R.id.child_comment_rc);
                WorkWorldDetailsAdapter adapter = (WorkWorldDetailsAdapter) recyclerView.getTag();
                for (int i = 0; i < adapter.getData().size(); i++) {
                    if (((WorkWorldChildCommentBean) adapter.getData().get(i)).getCommentUUID().equals(data.getCommentUUID())) {
                        adapter.remove(i);
                    }
                }

            } catch (Exception e) {
                notifyItemChanged(position + getHeaderLayoutCount());
                compatibilityDataSizeChanged(1);
            }
        } else {
            if (MessageStatus.isExistStatus(data.getSuperParentStatus(), WorkWorldItemState.commentShow)) {
                TextView textView = linearLayoutManager.findViewByPosition(position + getHeaderLayoutCount()).findViewById(R.id.comment_item_text);
                textView.setText("该评论已删除!");
////
            } else {
                remove(position);
            }
        }
//        if(MessageStatus.isExistStatus(data.getSuperParentStatus(),WorkWorldItemState.commentShow)){
//
//        }else{
//
//        }
    }
 
Example 20
Source File: ItemClickSupport.java    From android-auto-call-recorder with MIT License 5 votes vote down vote up
public static ItemClickSupport removeFrom(RecyclerView view) {
    ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
    if (support != null) {
        support.detach(view);
    }
    return support;
}