~renatofilho/ubuntu-calendar-app/optimize

« back to all changes in this revision

Viewing changes to NewEvent.qml

  • Committer: Renato Araujo Oliveira Filho
  • Date: 2016-02-03 19:57:51 UTC
  • Revision ID: renato.filho@canonical.com-20160203195751-2cekzhykqn6d9aar
Improve animation when keyboard appears.

Show diffs side-by-side

added added

removed removed

Lines of Context:
401
401
            flickable.returnToBounds()
402
402
        }
403
403
 
404
 
        anchors {
405
 
            fill: parent
406
 
            topMargin: header.height
 
404
        flickableDirection: Flickable.VerticalFlick
 
405
        anchors{
 
406
            left: parent.left
 
407
            top: parent.top
 
408
            topMargin: pageHeader.height
 
409
            right: parent.right
 
410
            bottom: keyboardRectangle.top
407
411
        }
408
412
        contentWidth: width
409
 
        contentHeight: column.height + units.gu(10)
 
413
        contentHeight: column.height
410
414
 
411
415
        Column {
412
416
            id: column
549
553
                            width: height
550
554
                            height: parent.height - units.gu(2)
551
555
                            color: modelData.color
552
 
                            anchors.right: parent.right
553
 
                            anchors.rightMargin: units.gu(2)
554
 
                            anchors.verticalCenter: parent.verticalCenter
 
556
                            anchors {
 
557
                                right: parent.right
 
558
                                rightMargin: units.gu(4)
 
559
                                verticalCenter: parent.verticalCenter
 
560
                            }
555
561
                        }
556
562
                    }
557
563
                    onExpandedChanged: Qt.inputMethod.hide();
581
587
 
582
588
                    // WORKAROUND: causes the popover to follow the buttom position when keyboard appears
583
589
                    Connections {
584
 
                        target: keyboard
 
590
                        target: keyboardRectangle
585
591
                        onHeightChanged: {
586
592
                            if (addGuestButton.contactsPopup) {
587
593
                                addGuestButton.contactsPopup.caller = null
719
725
            ListItems.ThinDivider {}
720
726
        }
721
727
    }
 
728
 
722
729
    // used to keep the field visible when the keyboard appear or dismiss
723
730
    KeyboardRectangle {
724
 
        id: keyboard
725
 
 
726
 
        onHeightChanged: {
727
 
            if (flickable.activeItem) {
728
 
                flickable.makeMeVisible(flickable.activeItem)
 
731
        id: keyboardRectangle
 
732
 
 
733
        anchors {
 
734
            left: parent.left
 
735
            right: parent.right
 
736
            bottom: parent.bottom
 
737
        }
 
738
 
 
739
        Behavior on height {
 
740
            SequentialAnimation {
 
741
                PauseAnimation { duration: 200 }
 
742
                ScriptAction {
 
743
                    script: flickable.makeMeVisible(flickable.activeItem)
 
744
                }
729
745
            }
730
746
        }
731
747
    }