← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

Andrew Hayzen has proposed merging lp:~ahayzen/ubuntu-weather-app/fix-1496425-offscreen-last-expandable into lp:ubuntu-weather-app/reboot.

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

Requested reviews:
  Ubuntu Weather Developers (ubuntu-weather-dev)
Related bugs:
  Bug #1496425 in Ubuntu Weather App: "[reboot] On the main page if you scroll to the last day in the list and tap on it there is no indication there is more info"
  https://bugs.launchpad.net/ubuntu-weather-app/+bug/1496425

For more details, see:
https://code.launchpad.net/~ahayzen/ubuntu-weather-app/fix-1496425-offscreen-last-expandable/+merge/273741

* 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
-- 
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~ahayzen/ubuntu-weather-app/fix-1496425-offscreen-last-expandable into lp:ubuntu-weather-app/reboot.
=== modified file 'app/components/DayDelegate.qml'
--- app/components/DayDelegate.qml	2015-08-26 20:35:22 +0000
+++ app/components/DayDelegate.qml	2015-10-07 18:59:01 +0000
@@ -72,6 +72,9 @@
                     easing.type: Easing.InOutQuad
                     properties: "opacity"
                 }
+                ScriptAction {  // run animation to ensure the listitem fits
+                    script: waitEnsureVisible.restart()
+                }
             }
         },
         Transition {
@@ -180,10 +183,50 @@
 
     Behavior on height {
         NumberAnimation {
+            id: heightAnimation
             easing.type: Easing.InOutQuad
         }
     }
 
+    NumberAnimation {
+        // animation to ensure the listitem fits by moving the contentY
+        id: ensureVisibleAnimation
+        easing.type: Easing.InOutQuad
+        properties: "contentY"
+        target: dayDelegate.parent.parent
+    }
+
+    Timer {
+        id: waitEnsureVisible
+        interval: 16
+        repeat: false
+
+        onTriggered: {
+            // Only trigger once the loader has loaded
+            // and the animations have stopped
+            // otherwise restart the timer
+            if (expandedInfo.active && expandedInfo.status === Loader.Ready
+                    && !heightAnimation.running) {
+                // stop the current animation
+                ensureVisibleAnimation.running = false;
+
+                // Get the current position
+                var view = dayDelegate.parent.parent;
+                var pos = view.contentY;
+
+                // Tell the listview to make the listitem fit
+                view.positionViewAtIndex(index, ListView.Contain);
+
+                // Animate from the original position to the new position
+                ensureVisibleAnimation.from = pos;
+                ensureVisibleAnimation.to = view.contentY;
+                ensureVisibleAnimation.running = true;
+            } else {
+                restart()
+            }
+        }
+    }
+
     Component.onCompleted: {
         locationPages.collapseOtherDelegates.connect(function(otherIndex) {
             if (dayDelegate && typeof index !== "undefined" && otherIndex !== index) {

=== modified file 'debian/changelog'
--- debian/changelog	2015-09-29 16:19:55 +0000
+++ debian/changelog	2015-10-07 18:59:01 +0000
@@ -48,6 +48,7 @@
   * Add LocationPane helper to the autopilot tests
   * Various tidy ups to improve readability and code commentary of autopilot code
   * ListItem transparent and PageWithBottomEdge colour correct so that they don't appear white on the LocationsPage
+  * When expanding day delegates ensure that extra info is visible by animating it into view (LP: #1496425)
 
   [ Carla Sella ]
   * Create autopilot test which shows the day delegate (LP: #1452491)

=== modified file 'po/com.ubuntu.weather.pot'
--- po/com.ubuntu.weather.pot	2015-09-29 16:18:17 +0000
+++ po/com.ubuntu.weather.pot	2015-10-07 18:59:01 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: ubuntu-weather-app\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-09-29 17:15+0100\n"
+"POT-Creation-Date: 2015-10-07 19:53+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@xxxxxx>\n"


Follow ups