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


Java RecyclerViewDragDropManager.setInitiateOnMove方法代码示例

本文整理汇总了Java中com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager.setInitiateOnMove方法的典型用法代码示例。如果您正苦于以下问题:Java RecyclerViewDragDropManager.setInitiateOnMove方法的具体用法?Java RecyclerViewDragDropManager.setInitiateOnMove怎么用?Java RecyclerViewDragDropManager.setInitiateOnMove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager的用法示例。


在下文中一共展示了RecyclerViewDragDropManager.setInitiateOnMove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onViewCreated

import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager; //导入方法依赖的package包/类
@Override
public void onViewCreated(View aView, @Nullable Bundle aSavedInstanceState) {
    super.onViewCreated(aView, aSavedInstanceState);

    mRecyclerView = (RecyclerView) aView.findViewById(R.id.recycler_view);

    mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
    mRecyclerViewDragDropManager.setInitiateOnLongPress(true);
    mRecyclerViewDragDropManager.setInitiateOnMove(false);

    mLayoutManager = new LinearLayoutManager(getContext());
    mRecyclerView.setLayoutManager(mLayoutManager);

    final DragOnLongPressAdapter myItemAdapter = new DragOnLongPressAdapter(
            ((MainActivity) getActivity()).getDataSet());
    mAdapter = myItemAdapter;
    mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(myItemAdapter);
    mRecyclerView.setAdapter(mWrappedAdapter);  // requires *wrapped* adapter
    mRecyclerView.addItemDecoration(
            new SimpleListDividerDecorator(ContextCompat.getDrawable(getContext(),
                    R.drawable.list_divider_h), true));
    mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
}
 
开发者ID:DenK91,项目名称:LinkedListInDB,代码行数:24,代码来源:DragOnLongPressFragment.java

示例2: onViewCreated

import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager; //导入方法依赖的package包/类
@Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        //noinspection ConstantConditions
        mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
        mLayoutManager = new LinearLayoutManager(getActivity());

        // drag & drop manager
        mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
        mRecyclerViewDragDropManager.setDraggingItemShadowDrawable(
                (NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z3));
        // Start dragging after long press
        mRecyclerViewDragDropManager.setInitiateOnLongPress(true);
        mRecyclerViewDragDropManager.setInitiateOnMove(false);

        //adapter
        final MyDraggableItemAdapter myItemAdapter = new MyDraggableItemAdapter(getDataProvider());
        mAdapter = myItemAdapter;

        mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(myItemAdapter);      // wrap for dragging

        final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();

        mRecyclerView.setLayoutManager(mLayoutManager);
        mRecyclerView.setAdapter(mWrappedAdapter);  // requires *wrapped* adapter
        mRecyclerView.setItemAnimator(animator);

        // additional decorations
        //noinspection StatementWithEmptyBody
        if (supportsViewElevation()) {
            // Lollipop or later has native drop shadow feature. ItemShadowDecorator is not required.
        } else {
            mRecyclerView.addItemDecoration(new ItemShadowDecorator((NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z1)));
        }
        mRecyclerView.addItemDecoration(new SimpleListDividerDecorator(getResources().getDrawable(R.drawable.list_divider), true));

        mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);

        // for debugging
//        animator.setDebug(true);
//        animator.setMoveDuration(2000);
    }
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:44,代码来源:RecyclerListViewFragment.java


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