Merge lp:~rpadovani/reminders-app/bottomEdge into lp:reminders-app

Proposed by Riccardo Padovani
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 198
Merged at revision: 241
Proposed branch: lp:~rpadovani/reminders-app/bottomEdge
Merge into: lp:reminders-app
Diff against target: 525 lines (+404/-6)
6 files modified
src/app/qml/components/PageWithBottomEdge.qml (+376/-0)
src/app/qml/reminders.qml (+5/-1)
src/app/qml/ui/EditNotePage.qml (+1/-0)
src/app/qml/ui/EditNoteView.qml (+3/-0)
src/app/qml/ui/NotebooksPage.qml (+4/-2)
src/app/qml/ui/NotesPage.qml (+15/-3)
To merge this branch: bzr merge lp:~rpadovani/reminders-app/bottomEdge
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Michael Zanetti (community) Approve
Review via email: mp+231118@code.launchpad.net

Commit message

Implemented bottomEdge

Description of the change

Added bottomEdge in phone mode: to avoid an annoying flickering when users open a notebook, the bottomEdge is loaded only after notes are loaded (only for notebooks page).

The bottomEdge component has been modified for our purpose

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: Needs Fixing (continuous-integration)
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
Michael Zanetti (mzanetti) wrote :

small nitpick inline (2 comments). Works reasonably well.

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Thanks, improved

Revision history for this message
Michael Zanetti (mzanetti) wrote :

ack

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

E: Release 'utopic' for 'qtdeclarative5-nemo-qml-plugin-folderlistmodel' was not found
E: Release 'utopic' for 'qtdeclarative5-pamauthentication0.1' was not found
E: Release 'utopic' for 'qtdeclarative5-placesmodel0.1' was not found
E: Release 'utopic' for 'ubuntu-filemanager-app' was not found
E: Release 'utopic' for 'ubuntu-filemanager-app-autopilot' was not found

Looks oddly broken?

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
Francis Ginther (fginther) wrote :

> E: Release 'utopic' for 'qtdeclarative5-nemo-qml-plugin-folderlistmodel' was
> not found
> E: Release 'utopic' for 'qtdeclarative5-pamauthentication0.1' was not found
> E: Release 'utopic' for 'qtdeclarative5-placesmodel0.1' was not found
> E: Release 'utopic' for 'ubuntu-filemanager-app' was not found
> E: Release 'utopic' for 'ubuntu-filemanager-app-autopilot' was not found
>
> Looks oddly broken?

