~ubuntu-weather-dev/ubuntu-weather-app/reboot

« back to all changes in this revision

Viewing changes to app/components/PageWithBottomEdge.qml

  • Committer: Tarmac
  • Author(s): Andrew Hayzen
  • Date: 2015-11-26 03:07:11 UTC
  • mfrom: (153.1.13 weather-uc1.3)
  • Revision ID: tarmac-20151126030711-6mnc3xolq6g1ni81
* Update app to use the Ubuntu Components version 1.3. Fixes: https://bugs.launchpad.net/bugs/1508363.

Approved by Victor Thompson, Jenkins Bot, Bartosz Kosiorek, Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
*/
64
64
 
65
65
import QtQuick 2.4
66
 
import Ubuntu.Components 1.2
 
66
import Ubuntu.Components 1.3
67
67
 
68
68
Page {
69
69
    id: page
77
77
    property bool reloadBottomEdgePage: true
78
78
 
79
79
    readonly property alias bottomEdgePage: edgeLoader.item
80
 
    readonly property bool isReady: ((bottomEdge.y === fakeHeader.height) && bottomEdgePageLoaded && edgeLoader.item.active) // CUSTOM change to flag to allow for FakeHeader height
 
80
    // FIXME: 6.125 is the header.height
 
81
    readonly property bool isReady: ((bottomEdge.y === units.gu(6.125)) && bottomEdgePageLoaded && edgeLoader.item.active) // CUSTOM change to flag to allow for FakeHeader height
81
82
    readonly property bool isCollapsed: (bottomEdge.y === page.height)
82
83
    readonly property bool bottomEdgePageLoaded: (edgeLoader.status == Loader.Ready)
83
84
 
85
86
    property int _areaWhenExpanded: 0
86
87
 
87
88
    // CUSTOM properties to allow changing of color
88
 
    property alias tipColor: tip.color
 
89
    property alias tipColor: tip.backgroundColor  // CUSTOM color => backgroundColor
89
90
    property alias tipLabelColor: tipLabel.color
90
91
 
91
92
    signal bottomEdgeReleased()
108
109
            edgeLoader.item.active = true
109
110
            page.pageStack.push(edgeLoader.item)
110
111
            if (edgeLoader.item.flickable) {
111
 
                edgeLoader.item.flickable.contentY = -page.header.height
 
112
                edgeLoader.item.flickable.contentY = -units.gu(6.125)  // FIXME: 6.125 is the header.height
112
113
                edgeLoader.item.flickable.returnToBounds()
113
114
            }
114
115
            if (edgeLoader.item.ready)
180
181
        z: 1
181
182
        width: tipLabel.paintedWidth + units.gu(6)
182
183
        height: bottomEdge.tipHeight + units.gu(1)
183
 
        color: Theme.palette.normal.overlay
 
184
        backgroundColor: Theme.palette.normal.overlay  // CUSTOM color => backgroundColor
184
185
        Label {
185
186
            id: tipLabel
186
187
 
278
279
            left: parent.left
279
280
            right: parent.right
280
281
        }
281
 
        y: -fakeHeader.height + (fakeHeader.height * (page.height - bottomEdge.y)) / (page.height - fakeHeader.height)
 
282
        // FIXME: 6.125 is the header.height
 
283
        y: -units.gu(6.125) + (units.gu(6.125) * (page.height - bottomEdge.y)) / (page.height - units.gu(6.125))
282
284
        z: bgVisual.z + 1
283
285
 
284
286
        Behavior on y {
294
296
 
295
297
        readonly property int tipHeight: units.gu(3)
296
298
        // CUSTOM value
297
 
        readonly property int pageStartY: fakeHeader.height
 
299
        readonly property int pageStartY: units.gu(6.125)  // FIXME: 6.125 is the header.height
298
300
 
299
301
        z: 1
300
302
        color: Theme.palette.normal.background
318
320
                // CUSTOM
319
321
                PropertyChanges {
320
322
                    target: fakeHeader
321
 
                    y: -fakeHeader.height
 
323
                    y: -units.gu(6.125)  // FIXME: 6.125 is the header.height
322
324
                }
323
325
            },
324
326
            State {
366
368
                    SmoothedAnimation {
367
369
                        target: edgeLoader
368
370
                        property: "anchors.topMargin"
369
 
                        to: - units.gu(4)
 
371
                        // CUSTOM make small to reduce 'bump' when pushing
 
372
                        to: -0.1  // FIXME: 6.125 is header height
370
373
                        duration: UbuntuAnimation.FastDuration
371
374
                        easing.type: Easing.Linear
372
375
                    }
418
421
                                tip.forceActiveFocus()
419
422
                            }
420
423
 
 
424
                            // CUSTOM reset the topMargin for next pull
 
425
                            edgeLoader.anchors.topMargin = units.gu(6.125)
 
426
 
421
427
                            // notify
422
428
                            page.bottomEdgeDismissed()
423
429
 
441
447
            id: edgeLoader
442
448
 
443
449
            asynchronous: true
444
 
            anchors.fill: parent
 
450
            anchors {
 
451
                fill: parent
 
452
                topMargin: units.gu(6.125)  // CUSTOM
 
453
            }
445
454
            //WORKAROUND: The SDK move the page contents down to allocate space for the header we need to avoid that during the page dragging
 
455
            /*  // CUSTOM
446
456
            Binding {
447
457
                target: edgeLoader.status === Loader.Ready ? edgeLoader : null
448
458
                property: "anchors.topMargin"
449
459
                value:  edgeLoader.item && edgeLoader.item.flickable ? edgeLoader.item.flickable.contentY : 0
450
460
                when: !page.isReady
451
461
            }
 
462
            */
452
463
 
453
464
            onLoaded: {
454
465
                tip.forceActiveFocus()