Merge lp:~ahayzen/ubuntu-weather-app/fix-1496425-offscreen-last-expandable into lp:ubuntu-weather-app

Proposed by Andrew Hayzen on 2015-10-07
Status: Merged
Approved by: Andrew Hayzen on 2015-10-09
Approved revision: 133
Merged at revision: 133
Proposed branch: lp:~ahayzen/ubuntu-weather-app/fix-1496425-offscreen-last-expandable
Merge into: lp:ubuntu-weather-app
Diff against target: 89 lines (+45/-1)
3 files modified
app/components/DayDelegate.qml (+43/-0)
debian/changelog (+1/-0)
po/com.ubuntu.weather.pot (+1/-1)
To merge this branch: bzr merge lp:~ahayzen/ubuntu-weather-app/fix-1496425-offscreen-last-expandable
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-10-09
Victor Thompson 2015-10-07 Approve on 2015-10-09
Review via email: mp+273741@code.launchpad.net

Commit message

* When expanding day delegates ensure that extra info is visible by animating it into view

Description of the change

* When expanding day delegates ensure that extra info is visible by animating it into view

If this MP is approved first the animation code should be copied to the today info expandable in the other MP [0] and if that MP is done first then it should be updated here.

0 - https://code.launchpad.net/~ahayzen/ubuntu-weather-app/fix-1496422-1478255-today-extra-info/+merge/272790

To post a comment you must log in.
Victor Thompson (vthompson) wrote :

We should be able to easily make a test for this. This looks good to me, but eventually we should make a test for this.

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/components/DayDelegate.qml'
2--- app/components/DayDelegate.qml 2015-08-26 20:35:22 +0000
3+++ app/components/DayDelegate.qml 2015-10-07 18:59:01 +0000
4@@ -72,6 +72,9 @@
5 easing.type: Easing.InOutQuad
6 properties: "opacity"
7 }
8+ ScriptAction { // run animation to ensure the listitem fits
9+ script: waitEnsureVisible.restart()
10+ }
11 }
12 },
13 Transition {
14@@ -180,10 +183,50 @@
15
16 Behavior on height {
17 NumberAnimation {
18+ id: heightAnimation
19 easing.type: Easing.InOutQuad
20 }
21 }
22
23+ NumberAnimation {
24+ // animation to ensure the listitem fits by moving the contentY
25+ id: ensureVisibleAnimation
26+ easing.type: Easing.InOutQuad
27+ properties: "contentY"
28+ target: dayDelegate.parent.parent
29+ }
30+
31+ Timer {
32+ id: waitEnsureVisible
33+ interval: 16
34+ repeat: false
35+
36+ onTriggered: {
37+ // Only trigger once the loader has loaded
38+ // and the animations have stopped
39+ // otherwise restart the timer
40+ if (expandedInfo.active && expandedInfo.status === Loader.Ready
41+ && !heightAnimation.running) {
42+ // stop the current animation
43+ ensureVisibleAnimation.running = false;
44+
45+ // Get the current position
46+ var view = dayDelegate.parent.parent;
47+ var pos = view.contentY;
48+
49+ // Tell the listview to make the listitem fit
50+ view.positionViewAtIndex(index, ListView.Contain);
51+
52+ // Animate from the original position to the new position
53+ ensureVisibleAnimation.from = pos;
54+ ensureVisibleAnimation.to = view.contentY;
55+ ensureVisibleAnimation.running = true;
56+ } else {
57+ restart()
58+ }
59+ }
60+ }
61+
62 Component.onCompleted: {
63 locationPages.collapseOtherDelegates.connect(function(otherIndex) {
64 if (dayDelegate && typeof index !== "undefined" && otherIndex !== index) {
65
66=== modified file 'debian/changelog'
67--- debian/changelog 2015-09-29 16:19:55 +0000
68+++ debian/changelog 2015-10-07 18:59:01 +0000
69@@ -48,6 +48,7 @@
70 * Add LocationPane helper to the autopilot tests
71 * Various tidy ups to improve readability and code commentary of autopilot code
72 * ListItem transparent and PageWithBottomEdge colour correct so that they don't appear white on the LocationsPage
73+ * When expanding day delegates ensure that extra info is visible by animating it into view (LP: #1496425)
74
75 [ Carla Sella ]
76 * Create autopilot test which shows the day delegate (LP: #1452491)
77
78=== modified file 'po/com.ubuntu.weather.pot'
79--- po/com.ubuntu.weather.pot 2015-09-29 16:18:17 +0000
80+++ po/com.ubuntu.weather.pot 2015-10-07 18:59:01 +0000
81@@ -8,7 +8,7 @@
82 msgstr ""
83 "Project-Id-Version: ubuntu-weather-app\n"
84 "Report-Msgid-Bugs-To: \n"
85-"POT-Creation-Date: 2015-09-29 17:15+0100\n"
86+"POT-Creation-Date: 2015-10-07 19:53+0100\n"
87 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
88 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
89 "Language-Team: LANGUAGE <LL@li.org>\n"

Subscribers

People subscribed via source and target branches

to all changes: