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

The following examples show how to use android.support.v7.widget.RecyclerView#setTag() . 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: ItemClickSupport.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static ItemClickSupport addTo(RecyclerView recyclerView) {
    ItemClickSupport itemClickSupport = from(recyclerView);
    if (itemClickSupport == null) {
        itemClickSupport = new ItemClickSupport(recyclerView);
        recyclerView.setTag(R.id.twowayview_item_click_support, itemClickSupport);
    } else {
        // TODO: Log warning
    }

    return itemClickSupport;
}
 
Example 2
Source File: ItemSelectionSupport.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static ItemSelectionSupport addTo(RecyclerView recyclerView) {
    ItemSelectionSupport itemSelectionSupport = from(recyclerView);
    if (itemSelectionSupport == null) {
        itemSelectionSupport = new ItemSelectionSupport(recyclerView);
        recyclerView.setTag(R.id.twowayview_item_selection_support, itemSelectionSupport);
    } else {
        // TODO: Log warning
    }

    return itemSelectionSupport;
}
 
Example 3
Source File: ItemClickSupport.java    From MultiView with Apache License 2.0 5 votes vote down vote up
public static void removeFrom(RecyclerView recyclerView) {
    final ItemClickSupport itemClickSupport = from(recyclerView);
    if (itemClickSupport == null) {
        // TODO: Log warning
        return;
    }

    recyclerView.removeOnItemTouchListener(itemClickSupport.mTouchListener);
    recyclerView.setTag(io.apptik.multiview.extras.R.id.multiview_item_click_support, null);
}
 
Example 4
Source File: ItemClickSupport.java    From MultiView with Apache License 2.0 5 votes vote down vote up
public static ItemClickSupport addTo(RecyclerView recyclerView) {
    ItemClickSupport itemClickSupport = from(recyclerView);
    if (itemClickSupport == null) {
        itemClickSupport = new ItemClickSupport(recyclerView);
        recyclerView.setTag(io.apptik.multiview.extras.R.id.multiview_item_click_support, itemClickSupport);
    } else {
        // TODO: Log warning
    }

    return itemClickSupport;
}
 
Example 5
Source File: RecyclerViewBindings.java    From android-data-binding-recyclerview with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@BindingAdapter("longClickHandler")
public static <T> void setHandler(RecyclerView recyclerView, LongClickHandler<T> handler)
{
    BindingRecyclerViewAdapter<T> adapter = (BindingRecyclerViewAdapter<T>) recyclerView.getAdapter();
    if (adapter != null)
    {
        adapter.setLongClickHandler(handler);
    }
    else
    {
        recyclerView.setTag(KEY_LONG_CLICK_HANDLER, handler);
    }
}
 
Example 6
Source File: RecyclerViewBindings.java    From android-data-binding-recyclerview with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@BindingAdapter("clickHandler")
public static <T> void setHandler(RecyclerView recyclerView, ClickHandler<T> handler)
{
    BindingRecyclerViewAdapter<T> adapter = (BindingRecyclerViewAdapter<T>) recyclerView.getAdapter();
    if (adapter != null)
    {
        adapter.setClickHandler(handler);
    }
    else
    {
        recyclerView.setTag(KEY_CLICK_HANDLER, handler);
    }
}
 
Example 7
Source File: ItemClickSupport.java    From Mover with Apache License 2.0 5 votes vote down vote up
public static ItemClickSupport addTo(RecyclerView recyclerView) {
    ItemClickSupport itemClickSupport = from(recyclerView);
    if (itemClickSupport == null) {
        itemClickSupport = new ItemClickSupport(recyclerView);
        recyclerView.setTag(R.id.watchme_item_click_support, itemClickSupport);
    } else {
        // TODO: Log warning
    }

    return itemClickSupport;
}
 
Example 8
Source File: ItemClickSupport.java    From Mover with Apache License 2.0 5 votes vote down vote up
public static void removeFrom(RecyclerView recyclerView) {
    final ItemClickSupport itemClickSupport = from(recyclerView);
    if (itemClickSupport == null) {
        // TODO: Log warning
        return;
    }

    recyclerView.removeOnItemTouchListener(itemClickSupport.mTouchListener);
    recyclerView.setTag(R.id.watchme_item_click_support, null);
}
 
Example 9
Source File: ItemClickSupport.java    From PlayWidget with MIT License 5 votes vote down vote up
public static ItemClickSupport addTo(RecyclerView recyclerView) {
    ItemClickSupport itemClickSupport = from(recyclerView);
    if (itemClickSupport == null) {
        itemClickSupport = new ItemClickSupport(recyclerView);
        recyclerView.setTag(R.id.twowayview_item_click_support, itemClickSupport);
    }

    return itemClickSupport;
}
 
Example 10
Source File: ItemClickSupport.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static void removeFrom(RecyclerView recyclerView) {
    final ItemClickSupport itemClickSupport = from(recyclerView);
    if (itemClickSupport == null) {
        // TODO: Log warning
        return;
    }

    recyclerView.removeOnItemTouchListener(itemClickSupport.mTouchListener);
    recyclerView.setTag(R.id.twowayview_item_click_support, null);
}
 
Example 11
Source File: ItemSelectionSupport.java    From MultiView with Apache License 2.0 5 votes vote down vote up
public static void removeFrom(RecyclerView recyclerView) {
    final ItemSelectionSupport itemSelection = from(recyclerView);
    if (itemSelection == null) {
        // TODO: Log warning
        return;
    }

    itemSelection.clearChoices();

    recyclerView.removeOnItemTouchListener(itemSelection.mTouchListener);
    recyclerView.setTag(io.apptik.multiview.extras.R.id.multiview_item_selection_support, null);
}
 
Example 12
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 13
Source File: ItemClickSupport.java    From android-auto-call-recorder with MIT License 4 votes vote down vote up
private void detach(RecyclerView view) {
    view.removeOnChildAttachStateChangeListener(mAttachListener);
    view.setTag(R.id.item_click_support, null);
}
 
Example 14
Source File: ItemClickSupport.java    From firebase-chat with MIT License 4 votes vote down vote up
private void detach(RecyclerView view) {
    view.removeOnChildAttachStateChangeListener(mAttachListener);
    view.setTag(R.id.item_click_support, null);
}
 
Example 15
Source File: ItemClickSupport.java    From FirebaseMessagingApp with GNU General Public License v3.0 4 votes vote down vote up
private void detach(RecyclerView view) {
    view.removeOnChildAttachStateChangeListener(mAttachListener);
    view.setTag(R.id.item_click_support, null);
}
 
Example 16
Source File: RecyclerViewItemClickSupport.java    From Android-MVVMFramework with Apache License 2.0 4 votes vote down vote up
private void detach(RecyclerView view) {
    view.removeOnChildAttachStateChangeListener(mAttachListener);
    view.setTag(R.id.item_click_support, null);
}
 
Example 17
Source File: ItemClickSupport.java    From conference-app with Apache License 2.0 4 votes vote down vote up
private void detach(RecyclerView view) {
    view.removeOnChildAttachStateChangeListener(mAttachListener);
    view.setTag(R.id.item_click_support, null);
}
 
Example 18
Source File: ItemClickSupport.java    From SABS with MIT License 4 votes vote down vote up
private void detach(RecyclerView view) {
    view.removeOnChildAttachStateChangeListener(mAttachListener);
    view.setTag(R.id.item_click_support, null);
}
 
Example 19
Source File: ItemClickSupport.java    From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 4 votes vote down vote up
private void detach(RecyclerView view) {
    view.removeOnChildAttachStateChangeListener(mAttachListener);
    view.setTag(R.id.item_click_support, null);
}
 
Example 20
Source File: ItemClickSupport.java    From notSABS with MIT License 4 votes vote down vote up
private void detach(RecyclerView view) {
    view.removeOnChildAttachStateChangeListener(mAttachListener);
    view.setTag(R.id.item_click_support, null);
}