← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

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

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/refactor-fix-1428913/+merge/252054

Trigger list reset animation when the index did not change.

Note: this was manually merged/reimplemented because the logic for reordering was relocated from where it was in trunk.
-- 
Your team Music App Developers is requested to review the proposed merge of lp:~vthompson/music-app/refactor-fix-1428913 into lp:music-app/refactor.
=== modified file 'app/components/ListItemReorderComponent.qml'
--- app/components/ListItemReorderComponent.qml	2015-02-22 02:24:16 +0000
+++ app/components/ListItemReorderComponent.qml	2015-03-06 02:40:38 +0000
@@ -64,21 +64,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)
             }


Follow ups