← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~vthompson/music-app/fix-1428913 into lp:music-app

 

Victor Thompson has proposed merging lp:~vthompson/music-app/fix-1428913 into lp:music-app.

Commit message:
Trigger list reset animation when the index did not change.

Requested reviews:
  Music App Developers (music-app-dev)
Related bugs:
  Bug #1428913 in Ubuntu Music App: "Reordering the last item in a list (Playlist or Queue) can stick it in an improperly stuck location"
  https://bugs.launchpad.net/music-app/+bug/1428913

For more details, see:
https://code.launchpad.net/~vthompson/music-app/fix-1428913/+merge/252052

Trigger list reset animation when the index did not change.
-- 
Your team Music App Developers is requested to review the proposed merge of lp:~vthompson/music-app/fix-1428913 into lp:music-app.
=== modified file 'common/ListItemWithActions.qml'
--- common/ListItemWithActions.qml	2015-01-18 00:06:06 +0000
+++ common/ListItemWithActions.qml	2015-03-06 02:05:45 +0000
@@ -543,22 +543,19 @@
                     }
 
                     root.parent.parent.interactive = true;  // reenable scrolling
-
-                    if (diff === 0) {
+                    var newIndex = index + diff;
+
+                    if (newIndex < 0) {
+                        newIndex = 0;
+                    } else if (newIndex > root.parent.parent.count - 1) {
+                        newIndex = root.parent.parent.count - 1;
+                    }
+
+                    if (index === newIndex) {
                         // Nothing has changed so reset the item
                         // z index is restored after animation
                         resetListItemYAnimation.start();
-                    }
-                    else {
-                        var newIndex = index + diff;
-
-                        if (newIndex < 0) {
-                            newIndex = 0;
-                        }
-                        else if (newIndex > root.parent.parent.count - 1) {
-                            newIndex = root.parent.parent.count - 1;
-                        }
-
+                    } else {
                         root.z -= 10;  // restore z index
                         reorder(index, newIndex)
                     }
@@ -575,6 +572,7 @@
                 UbuntuNumberAnimation {
                     target: root;
                     property: "y";
+                    from: root.y
                     to: actionReorderMouseArea.startY
                 }
                 ScriptAction {


Follow ups