Merge lp:~mrqtros/ubuntu-rssreader-app/ubuntu-rssreader-app-loadmore-reworked into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk

Proposed by Roman Shchekin
Status: Merged
Approved by: Joey Chan
Approved revision: 286
Merged at revision: 283
Proposed branch: lp:~mrqtros/ubuntu-rssreader-app/ubuntu-rssreader-app-loadmore-reworked
Merge into: lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
Diff against target: 104 lines (+17/-12)
4 files modified
OrganicGrid.qml (+13/-8)
XmlNetwork.qml (+2/-2)
imgSeparator.js (+1/-1)
shorts-app.qml (+1/-1)
To merge this branch: bzr merge lp:~mrqtros/ubuntu-rssreader-app/ubuntu-rssreader-app-loadmore-reworked
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Shorts Developers Pending
Review via email: mp+230043@code.launchpad.net

Commit message

loadMoreItems now more intellectual
+ Few little improvements.

Description of the change

loadMoreItems now more intellectual
+ Few little improvements.

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)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'OrganicGrid.qml'
2--- OrganicGrid.qml 2014-08-05 07:06:44 +0000
3+++ OrganicGrid.qml 2014-08-08 06:06:45 +0000
4@@ -14,7 +14,7 @@
5 property bool canReload: false
6
7 // this value will be changed if the app's width changed
8- property int numberAddMore: 12
9+ readonly property int numberAddMore: 4
10
11 // connect to MainView's sizeChanged signal
12 Connections{
13@@ -26,8 +26,6 @@
14 }
15
16 function sizeChangedHandler() {
17- var num = 12 * (1 + width / height)
18- numberAddMore = num > 12 ? num : 12
19 if (canReload) {
20 canReload = false
21 clear()
22@@ -111,9 +109,9 @@
23
24 console.time("loadmore")
25
26- for(var i = currentLoadedIndex; i < currentLoadedIndex + numAdd; i++) {
27+ for(;;) {
28+ var i = currentLoadedIndex++
29 var article = articleModel.get(i);
30- //var imageArray = [article.image]
31 var hasImage = (article.image !== "") ? 0x2 : 0x0
32 var useAlternateDelegate = (Math.random() > 0.5) ? 0x1 : 0
33
34@@ -127,19 +125,26 @@
35
36 var properties = {
37 "modelItem": article,
38- //"imageArray": imageArray,
39 "rssModel": articleModel,
40 "modelIndex": i
41 }
42
43 var articleItem = component.createObject(organicFlickable.contentItem, properties)
44 itemsPlacer.placeObject(articleItem)
45- // articleItem.secretProp = article.title // TODO BUG
46 addToListWithSort(articleItem)
47+
48+ if (--numAdd <= 0) {
49+ var lix = articleItem.x // "x" coordinate of last item.
50+ amountToGo = articleModel.count - currentLoadedIndex
51+ /* We should try to add few items more if some free space left of the screen. */
52+ if (lix < organicFlickable.contentX + organicFlickable.width && amountToGo > 0) {
53+ numAdd = amountToGo > numberAddMore ? numberAddMore : amountToGo
54+ // console.log("Few items more: ", numAdd)
55+ } else break
56+ }
57 }
58
59 itemsPlacer.clearTemporaries()
60- currentLoadedIndex += numAdd
61 organicFlickable.canAdd = true
62 console.timeEnd("loadmore")
63
64
65=== modified file 'XmlNetwork.qml'
66--- XmlNetwork.qml 2014-08-05 10:08:24 +0000
67+++ XmlNetwork.qml 2014-08-08 06:06:45 +0000
68@@ -122,8 +122,8 @@
69 }
70 }
71 }
72- console.log("getFirstImage")
73- console.log(e.content)
74+ // console.log("getFirstImage")
75+ // console.log(e.content)
76 var image = ImageUtils.getFirstImage(e.content)
77 if (image != null) {
78 return image
79
80=== modified file 'imgSeparator.js'
81--- imgSeparator.js 2014-08-05 10:08:24 +0000
82+++ imgSeparator.js 2014-08-08 06:06:45 +0000
83@@ -4,7 +4,7 @@
84
85
86 image_array = rss_content.split("<img")
87- console.log("SPLIT");
88+ // console.log("SPLIT");
89
90 image_array.shift() ;
91
92
93=== modified file 'shorts-app.qml'
94--- shorts-app.qml 2014-08-02 18:40:48 +0000
95+++ shorts-app.qml 2014-08-08 06:06:45 +0000
96@@ -26,7 +26,7 @@
97 applicationName: "com.ubuntu.shorts"
98 anchorToKeyboard: true
99
100- width: units.gu(50)
101+ width: units.gu(100)
102 height: units.gu(80)
103
104 headerColor: "#3a2c32"

Subscribers

People subscribed via source and target branches