Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ferrannp opened this issue Jan 7, 2015 · 1 comment
Open

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

ferrannp opened this issue Jan 7, 2015 · 1 comment

Comments

@ferrannp
Copy link

ferrannp commented Jan 7, 2015

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!

@emileb
Copy link
Owner

emileb commented Jan 10, 2015

Hi,
OK I think I know what you want, a way to progmatically start the drag operation?
This should be possible, but won't you need to take your finger off the list item before the drag has finished?
What is the overall functionally you're trying to achieve? Long press on the item then...

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants