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/>.
18import Lomiri.Components 1.3
19import Lomiri.Components.Styles 1.3
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
51 color: styledItem.pullLabelColor
55 when: styledItem.target.dragging && !releaseToRefresh
56 PropertyChanges { target: pullLabel; text: i18n.tr("Pull to refresh…") }
60 when: styledItem.target.dragging && releaseToRefresh
61 PropertyChanges { target: pullLabel; text: i18n.tr("Release to refresh…") }
64 transitions: Transition {
66 LomiriNumberAnimation {
75 LomiriNumberAnimation {