Merge lp:~ahayzen/music-app/cardview-fix-number-columns-zero into lp:music-app/remix

Proposed by Andrew Hayzen
Status: Merged
Approved by: Victor Thompson
Approved revision: 748
Merged at revision: 748
Proposed branch: lp:~ahayzen/music-app/cardview-fix-number-columns-zero
Merge into: lp:music-app/remix
Diff against target: 26 lines (+2/-3)
2 files modified
common/CardView.qml (+1/-1)
common/ColumnFlow.qml (+1/-2)
To merge this branch: bzr merge lp:~ahayzen/music-app/cardview-fix-number-columns-zero
Reviewer Review Type Date Requested Status
Victor Thompson Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+242582@code.launchpad.net

Commit message

* Fix to prevent the number of columns dropping to 0 causing unexpected behaviour

Description of the change

* Fix to prevent the number of columns dropping to 0 causing unexpected behaviour

Note this only affects desktop.

On trunk if you resize the cardview so that the width is smaller than the target width for 1 item (usually ~15GU for music) the number of columns can be evaluated to zero causing strange behaviour when the window is then expanded again (eg two layers of cards appearing in the first column).

TESTING:
1) Start the app and ensure you are on a tab with the cardview
2) Resize the window of the application so that the width is as small as possible
3) Resize the window so that it is back to its original width
4) Confirm no cards are overlapping

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
Victor Thompson (vthompson) wrote :

LGTM! Nice catch! :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'common/CardView.qml'
2--- common/CardView.qml 2014-11-11 19:11:53 +0000
3+++ common/CardView.qml 2014-11-23 03:55:15 +0000
4@@ -67,7 +67,7 @@
5 anchors {
6 fill: parent
7 }
8- columns: parseInt(cardViewFlickable.width / itemWidth)
9+ columns: parseInt(cardViewFlickable.width / itemWidth) || 1 // never drop to 0
10 flickable: cardViewFlickable
11 }
12 }
13
14=== modified file 'common/ColumnFlow.qml'
15--- common/ColumnFlow.qml 2014-11-11 20:13:50 +0000
16+++ common/ColumnFlow.qml 2014-11-23 03:55:15 +0000
17@@ -42,8 +42,7 @@
18 onColumnWidthChanged: {
19 if (restoring) {
20 return;
21- }
22- else if (columns != columnHeights.length && visible) {
23+ } else if (columns != columnHeights.length && visible) {
24 // number of columns has changed so rebuild the columns
25 rebuildColumns()
26 } else { // column width has changed update visible items properties linked to columnWidth

Subscribers

People subscribed via source and target branches