h6ah4i/android-advancedrecyclerview

Collapse groups while dragging

Open

#200 opened on Mar 1, 2016

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Java (879 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (5,296 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Hi

When dragging a group, I'm trying to force closing all groups just before dragging. It's visually unpleasant having the group to cross the childs one by one. So far I can collapseAll in onCheckGroupCanStartDrag, but the user looses the initial dragging gesture. collapseAll cancels the ongoing drag.

Is there a way to have this prettier?

@Override 
public boolean onCheckGroupCanStartDrag(MyGroupViewHolder holder, int groupPosition, int x, int y) {
        ...
        boolean result = ViewUtils.hitTest(dragHandleView, x - offsetX, y - offsetY);
        if (result)
            if (mExpandableItemManager.getExpandedGroupsCount()>0) {
                mExpandableItemManager.collapseAll();
            }
        return result;
    }

Edit: Just notice a duplicate #74

Contributor guide