[Merge] lp:~renatofilho/address-book-app/fix-bottom-edge-animations into lp:~phablet-team/address-book-app/staging

Gustavo Pichorim Boiko gustavo.boiko at canonical.com
Tue Sep 16 14:11:17 UTC 2014


Review: Needs Fixing



Diff comments:

> === modified file 'src/imports/Ubuntu/Contacts/PageWithBottomEdge.qml'
> --- src/imports/Ubuntu/Contacts/PageWithBottomEdge.qml	2014-07-30 22:09:12 +0000
> +++ src/imports/Ubuntu/Contacts/PageWithBottomEdge.qml	2014-09-15 13:09:04 +0000
> @@ -71,7 +71,7 @@
>      property alias bottomEdgePageComponent: edgeLoader.sourceComponent
>      property alias bottomEdgePageSource: edgeLoader.source
>      property alias bottomEdgeTitle: tipLabel.text
> -    property alias bottomEdgeEnabled: bottomEdge.visible
> +    property bool bottomEdgeEnabled: true
>      property int bottomEdgeExpandThreshold: page.height * 0.2
>      property int bottomEdgeExposedArea: bottomEdge.state !== "expanded" ? (page.height - bottomEdge.y - bottomEdge.tipHeight) : _areaWhenExpanded
>      property bool reloadBottomEdgePage: true
> @@ -142,13 +142,97 @@
>          z: 1
>      }
>  
> -    Timer {
> -        id: hideIndicator
> -
> -        interval: 3000
> -        running: true
> -        repeat: false
> -        onTriggered: tip.hiden = true
> +    UbuntuShape {
> +        id: tip
> +        objectName: "bottomEdgeTip"
> +
> +        property bool hiden: (activeFocus === false) || ((bottomEdge.y - units.gu(1)) < tip.y)

Typo here, 'hiden' should read 'hidden'

> +
> +        enabled: mouseArea.enabled
> +        anchors {
> +            bottom: parent.bottom
> +            horizontalCenter: bottomEdge.horizontalCenter
> +            bottomMargin: hiden ? - height + units.gu(1) : -units.gu(1)
> +            Behavior on bottomMargin {
> +                UbuntuNumberAnimation {
> +                    duration: UbuntuAnimation.SnapDuration
> +                }
> +            }
> +        }
> +
> +        z: 1
> +        width: tipLabel.paintedWidth + units.gu(6)
> +        height: bottomEdge.tipHeight + units.gu(1)
> +        color: Theme.palette.normal.overlay
> +        Label {
> +            id: tipLabel
> +
> +            anchors {
> +                top: parent.top
> +                left: parent.left
> +                right: parent.right
> +            }
> +            height: bottomEdge.tipHeight
> +            verticalAlignment: Text.AlignVCenter
> +            horizontalAlignment: Text.AlignHCenter
> +            opacity: tip.hiden ? 0.0 : 1.0
> +            Behavior on opacity {
> +                UbuntuNumberAnimation {
> +                    duration: UbuntuAnimation.SnapDuration
> +                }
> +            }
> +        }
> +    }
> +
> +    Rectangle {
> +        id: shadow
> +
> +        anchors {
> +            left: parent.left
> +            right: parent.right
> +            bottom: parent.bottom
> +        }
> +        height: units.gu(1)
> +        z: 1
> +        opacity: 0.0
> +        gradient: Gradient {
> +            GradientStop { position: 0.0; color: "transparent" }
> +            GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, 0.2) }
> +        }
> +    }
> +
> +    MouseArea {
> +        id: mouseArea
> +
> +        preventStealing: true
> +        drag {
> +            axis: Drag.YAxis
> +            target: bottomEdge
> +            minimumY: bottomEdge.pageStartY
> +            maximumY: page.height
> +        }
> +        enabled: edgeLoader.status == Loader.Ready
> +
> +        anchors {
> +            left: parent.left
> +            right: parent.right
> +            bottom: parent.bottom
> +
> +        }
> +        height: bottomEdge.tipHeight
> +        z: 1
> +
> +        onReleased: {
> +            page.bottomEdgeReleased()
> +            if (bottomEdge.y < (page.height - bottomEdgeExpandThreshold - bottomEdge.tipHeight)) {
> +                bottomEdge.state = "expanded"
> +            } else {
> +                bottomEdge.state = "collapsed"
> +                bottomEdge.y = bottomEdge.height
> +            }
> +        }
> +
> +        onPressed: tip.forceActiveFocus()
>      }
>  
>      Rectangle {
> @@ -160,107 +244,14 @@
>  
>          z: 1
>          color: Theme.palette.normal.background
> -        parent: page
> +        clip: true
>          anchors {
>              left: parent.left
>              right: parent.right
>          }
>          height: page.height
>          y: height
> -
> -        UbuntuShape {
> -            id: tip
> -            objectName: "bottomEdgeTip"
> -
> -            property bool hiden: false
> -
> -            readonly property double visiblePosition: (page.height - bottomEdge.y) < units.gu(1) ? -bottomEdge.tipHeight + (page.height - bottomEdge.y) : 0
> -            readonly property double invisiblePosition: (page.height - bottomEdge.y) < units.gu(1) ? -units.gu(1) : 0
> -
> -            z: -1
> -            anchors.horizontalCenter: parent.horizontalCenter
> -            y: hiden ? invisiblePosition : visiblePosition
> -
> -            width: tipLabel.paintedWidth + units.gu(6)
> -            height: bottomEdge.tipHeight + units.gu(1)
> -            color: Theme.palette.normal.overlay
> -            Label {
> -                id: tipLabel
> -
> -                anchors {
> -                    top: parent.top
> -                    left: parent.left
> -                    right: parent.right
> -                }
> -                height: bottomEdge.tipHeight
> -                verticalAlignment: Text.AlignVCenter
> -                horizontalAlignment: Text.AlignHCenter
> -                opacity: tip.hiden ? 0.0 : 1.0
> -                Behavior on opacity {
> -                    UbuntuNumberAnimation {
> -                        duration: UbuntuAnimation.SnapDuration
> -                    }
> -                }
> -            }
> -            Behavior on y {
> -                UbuntuNumberAnimation {
> -                    duration: UbuntuAnimation.SnapDuration
> -                }
> -            }
> -        }
> -
> -        Rectangle {
> -            id: shadow
> -
> -            anchors {
> -                left: parent.left
> -                right: parent.right
> -            }
> -            height: units.gu(1)
> -            y: -height
> -            z: -2
> -            opacity: 0.0
> -            gradient: Gradient {
> -                GradientStop { position: 0.0; color: "transparent" }
> -                GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, 0.2) }
> -            }
> -        }
> -
> -        MouseArea {
> -            id: mouseArea
> -
> -            preventStealing: true
> -            drag {
> -                axis: Drag.YAxis
> -                target: bottomEdge
> -                minimumY: bottomEdge.pageStartY
> -                maximumY: page.height
> -                threshold: 100
> -            }
> -
> -            anchors {
> -                left: parent.left
> -                right: parent.right
> -            }
> -            height: bottomEdge.tipHeight
> -            y: -height
> -
> -            onReleased: {
> -                page.bottomEdgeReleased()
> -                if (bottomEdge.y < (page.height - bottomEdgeExpandThreshold - bottomEdge.tipHeight)) {
> -                    bottomEdge.state = "expanded"
> -                } else {
> -                    bottomEdge.state = "collapsed"
> -                    bottomEdge.y = bottomEdge.height
> -                }
> -            }
> -
> -            onClicked: {
> -                tip.hiden = false
> -                hideIndicator.restart()
> -            }
> -        }
> -
> +        visible: page.bottomEdgeEnabled && !page.isCollapsed
>          state: "collapsed"
>          states: [
>              State {
> @@ -273,10 +264,6 @@
>                      target: tip
>                      opacity: 1.0
>                  }
> -                PropertyChanges {
> -                    target: hideIndicator
> -                    running: true
> -                }
>              },
>              State {
>                  name: "expanded"
> @@ -284,10 +271,6 @@
>                      target: bottomEdge
>                      y: bottomEdge.pageStartY
>                  }
> -                PropertyChanges {
> -                    target: hideIndicator
> -                    running: false
> -                }
>              },
>              State {
>                  name: "floating"
> @@ -296,14 +279,6 @@
>                      target: shadow
>                      opacity: 1.0
>                  }
> -                PropertyChanges {
> -                    target: hideIndicator
> -                    running: false
> -                }
> -                PropertyChanges {
> -                    target: tip
> -                    hiden: false
> -                }
>              }
>          ]
>  
> @@ -311,10 +286,27 @@
>              Transition {
>                  to: "expanded"
>                  SequentialAnimation {
> -                    UbuntuNumberAnimation {
> +                    alwaysRunToEnd: true
> +
> +                    SmoothedAnimation {
>                          target: bottomEdge
>                          property: "y"
> -                        duration: UbuntuAnimation.SlowDuration
> +                        duration: UbuntuAnimation.FastDuration
> +                        easing.type: Easing.Linear
> +                    }
> +                    SmoothedAnimation {
> +                        target: edgeLoader
> +                        property: "anchors.topMargin"
> +                        to: - units.gu(4)
> +                        duration: UbuntuAnimation.FastDuration
> +                        easing.type: Easing.Linear
> +                    }
> +                    SmoothedAnimation {
> +                        target: edgeLoader
> +                        property: "anchors.topMargin"
> +                        to: 0
> +                        duration: UbuntuAnimation.FastDuration
> +                        easing: UbuntuAnimation.StandardEasing
>                      }
>                      ScriptAction {
>                          script: page._pushPage()
> @@ -325,6 +317,8 @@
>                  from: "expanded"
>                  to: "collapsed"
>                  SequentialAnimation {
> +                    alwaysRunToEnd: true
> +
>                      ScriptAction {
>                          script: {
>                              Qt.inputMethod.hide()
> @@ -333,7 +327,7 @@
>                              edgeLoader.item.active = false
>                          }
>                      }
> -                    UbuntuNumberAnimation {
> +                    SmoothedAnimation {
>                          target: bottomEdge
>                          property: "y"
>                          duration: UbuntuAnimation.SlowDuration
> @@ -343,14 +337,15 @@
>                              // destroy current bottom page
>                              if (page.reloadBottomEdgePage) {
>                                  edgeLoader.active = false
> +                                // tip will receive focus on page active true
> +                            } else {
> +                                tip.forceActiveFocus()
>                              }
>  
>                              // notify
>                              page.bottomEdgeDismissed()
>  
>                              edgeLoader.active = true
> -                            tip.hiden = false
> -                            hideIndicator.restart()
>                          }
>                      }
>                  }
> @@ -365,30 +360,23 @@
>              }
>          ]
>  
> -        Item {
> +        Loader {
> +            id: edgeLoader
> +
> +            asynchronous: true
>              anchors.fill: parent
> -            clip: true
> -
> -            Loader {
> -                id: edgeLoader
> -
> -                z: 1
> -                active: true
> -                asynchronous: true
> -                anchors.fill: parent
> -
> -                //WORKAROUND: The SDK move the page contents down to allocate space for the header we need to avoid that during the page dragging
> -                Binding {
> -                    target: edgeLoader.status === Loader.Ready ? edgeLoader : null
> -                    property: "anchors.topMargin"
> -                    value:  edgeLoader.item && edgeLoader.item.flickable ? edgeLoader.item.flickable.contentY : 0
> -                    when: !page.isReady
> -                }
> -
> -                onLoaded: {
> -                    if (page.isReady && edgeLoader.item.active !== true) {
> -                        page._pushPage()
> -                    }
> +            //WORKAROUND: The SDK move the page contents down to allocate space for the header we need to avoid that during the page dragging
> +            Binding {
> +                target: edgeLoader.status === Loader.Ready ? edgeLoader : null
> +                property: "anchors.topMargin"
> +                value:  edgeLoader.item && edgeLoader.item.flickable ? edgeLoader.item.flickable.contentY : 0
> +                when: !page.isReady
> +            }
> +
> +            onLoaded: {
> +                tip.forceActiveFocus()
> +                if (page.isReady && edgeLoader.item.active !== true) {
> +                    page._pushPage()
>                  }
>              }
>          }
> 
> === modified file 'tests/autopilot/address_book_app/pages/_common.py'
> --- tests/autopilot/address_book_app/pages/_common.py	2014-08-05 19:02:51 +0000
> +++ tests/autopilot/address_book_app/pages/_common.py	2014-09-15 13:09:04 +0000
> @@ -39,6 +39,7 @@
>          """Bring the bottom edge page to the screen"""
>          try:
>              action_item = self.wait_select_single(objectName='bottomEdgeTip')
> +            action_item.enabled.wait_for(True)
>              start_x = (action_item.globalRect.x +
>                         (action_item.globalRect.width * 0.5))
>              start_y = action_item.globalRect.y + (action_item.height * 0.2)
> 


-- 
https://code.launchpad.net/~renatofilho/address-book-app/fix-bottom-edge-animations/+merge/232925
Your team Ubuntu Phablet Team is subscribed to branch lp:~phablet-team/address-book-app/staging.



More information about the Ubuntu-reviews mailing list