• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SimpleListDividerDecorator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



SimpleListDividerDecorator类属于com.h6ah4i.android.widget.advrecyclerview.decoration包,在下文中一共展示了SimpleListDividerDecorator类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onViewCreated

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的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.decoration.SimpleListDividerDecorator; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    mRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.refreshLayout);
    mRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.theme_0), getResources().getColor(R.color.theme_1), getResources().getColor(R.color.theme_2), getResources().getColor(R.color.theme_3));
    mRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            getOtherTask();
        }
    });


    mRecylerView = (RecyclerView) getView().findViewById(R.id.recylerView);
    mLayoutManager = new LinearLayoutManager(context);
    mRecylerView.setLayoutManager(mLayoutManager);
    adapter = new OtherTaskAdapter(context, list);
    mRecylerView.setAdapter(adapter);

    mRecylerView.addItemDecoration(new SimpleListDividerDecorator(createRectShape(8, PixelUtil.dp2px(8), Color.TRANSPARENT), false));
    getOtherTask();
}
 
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:24,代码来源:OtherTaskFragment.java


示例3: onCreateView

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    recyclerView = (RecyclerView) inflater.inflate(R.layout.vertical_recycler_view, null);

    dController = DatabaseController.getInstance(getActivity());
    ilias = IliasController.getInstance(getActivity());

    List<FileObject> list = new ArrayList<>();
    list = Session.getSynchronisationFiles();

    final Parcelable expandableItemManagerSavedState = (savedInstanceState != null) ? savedInstanceState.getParcelable(SAVED_STATE_EXPANDABLE_ITEM_MANAGER) : null;
    mRecyclerViewExpandableItemManager = new RecyclerViewExpandableItemManager(expandableItemManagerSavedState);

    adapter = new CourseRecyclerAdapter(getActivity()/*, ExpandableCourse.createCourses(list)*/, this, mRecyclerViewExpandableItemManager);

    mWrappedAdapter = mRecyclerViewExpandableItemManager.createWrappedAdapter(adapter);

    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(mWrappedAdapter);
    recyclerView.addItemDecoration(new SimpleListDividerDecorator(getResources().getDrawable(R.drawable.list_divider), true));
    recyclerView.setItemAnimator(new RefactoredDefaultItemAnimator());
    recyclerView.setHasFixedSize(false);

    mRecyclerViewExpandableItemManager.attachRecyclerView(recyclerView);

    connector = new DataProviderAdapterConnector(StaticSortedCourseDataProvider.getInstance(), mRecyclerViewExpandableItemManager, adapter);

    return recyclerView;
}
 
开发者ID:fi3te,项目名称:ILIASDownloaderAndroid,代码行数:30,代码来源:CurrentSyncFragment.java


示例4: onViewCreated

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的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));

        //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,代码行数:41,代码来源:RecyclerListViewFragment.java


示例5: onViewCreated

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的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));

        //adapter
        final MyDraggableWithSectionItemAdapter myItemAdapter = new MyDraggableWithSectionItemAdapter(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,代码行数:41,代码来源:RecyclerListViewFragment.java


示例6: onViewCreated

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的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());

    final Parcelable eimSavedState = (savedInstanceState != null) ? savedInstanceState.getParcelable(SAVED_STATE_EXPANDABLE_ITEM_MANAGER) : null;
    mRecyclerViewExpandableItemManager = new RecyclerViewExpandableItemManager(eimSavedState);

    //adapter
    final MyAddRemoveExpandableItemAdapter myItemAdapter = new MyAddRemoveExpandableItemAdapter(mRecyclerViewExpandableItemManager, getDataProvider());

    mAdapter = myItemAdapter;

    mWrappedAdapter = mRecyclerViewExpandableItemManager.createWrappedAdapter(myItemAdapter);       // wrap for expanding

    final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();

    // Change animations are enabled by default since support-v7-recyclerview v22.
    // Need to disable them when using animation indicator.
    animator.setSupportsChangeAnimations(false);

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

    // 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));

    mRecyclerViewExpandableItemManager.attachRecyclerView(mRecyclerView);
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:41,代码来源:RecyclerListViewFragment.java


