Giter VIP home page Giter VIP logo

Comments (8)

lkorth avatar lkorth commented on July 19, 2024

If you take a look at DragDropGrid at line 200, this is where the touch up and reordering is handled if something was dragged.

from pageddragdropgrid.

musaulker avatar musaulker commented on July 19, 2024

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)

from pageddragdropgrid.

lkorth avatar lkorth commented on July 19, 2024

Any time there is a drop that causes a reorder, swapItems() will be called.

from pageddragdropgrid.

musaulker avatar musaulker commented on July 19, 2024

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 [email protected] 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//issues/17#issuecomment-15959144
.

M.Musa Ülker

from pageddragdropgrid.

lkorth avatar lkorth commented on July 19, 2024

I don't believe so

from pageddragdropgrid.

musaulker avatar musaulker commented on July 19, 2024

Then, whats your advice?

On Fri, Apr 5, 2013 at 6:05 PM, Luke Korth [email protected] wrote:

I don't believe so


Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-15960891
.

M.Musa Ülker

from pageddragdropgrid.

lkorth avatar lkorth commented on July 19, 2024

Use swapItems() or modify DragDropGrid

from pageddragdropgrid.

mrKlar avatar mrKlar commented on July 19, 2024

You could create your own listener and use it in the adapter when swapItems is called.

from pageddragdropgrid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.