This appears to be fallout from the recent testing issues.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'src/app/qml/components/PageWithBottomEdge.qml'
--- src/app/qml/components/PageWithBottomEdge.qml 1970-01-01 00:00:00 +0000
+++ src/app/qml/components/PageWithBottomEdge.qml 2014-09-03 16:57:24 +0000
@@ -0,0 +1,376 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/*
18 Example:
19
20 MainView {
21 objectName: "mainView"
22
23 applicationName: "com.ubuntu.developer.boiko.bottomedge"
24
25 width: units.gu(100)
26 height: units.gu(75)
27
28 Component {
29 id: pageComponent
30
31 PageWithBottomEdge {
32 id: mainPage
33 title: i18n.tr("Main Page")
34
35 Rectangle {
36 anchors.fill: parent
37 color: "white"
38 }
39
40 bottomEdgePageComponent: Page {
41 title: "Contents"
42 anchors.fill: parent
43 //anchors.topMargin: contentsPage.flickable.contentY
44
45 ListView {
46 anchors.fill: parent
47 model: 50
48 delegate: ListItems.Standard {
49 text: "One Content Item: " + index
50 }
51 }
52 }
53 bottomEdgeTitle: i18n.tr("Bottom edge action")
54 }
55 }
56
57 PageStack {
58 id: stack
59 Component.onCompleted: stack.push(pageComponent)
60 }
61 }
62
63*/
64
65import QtQuick 2.0
66import Ubuntu.Components 0.1
67import Evernote 0.1
68
69Page {
70 id: page
71
72 property alias bottomEdgePageComponent: edgeLoader.sourceComponent
73 property alias bottomEdgePageSource: edgeLoader.source
74 property alias bottomEdgeTitle: tipLabel.text
75 property alias bottomEdgeEnabled: bottomEdge.visible
76 property int bottomEdgeExpandThreshold: page.height * 0.2
77 property int bottomEdgeExposedArea: bottomEdge.state !== "expanded" ? (page.height - bottomEdge.y - bottomEdge.tipHeight) : _areaWhenExpanded
78 property bool reloadBottomEdgePage: true
79
80 readonly property alias bottomEdgePage: edgeLoader.item
81 readonly property bool isReady: (tip.opacity === 0.0)
82 readonly property bool isCollapsed: (tip.opacity === 1.0)
83 readonly property bool bottomEdgePageLoaded: (edgeLoader.status == Loader.Ready)
84 property var temporaryProperties: null
85
86 property bool bottomEdgeLabelVisible: true
87
88 property bool _showEdgePageWhenReady: false
89 property int _areaWhenExpanded: 0
90
91 signal bottomEdgeReleased()
92 signal bottomEdgeDismissed()
93
94
95 function showBottomEdgePage(source, properties)
96 {
97 edgeLoader.setSource(source, properties)
98 temporaryProperties = properties
99 _showEdgePageWhenReady = true
100 }
101
102 function setBottomEdgePage(source, properties)
103 {
104 edgeLoader.setSource(source, properties)
105 }
106
107 function _pushPage()
108 {
109 if (edgeLoader.status === Loader.Ready) {
110 edgeLoader.item.active = true
111
112 NotesStore.createNote("Untitled", filter);
113
114 if (edgeLoader.item.flickable) {
115 edgeLoader.item.flickable.contentY = -page.header.height
116 edgeLoader.item.flickable.returnToBounds()
117 }
118 if (edgeLoader.item.ready)
119 edgeLoader.item.ready()
120 }
121 }
122
123
124 Component.onCompleted: {
125 // avoid a binding on the expanded height value
126 var expandedHeight = height;
127 _areaWhenExpanded = expandedHeight;
128 }
129
130 onActiveChanged: {
131 if (active) {
132 bottomEdge.state = "collapsed"
133 }
134 }
135
136 onBottomEdgePageLoadedChanged: {
137 if (_showEdgePageWhenReady && bottomEdgePageLoaded) {
138 bottomEdge.state = "expanded"
139 _showEdgePageWhenReady = false
140 }
141 }
142
143 Rectangle {
144 id: bgVisual
145
146 visible: bottomEdgeLabelVisible
147
148 color: "black"
149 anchors.fill: page
150 opacity: 0.7 * ((page.height - bottomEdge.y) / page.height)
151 z: 1
152 }
153
154 Rectangle {
155 id: bottomEdge
156 objectName: "bottomEdge"
157
158 readonly property int tipHeight: units.gu(3)
159 readonly property int pageStartY: 0
160
161 visible: bottomEdgeLabelVisible
162
163 z: 1
164 color: Theme.palette.normal.background
165 parent: page
166 anchors {
167 left: parent.left
168 right: parent.right
169 }
170 height: page.height
171 y: height
172
173 Rectangle {
174 id: shadow
175
176 anchors {
177 left: parent.left
178 right: parent.right
179 }
180 height: units.gu(1)
181 y: -height
182 opacity: 0.0
183 gradient: Gradient {
184 GradientStop { position: 0.0; color: "transparent" }
185 GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, 0.2) }
186 }
187 }
188
189 Item {
190 id: tipContainer
191 objectName: "bottomEdgeTip"
192
193 width: childrenRect.width
194 height: bottomEdge.tipHeight
195 clip: true
196 y: -bottomEdge.tipHeight
197 anchors.horizontalCenter: parent.horizontalCenter
198
199 UbuntuShape {
200 id: tip
201
202 width: tipLabel.paintedWidth + units.gu(6)
203 height: bottomEdge.tipHeight + units.gu(1)
204 color: Theme.palette.normal.overlay
205 Label {
206 id: tipLabel
207
208 anchors {
209 top: parent.top
210 left: parent.left
211 right: parent.right
212 }
213 height: bottomEdge.tipHeight
214 verticalAlignment: Text.AlignVCenter
215 horizontalAlignment: Text.AlignHCenter
216 }
217 }
218 }
219
220 MouseArea {
221 preventStealing: true
222 drag.axis: Drag.YAxis
223 drag.target: bottomEdge
224 drag.minimumY: bottomEdge.pageStartY
225 drag.maximumY: page.height
226
227 anchors {
228 left: parent.left
229 right: parent.right
230 }
231 height: bottomEdge.tipHeight
232 y: -height
233
234 onReleased: {
235 page.bottomEdgeReleased()
236 if (bottomEdge.y < (page.height - bottomEdgeExpandThreshold - bottomEdge.tipHeight)) {
237 bottomEdge.state = "expanded"
238 } else {
239 bottomEdge.state = "collapsed"
240 bottomEdge.y = bottomEdge.height
241 }
242 }
243
244 onPressed: {
245 bottomEdge.state = "floating"
246 bottomEdge.y -= bottomEdge.tipHeight
247 }
248 }
249
250 Behavior on y {
251 UbuntuNumberAnimation {}
252 }
253
254 state: "collapsed"
255 states: [
256 State {
257 name: "collapsed"
258 PropertyChanges {
259 target: bottomEdge
260 y: bottomEdge.height
261 }
262 PropertyChanges {
263 target: tip
264 opacity: 1.0
265 }
266 },
267 State {
268 name: "expanded"
269 PropertyChanges {
270 target: bottomEdge
271 y: bottomEdge.pageStartY
272 }
273 PropertyChanges {
274 target: tip
275 opacity: 0.0
276 }
277 },
278 State {
279 name: "floating"
280 PropertyChanges {
281 target: shadow
282 opacity: 1.0
283 }
284 }
285 ]
286
287 transitions: [
288 Transition {
289 to: "expanded"
290 SequentialAnimation {
291 UbuntuNumberAnimation {
292 targets: [bottomEdge,tip]
293 properties: "y,opacity"
294 duration: UbuntuAnimation.SlowDuration
295 }
296 ScriptAction {
297 script: page._pushPage()
298 }
299 }
300 },
301 Transition {
302 from: "expanded"
303 to: "collapsed"
304 SequentialAnimation {
305 ScriptAction {
306 script: {
307 edgeLoader.item.parent = edgeLoader
308 edgeLoader.item.anchors.fill = edgeLoader
309 edgeLoader.item.active = false
310 }
311 }
312 UbuntuNumberAnimation {
313 targets: [bottomEdge,tip]
314 properties: "y,opacity"
315 duration: UbuntuAnimation.SlowDuration
316 }
317 ScriptAction {
318 script: {
319 // destroy current bottom page
320 if (page.reloadBottomEdgePage) {
321 edgeLoader.active = false
322 // remove properties from old instance
323 if (edgeLoader.source !== "") {
324 var properties = {}
325 if (temporaryProperties !== null) {
326 properties = temporaryProperties
327 temporaryProperties = null
328 }
329
330 edgeLoader.setSource(edgeLoader.source, properties)
331 }
332 }
333
334 // notify
335 page.bottomEdgeDismissed()
336
337 // load a new bottom page in memory
338 edgeLoader.active = true
339 }
340 }
341 }
342 },
343 Transition {
344 from: "floating"
345 to: "collapsed"
346 UbuntuNumberAnimation {
347 targets: [bottomEdge,tip]
348 properties: "y,opacity"
349 }
350 }
351 ]
352
353 Loader {
354 id: edgeLoader
355
356 z: 1
357 active: true
358 asynchronous: true
359 anchors.fill: parent
360
361 //WORKAROUND: The SDK move the page contents down to allocate space for the header we need to avoid that during the page dragging
362 Binding {
363 target: edgeLoader
364 property: "anchors.topMargin"
365 value: edgeLoader.item && edgeLoader.item.flickable ? edgeLoader.item.flickable.contentY : 0
366 when: (edgeLoader.status === Loader.Ready && !page.isReady)
367 }
368
369 onLoaded: {
370 if (page.isReady && edgeLoader.item.active != true) {
371 page._pushPage()
372 }
373 }
374 }
375 }
376}
0377
=== modified file 'src/app/qml/reminders.qml'
--- src/app/qml/reminders.qml 2014-08-06 09:44:18 +0000
+++ src/app/qml/reminders.qml 2014-09-03 16:57:24 +0000
@@ -207,6 +207,8 @@
207 page: NotesPage {207 page: NotesPage {
208 id: notesPage208 id: notesPage
209209
210 narrowMode: root.narrowMode
211
210 onEditNote: {212 onEditNote: {
211 root.switchToEditMode(note)213 root.switchToEditMode(note)
212 }214 }
@@ -236,11 +238,13 @@
236 page: NotebooksPage {238 page: NotebooksPage {
237 id: notebooksPage239 id: notebooksPage
238240
241 narrowMode: root.narrowMode
242
239 onOpenNotebook: {243 onOpenNotebook: {
240 var component = Qt.createComponent(Qt.resolvedUrl("ui/NotesPage.qml"))244 var component = Qt.createComponent(Qt.resolvedUrl("ui/NotesPage.qml"))
241 var page = component.createObject();245 var page = component.createObject();
242 print("opening note page for notebook", notebookGuid)246 print("opening note page for notebook", notebookGuid)
243 pagestack.push(page, {title: title, filter: notebookGuid});247 pagestack.push(page, {title: title, filter: notebookGuid, narrowMode: narrowMode});
244 page.selectedNoteChanged.connect(function() {248 page.selectedNoteChanged.connect(function() {
245 print("foo", page.selectedNote);249 print("foo", page.selectedNote);
246 if (page.selectedNote) {250 if (page.selectedNote) {
247251
=== modified file 'src/app/qml/ui/EditNotePage.qml'
--- src/app/qml/ui/EditNotePage.qml 2014-05-07 16:34:06 +0000
+++ src/app/qml/ui/EditNotePage.qml 2014-09-03 16:57:24 +0000
@@ -25,6 +25,7 @@
25Page {25Page {
26 id: root26 id: root
27 property alias note: editNoteView.note27 property alias note: editNoteView.note
28 property alias isBottomEdge: editNoteView.isBottomEdge
2829
29 signal exitEditMode(var note)30 signal exitEditMode(var note)
3031
3132
=== modified file 'src/app/qml/ui/EditNoteView.qml'
--- src/app/qml/ui/EditNoteView.qml 2014-07-14 13:40:24 +0000
+++ src/app/qml/ui/EditNoteView.qml 2014-09-03 16:57:24 +0000
@@ -26,6 +26,7 @@
26Item {26Item {
27 id: root27 id: root
28 property var note28 property var note
29 property bool isBottomEdge: false
2930
30 onNoteChanged: {31 onNoteChanged: {
31 for (var i = 0; i < notebookSelector.model.count; i++) {32 for (var i = 0; i < notebookSelector.model.count; i++) {
@@ -74,6 +75,7 @@
74 spacing: units.gu(1)75 spacing: units.gu(1)
7576
76 Row {77 Row {
78 visible: !root.isBottomEdge
77 anchors { left: parent.left; right: parent.right }79 anchors { left: parent.left; right: parent.right }
78 height: units.gu(5)80 height: units.gu(5)
79 spacing: units.gu(2)81 spacing: units.gu(2)
@@ -126,6 +128,7 @@
126 }128 }
127129
128 Divider {130 Divider {
131 visible: !root.isBottomEdge
129 anchors { leftMargin: -units.gu(2); rightMargin: -units.gu(2) }132 anchors { leftMargin: -units.gu(2); rightMargin: -units.gu(2) }
130 height: units.gu(2)133 height: units.gu(2)
131 }134 }
132135
=== modified file 'src/app/qml/ui/NotebooksPage.qml'
--- src/app/qml/ui/NotebooksPage.qml 2014-06-24 00:01:51 +0000
+++ src/app/qml/ui/NotebooksPage.qml 2014-09-03 16:57:24 +0000
@@ -26,7 +26,9 @@
26 id: root26 id: root
27 objectName: 'notebooksPage'27 objectName: 'notebooksPage'
2828
29 signal openNotebook(string title, string notebookGuid)29 property bool narrowMode
30
31 signal openNotebook(string title, string notebookGuid, bool narrowMode)
3032
31 onActiveChanged: {33 onActiveChanged: {
32 if (active) {34 if (active) {
@@ -135,7 +137,7 @@
135 delegate: NotebooksDelegate {137 delegate: NotebooksDelegate {
136 onClicked: {138 onClicked: {
137 print("selected notebook:", model.guid)139 print("selected notebook:", model.guid)
138 root.openNotebook(name, model.guid)140 root.openNotebook(name, model.guid, narrowMode)
139 }141 }
140 }142 }
141143
142144
=== modified file 'src/app/qml/ui/NotesPage.qml'
--- src/app/qml/ui/NotesPage.qml 2014-08-14 17:17:05 +0000
+++ src/app/qml/ui/NotesPage.qml 2014-09-03 16:57:24 +0000
@@ -23,13 +23,24 @@
23import Evernote 0.123import Evernote 0.1
24import "../components"24import "../components"
2525
26Page {26PageWithBottomEdge {
27 id: root27 id: root
2828
29 property var selectedNote: null29 property var selectedNote: null
30 property bool narrowMode
3031
31 property alias filter: notes.filterNotebookGuid32 property alias filter: notes.filterNotebookGuid
3233
34 // We enable bottomEdge only in narrowMode.
35 // To avoid flashing when a notebook is loaded, we wait to have all notes
36 // loaded, but only in notebook view (when a filter is set), not in notes
37 // page, because there isn't he flashing.
38 bottomEdgeLabelVisible: narrowMode && (!notes.filterNotebookGuid || !notes.loading)
39 bottomEdgeTitle: i18n.tr("Add note")
40 bottomEdgePageComponent: EditNotePage {
41 isBottomEdge: true;
42 }
43
33 signal openSearch()44 signal openSearch()
34 signal editNote(var note)45 signal editNote(var note)
3546
@@ -42,11 +53,12 @@
42 tools: ToolbarItems {53 tools: ToolbarItems {
43 ToolbarButton {54 ToolbarButton {
44 action: Action {55 action: Action {
56 visible: !narrowMode
45 text: i18n.tr("Add note")57 text: i18n.tr("Add note")
46 iconName: "add"58 iconName: "add"
47 onTriggered: {59 onTriggered: {
48 NotesStore.createNote(i18n.tr("Untitled"), filter);60 NotesStore.createNote(i18n.tr("Untitled"), filter);
49 } 61 }
50 }62 }
51 }63 }
5264
@@ -118,7 +130,7 @@
118 }130 }
119 }131 }
120 }132 }
121 }133 }
122134
123 Notes {135 Notes {
124 id: notes136 id: notes

Subscribers

People subscribed via source and target branches