示例7: onCreate

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    RecyclerView rv = (RecyclerView) findViewById(R.id.recycler_view);
    RecyclerViewSwipeManager swipeMgr = new RecyclerViewSwipeManager();

    rv.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));

    rv.setAdapter(swipeMgr.createWrappedAdapter(new Adapter()));

    rv.setItemAnimator(new SwipeDismissItemAnimator());

    swipeMgr.attachRecyclerView(rv);

    rv.addItemDecoration(new SimpleListDividerDecorator(ContextCompat.getDrawable(this, R.drawable.list_divider), true));
}
 
开发者ID:h6ah4i,项目名称:RecyclerViewiOSMailAppLikeSwipe,代码行数:19,代码来源:MainActivity.java


示例8: onCreate

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    //获取RecycleView,创建LayoutManager
    mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    mLayoutManager = new LinearLayoutManager(this);

    // touch guard manager 阻止当Swipe时列表滚动
    mRecyclerViewTouchActionGuardManager = new RecyclerViewTouchActionGuardManager();
    mRecyclerViewTouchActionGuardManager.setInterceptVerticalScrollingWhileAnimationRunning(true);
    mRecyclerViewTouchActionGuardManager.setEnabled(true);

    // drag & drop manager
    mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
    mRecyclerViewDragDropManager.setDraggingItemShadowDrawable(
            (NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z3_xxhdpi));

    // swipe manager
    mRecyclerViewSwipeManager = new RecyclerViewSwipeManager();

    //adapter
    for(int i=0;i<100;i++){
        dataList.add(new MyItem(i,"测试数据"+i));
    }
    mAdapter  = new MyAdapter(dataList);

    mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(mAdapter);   //处理一下mAdapter可以拖拽
    mWrappedAdapter = mRecyclerViewSwipeManager.createWrappedAdapter(mWrappedAdapter);      //处理一下mAdapter可以滑动删除


    final GeneralItemAnimator animator = new SwipeDismissItemAnimator();

    // Change animations are enabled by default since support-v7-recyclerview v22.
    // Disable the change animation in order to make turning back animation of swiped item works properly.
    animator.setSupportsChangeAnimations(false);

    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setAdapter(mWrappedAdapter);  // 注意设置的是mWrappedAdapter
    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_z3_xxhdpi)));
    }
    mRecyclerView.addItemDecoration(new SimpleListDividerDecorator(getResources().getDrawable(R.drawable.list_divider), true));

    // NOTE:
    // 初始化的顺序十分重要,这决定了处理Touch事件的优先级
    // 优先级: TouchActionGuard > Swipe > DragAndDrop
    mRecyclerViewTouchActionGuardManager.attachRecyclerView(mRecyclerView);
    mRecyclerViewSwipeManager.attachRecyclerView(mRecyclerView);
    mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);

}
 
开发者ID:hanks-zyh,项目名称:RecylerView,代码行数:61,代码来源:MainActivity.java


示例9: getItemDecoration

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的package包/类
@Override
protected RecyclerView.ItemDecoration getItemDecoration() {
    return new SimpleListDividerDecorator(ContextCompat.getDrawable(getContext(), R.drawable.list_divider_h), true);
}
 
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:5,代码来源:SortingStepFragment.java


