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
=== modified file 'OrganicGrid.qml'
--- OrganicGrid.qml 2014-08-05 07:06:44 +0000
+++ OrganicGrid.qml 2014-08-08 06:06:45 +0000
@@ -14,7 +14,7 @@
14 property bool canReload: false14 property bool canReload: false
1515
16 // this value will be changed if the app's width changed16 // this value will be changed if the app's width changed
17 property int numberAddMore: 1217 readonly property int numberAddMore: 4
1818
19 // connect to MainView's sizeChanged signal19 // connect to MainView's sizeChanged signal
20 Connections{20 Connections{
@@ -26,8 +26,6 @@
26 }26 }
2727
28 function sizeChangedHandler() {28 function sizeChangedHandler() {
29 var num = 12 * (1 + width / height)
30 numberAddMore = num > 12 ? num : 12
31 if (canReload) {29 if (canReload) {
32 canReload = false30 canReload = false
33 clear()31 clear()
@@ -111,9 +109,9 @@
111109
112 console.time("loadmore")110 console.time("loadmore")
113111
114 for(var i = currentLoadedIndex; i < currentLoadedIndex + numAdd; i++) {112 for(;;) {
113 var i = currentLoadedIndex++
115 var article = articleModel.get(i);114 var article = articleModel.get(i);
116 //var imageArray = [article.image]
117 var hasImage = (article.image !== "") ? 0x2 : 0x0115 var hasImage = (article.image !== "") ? 0x2 : 0x0
118 var useAlternateDelegate = (Math.random() > 0.5) ? 0x1 : 0116 var useAlternateDelegate = (Math.random() > 0.5) ? 0x1 : 0
119117
@@ -127,19 +125,26 @@
127125
128 var properties = {126 var properties = {
129 "modelItem": article,127 "modelItem": article,
130 //"imageArray": imageArray,
131 "rssModel": articleModel,128 "rssModel": articleModel,
132 "modelIndex": i129 "modelIndex": i
133 }130 }
134131
135 var articleItem = component.createObject(organicFlickable.contentItem, properties)132 var articleItem = component.createObject(organicFlickable.contentItem, properties)
136 itemsPlacer.placeObject(articleItem)133 itemsPlacer.placeObject(articleItem)
137 // articleItem.secretProp = article.title // TODO BUG
138 addToListWithSort(articleItem)134 addToListWithSort(articleItem)
135
136 if (--numAdd <= 0) {
137 var lix = articleItem.x // "x" coordinate of last item.
138 amountToGo = articleModel.count - currentLoadedIndex
139 /* We should try to add few items more if some free space left of the screen. */
140 if (lix < organicFlickable.contentX + organicFlickable.width && amountToGo > 0) {
141 numAdd = amountToGo > numberAddMore ? numberAddMore : amountToGo
142 // console.log("Few items more: ", numAdd)
143 } else break
144 }
139 }145 }
140146
141 itemsPlacer.clearTemporaries()147 itemsPlacer.clearTemporaries()
142 currentLoadedIndex += numAdd
143 organicFlickable.canAdd = true148 organicFlickable.canAdd = true
144 console.timeEnd("loadmore")149 console.timeEnd("loadmore")
145150
146151
=== modified file 'XmlNetwork.qml'
--- XmlNetwork.qml 2014-08-05 10:08:24 +0000
+++ XmlNetwork.qml 2014-08-08 06:06:45 +0000
@@ -122,8 +122,8 @@
122 }122 }
123 }123 }
124 }124 }
125 console.log("getFirstImage")125 // console.log("getFirstImage")
126 console.log(e.content) 126 // console.log(e.content)
127 var image = ImageUtils.getFirstImage(e.content)127 var image = ImageUtils.getFirstImage(e.content)
128 if (image != null) {128 if (image != null) {
129 return image129 return image
130130
=== modified file 'imgSeparator.js'
--- imgSeparator.js 2014-08-05 10:08:24 +0000
+++ imgSeparator.js 2014-08-08 06:06:45 +0000
@@ -4,7 +4,7 @@
44
55
6 image_array = rss_content.split("<img")6 image_array = rss_content.split("<img")
7 console.log("SPLIT");7 // console.log("SPLIT");
88
9 image_array.shift() ;9 image_array.shift() ;
1010
1111
=== modified file 'shorts-app.qml'
--- shorts-app.qml 2014-08-02 18:40:48 +0000
+++ shorts-app.qml 2014-08-08 06:06:45 +0000
@@ -26,7 +26,7 @@
26 applicationName: "com.ubuntu.shorts"26 applicationName: "com.ubuntu.shorts"
27 anchorToKeyboard: true27 anchorToKeyboard: true
2828
29 width: units.gu(50)29 width: units.gu(100)
30 height: units.gu(80)30 height: units.gu(80)
3131
32 headerColor: "#3a2c32"32 headerColor: "#3a2c32"

Subscribers

People subscribed via source and target branches