Closed musaulker closed 11 years ago
If you take a look at DragDropGrid at line 200, this is where the touch up and reordering is handled if something was dragged.
I modified ExamplePagedDragDropGridAdapter and added a method; isOrdered(), to check the list is ordered or not, for a special purpose.
public boolean isOrdered(){
List<Item> items = pages.get(0).getItems();
Long previousIndex = items.get(0).getId();
for (int i = 1; i < items.size(); i++) {
Long currentIndex = items.get(i).getId();
if(currentIndex > previousIndex){
previousIndex = currentIndex;
continue;
}
else{
return false;
}
}
return true;
}
I need to catch somehow the drop event so later I can check if the list is ordered or not.
So from my Activity how can I catch the drop event? (Without modifying core source codes for DragDropGrid class)
Any time there is a drop that causes a reorder, swapItems() will be called.
I understood. But what about a listener? Are there any listener exists on DragDropGrid or adapter or items that I can listen it to catch drop events to call my method in adapter?
Thanks
On Fri, Apr 5, 2013 at 5:36 PM, Luke Korth notifications@github.com wrote:
Any time there is a drop that causes a reorder, swapItems()https://github.com/mrKlar/PagedDragDropGrid/blob/master/example/src/ca/laplanete/mobile/example/ExamplePagedDragDropGridAdapter.java#L209will be called.
— Reply to this email directly or view it on GitHubhttps://github.com/mrKlar/PagedDragDropGrid/issues/17#issuecomment-15959144 .
M.Musa Ülker
I don't believe so
Then, whats your advice?
On Fri, Apr 5, 2013 at 6:05 PM, Luke Korth notifications@github.com wrote:
I don't believe so
— Reply to this email directly or view it on GitHubhttps://github.com/mrKlar/PagedDragDropGrid/issues/17#issuecomment-15960891 .
M.Musa Ülker
Use swapItems()
or modify DragDropGrid
You could create your own listener and use it in the adapter when swapItems is called.
How do I catch the drop event?