示例10: initRecyclerView

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的package包/类
private void initRecyclerView() {
    mRecyclerView = (RecyclerView) getView().findViewById(R.id.recylerView);
    mLayoutManager = new LinearLayoutManager(getActivity());

    // touch guard manager  (this class is required to suppress scrolling while swipe-dismiss animation is running)
    mRecyclerViewTouchActionGuardManager = new RecyclerViewTouchActionGuardManager();
    mRecyclerViewTouchActionGuardManager.setInterceptVerticalScrollingWhileAnimationRunning(true);
    mRecyclerViewTouchActionGuardManager.setEnabled(true);

    // drag & drop manager 拖拽排序的manager
    mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
    mRecyclerViewDragDropManager.setDraggingItemShadowDrawable(
            (NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z3_xxhdpi));

    // swipe manager 滑动item的manager
    mRecyclerViewSwipeManager = new RecyclerViewSwipeManager();

    //adapter
    mAdapter = new MyTaskAdapter(context, list);
    mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(mAdapter);      // wrap for swiping
    mWrappedAdapter = mRecyclerViewSwipeManager.createWrappedAdapter(mWrappedAdapter);      // wrap for swiping
    final GeneralItemAnimator animator = new SwipeDismissItemAnimator();

    // Change animations are enabled by default since support-v7-recyclerview v22.
    // Disable the change animation in order to make turning back animation of swiped item works properly.
    animator.setSupportsChangeAnimations(false);

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


    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_xxhdpi)));
    }
    mRecyclerView.addItemDecoration(new SimpleListDividerDecorator(getResources().getDrawable(R.drawable.list_divider), true));

    // NOTE:
    // The initialization order is very important! This order determines the priority of touch event handling.
    // priority: TouchActionGuard > Swipe > DragAndDrop
    mRecyclerViewTouchActionGuardManager.attachRecyclerView(mRecyclerView);
    mRecyclerViewSwipeManager.attachRecyclerView(mRecyclerView);
    mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
}
 
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:47,代码来源:MyTaskFragment.java


示例11: init

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的package包/类
/**
     * 初始化
     */
    private void init() {
        listTask = new ArrayList<Task>();
        listDay = new ArrayList<Day>();
        adapterDay = new DayAdapter(context, listDay);

        mRecyclerView = (RecyclerView) findViewById(R.id.lv_all_zixi);
        lv_day = (ListView) findViewById(R.id.lv_day);
        tv_day = (TextView) findViewById(R.id.tv_day);


        // touch guard manager  (this class is required to suppress scrolling while swipe-dismiss animation is running)
        mRecyclerViewTouchActionGuardManager = new RecyclerViewTouchActionGuardManager();
        mRecyclerViewTouchActionGuardManager.setInterceptVerticalScrollingWhileAnimationRunning(true);
        mRecyclerViewTouchActionGuardManager.setEnabled(true);

        // drag & drop manager 拖拽排序的manager
        mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
        mRecyclerViewDragDropManager.setDraggingItemShadowDrawable(
                (NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z3_xxhdpi));

        // swipe manager 滑动item的manager
        mRecyclerViewSwipeManager = new RecyclerViewSwipeManager();

        //adapter
        mAdapter = new MyTaskAdapter(context, listTask);
        mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(mAdapter);      // wrap for swiping
        mWrappedAdapter = mRecyclerViewSwipeManager.createWrappedAdapter(mWrappedAdapter);      // wrap for swiping
        final GeneralItemAnimator animator = new SwipeDismissItemAnimator();

        // Change animations are enabled by default since support-v7-recyclerview v22.
        // Disable the change animation in order to make turning back animation of swiped item works properly.
        animator.setSupportsChangeAnimations(false);

        mRecyclerView.setLayoutManager(new LinearLayoutManager(context));
        mRecyclerView.setAdapter(mWrappedAdapter);  // requires *wrapped* adapter
        mRecyclerView.setItemAnimator(animator);


        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_xxhdpi)));
        }
        mRecyclerView.addItemDecoration(new SimpleListDividerDecorator(getResources().getDrawable(R.drawable.list_divider), true));

        // NOTE:
        // The initialization order is very important! This order determines the priority of touch event handling.
        // priority: TouchActionGuard > Swipe > DragAndDrop
        mRecyclerViewTouchActionGuardManager.attachRecyclerView(mRecyclerView);
        mRecyclerViewSwipeManager.attachRecyclerView(mRecyclerView);
        mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);


        lv_day.setAdapter(adapterDay);

        // // 允许加载更多
