2
* Copyright (C) 2014 Canonical, Ltd.
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.
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.
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/>.
18
import Ubuntu.Components 1.1
19
import Ubuntu.Components.Styles 1.1
22
* TODO: Once the SDK version of PullToRefreshStyle doesn't have bug 1375799
23
* (https://launchpad.net/bugs/1375799) anymore, we should switch to using a
24
* a subclass of the Ambiance version with a hidden ActivityIndicator.
27
releaseToRefresh: styledItem.target.originY - styledItem.target.contentY > activationThreshold
30
property bool willRefresh: false
32
target: styledItem.target
34
if (!styledItem.target.dragging && releaseToRefresh) {
39
if (styledItem.target.originY - styledItem.target.contentY == 0 && willRefresh) {
48
anchors.horizontalCenter: parent.horizontalCenter
49
horizontalAlignment: Text.AlignHCenter
50
verticalAlignment: Text.AlignVCenter
54
when: styledItem.target.dragging && !releaseToRefresh
55
PropertyChanges { target: pullLabel; text: i18n.tr("Pull to refresh…") }
59
when: styledItem.target.dragging && releaseToRefresh
60
PropertyChanges { target: pullLabel; text: i18n.tr("Release to refresh…") }
63
transitions: Transition {
65
UbuntuNumberAnimation {
74
UbuntuNumberAnimation {