CymChad / CymChad/BaseRecyclerViewAdapterHelper

怎么在ConcatAdapter中给其中一个或者多个Adapter添加拖动事件

Open
#6,795 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
24.6k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

 val enableUnitQuickDragAndSwipe = QuickDragAndSwipe().setDragMoveFlags(ItemTouchHelper.UP or ItemTouchHelper.DOWN)
        enableUnitQuickDragAndSwipe.attachToRecyclerView(mRecyclerView)
            .setDataCallback(enableCurrencyAdapter)
            .setItemDragListener(mItemDragListener)

        val disableUnitQuickDragAndSwipe = QuickDragAndSwipe().setDragMoveFlags(ItemTouchHelper.UP or ItemTouchHelper.DOWN)
        disableUnitQuickDragAndSwipe.attachToRecyclerView(mRecyclerView)
            .setDataCallback(disableCurrencyAdapter)
            .setItemDragListener(mItemDragListener)

        concatAdapter.addAdapter(enableTitleAdapter)
        concatAdapter.addAdapter(enableCurrencyAdapter)
        concatAdapter.addAdapter(disableTitleAdapter)
        concatAdapter.addAdapter(disableCurrencyAdapter)

        mRecyclerView.adapter = concatAdapter```

这样添加的拖动事件,可以拖动但是不正确

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior in the shown RecyclerView setup, focusing on QuickDragAndSwipe, ConcatAdapter, and the enableCurrencyAdapter and disableCurrencyAdapter callbacks. Trace how drag positions are mapped across the concatenated adapters; done means dragging items in the intended adapter produces the correct movement and callbacks.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.