diff options
Diffstat (limited to 'app/pages/ListPage.qml')
-rw-r--r-- | app/pages/ListPage.qml | 92 |
1 files changed, 78 insertions, 14 deletions
diff --git a/app/pages/ListPage.qml b/app/pages/ListPage.qml index f4b78da..c9116d4 100644 --- a/app/pages/ListPage.qml +++ b/app/pages/ListPage.qml @@ -35,6 +35,14 @@ Page { implicitHeight: 60 running: false } + BusyIndicator { + id: nextBusyIndicator + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + implicitWidth: 60 + implicitHeight: 60 + running: false + } StackView { id: stack @@ -58,21 +66,35 @@ Page { anchors.fill: parent Item { - Layout.preferredWidth: 100 - Layout.preferredHeight: 100 + Layout.preferredWidth: 80 + Layout.preferredHeight: 80 MouseArea{ anchors.fill: parent z: 2 - onClicked: { - stack.push("qrc:/pages/DetailPage.qml", {stack: stack, model: model}, StackView.Immediate) + onClicked: { + stack.push("qrc:/pages/DetailPage.qml", {stack: stack, model: model}, StackView.Immediate) } } + Image { + id: imageicon anchors.fill: parent - source: model.icon + source: model.icon != ""?model.icon : 'qrc:/images/blank.svg' + property string initial: model.name.substring(0,1).toUpperCase() + + Label { + style: Text.Outline + styleColor: "#00ADDC" + color: 'transparent' + font.pixelSize: parent.height * 0.5 + anchors.centerIn: parent + text: parent.initial + visible: model.icon == "" + } } } + ColumnLayout { Label { Layout.fillWidth: true @@ -96,9 +118,10 @@ Page { ColumnLayout { spacing: 5 Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - + Button { - x: x - 6 + anchors.right: parent.right + anchors.rightMargin: 6 text: model.statetext onClicked: { if (model.statetext === 'Install' || model.statetext === 'Update') { @@ -113,11 +136,10 @@ Page { } implicitWidth: 140 implicitHeight: 40 - //Layout.rightMargin: 5 } } - } + DownloadBar { anchors.fill: parent progress: model.progress @@ -134,12 +156,19 @@ Page { states: [ State { - name: "prevPageState"; when: listView.contentY < -nPullHeight + name: "prevPageState"; when: (prevBusyIndicator.running == false) && listView.contentY < -nPullHeight StateChangeScript { name: "prevPageScript" script: getPrevPage() } - } + }, + State { + name: "nextPageState"; when: appSize > 8 && (nextBusyIndicator.running == false) && (listView.contentHeight > 0) && (listView.contentY > (listView.contentHeight - listView.height + nPullHeight)) + StateChangeScript { + name: "nextPageScript" + script: getNextPage() + } + } ] } @@ -147,10 +176,18 @@ Page { listView.y = nPullHeight; currentPageIndex = currentPageIndex > 0 ? currentPageIndex-1 : 0; - prevBusyIndicator.running = true + prevBusyIndicator.running = true; prevPageTimer.start(); } + function getNextPage() { + listView.y = nPullHeight; + + currentPageIndex++; + nextBusyIndicator.running = true; + nextPageTimer.start(); + } + Timer { id: prevPageTimer interval: 1000 @@ -162,6 +199,16 @@ Page { } } + Timer { + id: nextPageTimer + interval: 1000 + repeat: false + running: false + onTriggered: { + listView.model.getNextPage(currentPageIndex) + nextPageAnimation.start(); + } + } NumberAnimation { id: prevPageAnimation target: listView @@ -171,16 +218,33 @@ Page { to: 0 onStopped: { prevBusyIndicator.running = false - listView.y = 0; + //listView.y = 0; } } + NumberAnimation { + id: nextPageAnimation + target: listView + property: "y" + duration: 100 + from: nPullHeight + to: 0 + onStopped: { + nextBusyIndicator.running = false + //listView.y = 0; + } + } Connections { target: listView.model onRequestCompleted: { appSize = appsize pageSize = pagesize - console.log("request completed!", appSize, pageSize) + console.log("request completed!", appSize, pageSize, currentPageIndex) + if(appSize == 0 && currentPageIndex > 0) { + listView.model.getPrevPage(--currentPageIndex) + }else{ + listView.y = 0; + } } } } |