Skip to content

Drag and Drop with long click and Contextual Action Bar #11

@ferrannp

Description

@ferrannp

Is it possible with this library? I'll explain:

I have a list with some items that you can click on it (radio buttons) (so onItemClickListener and all that stuff will not work). When I long click any element inside my list row, I launch a Contextual Action Bar (when item selected).

My idea is to launch a drag action too (like startDraging(position). Something like:

    holder.radioButton.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {

            if (!isCAB()) { //No Contextual Action Bar
               getListView().setItemChecked(position, true); //Launch ActionMode
               getListView().startDrag(position); //HERE (launch drag too)
            }else {
                selectCABitem(checkedItems, position);
            }
            return true;
        }
    });

What I would do then is have a drag listener, if we drag an item to another position (even if we don't drop it yet), the contextual action bar will disappear, on the other hand, if we drop the element in the same position, then the CAB stays and you can continue selecting items. This is the default behaviour of Google Keep for example.

I think what is really needed is the ability to say "startDrag(position)" and having that listener... I was not really lucky for now with that libraries out there.

Looking at this library, the only way for launching a drag action is to give a id handler (like imageview)?

Thanks for your time!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions