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

Proposed by Victor Thompson
Status: Merged
Approved by: Andrew Hayzen
Approved revision: 843
Merged at revision: 843
Proposed branch: lp:~vthompson/music-app/refactor-fix-1428913
Merge into: lp:music-app
Diff against target: 35 lines (+10/-12)
1 file modified
app/components/ListItemReorderComponent.qml (+10/-12)
To merge this branch: bzr merge lp:~vthompson/music-app/refactor-fix-1428913
Reviewer Review Type Date Requested Status
Andrew Hayzen Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+252054@code.launchpad.net

Commit message

Trigger list reset animation when the index did not change.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

LGTM :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/components/ListItemReorderComponent.qml'
2--- app/components/ListItemReorderComponent.qml 2015-02-22 02:24:16 +0000
3+++ app/components/ListItemReorderComponent.qml 2015-03-06 02:40:38 +0000
4@@ -64,21 +64,19 @@
5
6 root.parent.parent.interactive = true; // reenable scrolling
7
8- if (diff === 0) {
9+ var newIndex = index + diff;
10+
11+ if (newIndex < 0) {
12+ newIndex = 0;
13+ } else if (newIndex > root.parent.parent.count - 1) {
14+ newIndex = root.parent.parent.count - 1;
15+ }
16+
17+ if (index === newIndex) {
18 // Nothing has changed so reset the item
19 // z index is restored after animation
20 resetListItemYAnimation.start();
21- }
22- else {
23- var newIndex = index + diff;
24-
25- if (newIndex < 0) {
26- newIndex = 0;
27- }
28- else if (newIndex > root.parent.parent.count - 1) {
29- newIndex = root.parent.parent.count - 1;
30- }
31-
32+ } else {
33 root.z -= 10; // restore z index
34 reorder(index, newIndex)
35 }

Subscribers

People subscribed via source and target branches