proming / android-shuffle

Automatically exported from code.google.com/p/android-shuffle
0 stars 0 forks source link

Unable to Sort Actions within a project #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm not able to sort some items at all, the Move Up/Move Down menu actions have 
no effect on them, which means I can't get 'Next actions' to be correct. It's 
not clear to me what is special (other than being unable to sort) these items.

Original issue reported on code.google.com by samtkenn...@gmail.com on 15 Jun 2010 at 11:59

GoogleCodeExporter commented 9 years ago
Same here. 

I'm syncing with a tracks server and I can't manually order the actions in the 
project view. Android 2.1 on Samsung Galaxy S.

Original comment by papaFres...@gmail.com on 15 Sep 2010 at 3:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
same here.

Some of the tasks can be "Move up" and "Move down", but some of them cannot.
And sometimes it can be moved to some positions but not all of the positions 
inside the project.

I'm using Android 2.2, Shuffle 1.7 (R238 from SVN)

Original comment by xu4wang@gmail.com on 4 Jan 2011 at 4:30

GoogleCodeExporter commented 9 years ago
Did some research on the code, looks like the issue is caused by 
synchronization with Tracks. 

Tasks created in Tracks and synced to Shuffle are all with DISPLAY_ORDER 0. As 
a result, when we try to re-order it by Move up/down, they will NOT changed 
because they are all with the same display order 0.

Original comment by xu4wang@gmail.com on 4 Jan 2011 at 6:12

GoogleCodeExporter commented 9 years ago
As Next Actions is too important to me, I cannot wait and made a hack to work 
around this.

The modification is to use position in the list view as the 
DISPLAY_ORDER_INDEX. changes to the swapTaskPositions method are listed below. 
only two lines impacted.

Initial testing shows the hack works. Every task can be re-ordered and "next 
action" looks like I expected. :-)

    public void swapTaskPositions(Cursor cursor, int pos1, int pos2) {
        Log.d(cTag, "swapTaskPositions "+pos1 +","+ pos2 );

        cursor.moveToPosition(pos1);
        Id id1 = readId(cursor, ID_INDEX);
        int positionValue1 = cursor.getInt(DISPLAY_ORDER_INDEX);
        cursor.moveToPosition(pos2);
        Id id2 = readId(cursor, ID_INDEX);
        int positionValue2 = cursor.getInt(DISPLAY_ORDER_INDEX);

        Uri uri = ContentUris.withAppendedId(getContentUri(), id1.getId());
        ContentValues values = new ContentValues();
        //values.put(DISPLAY_ORDER, positionValue2);
        values.put(DISPLAY_ORDER, pos2);
        Log.d(cTag, "swapTaskPositions values.put(DISPLAY_ORDER, positionValue2)"+ positionValue2 );
        mResolver.update(uri, values, null, null);

        uri = ContentUris.withAppendedId(getContentUri(), id2.getId());
        values = new ContentValues();
        //values.put(DISPLAY_ORDER, positionValue1);
        values.put(DISPLAY_ORDER, pos1);
        Log.d(cTag, "swapTaskPositions values.put(DISPLAY_ORDER, positionValue1)"+ positionValue1 );

        mResolver.update(uri, values, null, null);
        mAnalytics.onEvent(cFlurryReorderTasksEvent);
    }

Original comment by xu4wang@gmail.com on 4 Jan 2011 at 7:37

GoogleCodeExporter commented 9 years ago

Original comment by andybry...@gmail.com on 5 Mar 2011 at 3:59