//        lv_day.setPullLoadEnable(true);
//        // 允许下拉
//        lv_day.setPullRefreshEnable(true);
//        // 设置监听器
//        lv_day.setXListViewListener(this);
//        lv_day.pullRefreshing();

        lv_day.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Day d = listDay.get(position);
                Calendar tmp = Calendar.getInstance();
                tmp.set(d.getYear(), d.getMonth(), d.getDay(), 0, 0, 1);
                tv_day.setText(TaskUtil.getZixiDateS(tmp.getTimeInMillis()));
                getZixiByDay(tmp);
            }
        });
        // 加载数据
        initData();
    }
 
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:80,代码来源:AllMyTaskActivity.java


示例12: onViewCreated

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的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());

    final Parcelable eimSavedState = (savedInstanceState != null) ? savedInstanceState.getParcelable(SAVED_STATE_EXPANDABLE_ITEM_MANAGER) : null;
    mRecyclerViewExpandableItemManager = new RecyclerViewExpandableItemManager(eimSavedState);

    // touch guard manager  (this class is required to suppress scrolling while swipe-dismiss animation is running)
    mRecyclerViewTouchActionGuardManager = new RecyclerViewTouchActionGuardManager();
    mRecyclerViewTouchActionGuardManager.setInterceptVerticalScrollingWhileAnimationRunning(true);
    mRecyclerViewTouchActionGuardManager.setEnabled(true);

    // drag & drop manager
    mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
    mRecyclerViewDragDropManager.setDraggingItemShadowDrawable(
            (NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z3));

    // swipe manager
    mRecyclerViewSwipeManager = new RecyclerViewSwipeManager();

    //adapter
    getDataProvider();
    final MyExpandableDraggableWithSectionItemAdapter myItemAdapter = new MyExpandableDraggableWithSectionItemAdapter(getDataProvider());

    mAdapter = myItemAdapter;

    mWrappedAdapter = mRecyclerViewExpandableItemManager.createWrappedAdapter(myItemAdapter);       // wrap for expanding
    mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(mWrappedAdapter);           // wrap for dragging
    mWrappedAdapter = mRecyclerViewSwipeManager.createWrappedAdapter(mWrappedAdapter);      // wrap for swiping

    final GeneralItemAnimator animator = new SwipeDismissItemAnimator();

    // Change animations are enabled by default since support-v7-recyclerview v22.
    // Need to disable them when using animation indicator.
    animator.setSupportsChangeAnimations(false);

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

    // 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));


    // NOTE:
    // The initialization order is very important! This order determines the priority of touch event handling.
    //
    // priority: TouchActionGuard > Swipe > DragAndDrop > ExpandableItem
    mRecyclerViewTouchActionGuardManager.attachRecyclerView(mRecyclerView);
    mRecyclerViewSwipeManager.attachRecyclerView(mRecyclerView);
    mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
    mRecyclerViewExpandableItemManager.attachRecyclerView(mRecyclerView);
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:65,代码来源:RecyclerListViewFragment.java


示例13: onViewCreated

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的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


示例14: onViewCreated

import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator; //导入依赖的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());

    final Parcelable eimSavedState = (savedInstanceState != null) ? savedInstanceState.getParcelable(SAVED_STATE_EXPANDABLE_ITEM_MANAGER) : null;
    mRecyclerViewExpandableItemManager = new RecyclerViewExpandableItemManager(eimSavedState);

    //adapter
    getDataProvider();
    final MyExpandableItemAdapter myItemAdapter = new MyExpandableItemAdapter(getDataProvider());

    mAdapter = myItemAdapter;

    mWrappedAdapter = mRecyclerViewExpandableItemManager.createWrappedAdapter(myItemAdapter);       // wrap for expanding

    final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();

    // Change animations are enabled by default since support-v7-recyclerview v22.
    // Need to disable them when using animation indicator.
    animator.setSupportsChangeAnimations(false);

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

    // 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));

    mRecyclerViewExpandableItemManager.attachRecyclerView(mRecyclerView);
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:42,代码来源:RecyclerListViewFragment.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RowCacheKey类代码示例发布时间:2022-05-22
下一篇:
Java AvailablePortFinder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap