Coder Social home page Coder Social logo

Comments (6)

emileb avatar emileb commented on September 1, 2024

You need to actually move the elements yourself in the onItemMoved method,
are you doing this?

On 7 July 2015 at 03:20, azizimusa [email protected] wrote:

Hi,
Whenever I drag and drop. The list is back to original position. FYI I use
recyclerview adapter with cursor adapter support. But I am not so sure if
the adapter is the cause of the problem


Reply to this email directly or view it on GitHub
#19.

from dragsortrecycler.

azizimusa avatar azizimusa commented on September 1, 2024

Yeah. I figure about it actually. Forgot to update issue. But I'm having problem about recyclerview.getChildAt(index) . It seem only allow me to fetch 1st 4 item, while I got 12 items in the list. How to overcome this?

from dragsortrecycler.

emileb avatar emileb commented on September 1, 2024

I'm not sure, are you saying the DragSortRecycler is effecting this
function?

On 7 July 2015 at 07:45, azizimusa [email protected] wrote:

Yeah. I figure about it actually. Forgot to update issue. But I'm having
problem about recyclerview.getChildAt(index) . It seem only allow me to
fetch 1st 4 item, while I got 12 items in the list. How to overcome this?


Reply to this email directly or view it on GitHub
#19 (comment)
.

from dragsortrecycler.

azizimusa avatar azizimusa commented on September 1, 2024

No. not at all. sorry.

from dragsortrecycler.

emileb avatar emileb commented on September 1, 2024

OK no problem, I was just checking :)

On 7 July 2015 at 08:34, azizimusa [email protected] wrote:

No. not at all. sorry.


Reply to this email directly or view it on GitHub
#19 (comment)
.

from dragsortrecycler.

azizimusa avatar azizimusa commented on September 1, 2024

Here is my implementation of saving new order after drag and drop. Might be useful for incoming newbie like me :)

Cursor cursor = mainRecord.getAllData(currentMonth, currentYear);

                if (from < to){
                    for (int i=from; i <= to; i++) {

                        cursor.moveToPosition(i);

                        String type = cursor.getString(cursor.getColumnIndexOrThrow(MainRecord.col_type));

                        if (i != from) {
                            newOrder = i-1;
                        } else {
                            newOrder = to;
                        }

                        mainRecord.updateOrder(type, newOrder);

                    }
                } else {

                    for (int i=from; i >= to; i--) {

                        cursor.moveToPosition(i);

                        String type = cursor.getString(cursor.getColumnIndexOrThrow(MainRecord.col_type));

                        if (i != from) {
                            newOrder = i+1;
                        } else {
                            newOrder = to;
                        }

                        mainRecord.updateOrder(type, newOrder);

                    }

                }
updateAdapter();

from dragsortrecycler.

Related Issues (15)

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.