Merge lp:~martin-borho/ubuntu-weather-app/hourly-fix-and-haptics into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Martin Borho
Status: Merged
Approved by: Raúl Yeguas
Approved revision: 186
Merged at revision: 186
Proposed branch: lp:~martin-borho/ubuntu-weather-app/hourly-fix-and-haptics
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 69 lines (+17/-3)
2 files modified
components/CurrentWeather.qml (+8/-3)
components/LocationTab.qml (+9/-0)
To merge this branch: bzr merge lp:~martin-borho/ubuntu-weather-app/hourly-fix-and-haptics
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Raúl Yeguas Approve
Review via email: mp+205244@code.launchpad.net

Commit message

Optimized and added haptic effect to hourly scrolling

Description of the change

Optimized and added haptic effect to hourly scrolling

To post a comment you must log in.
Revision history for this message
Raúl Yeguas (neokore) wrote :

Feels good for me! Well done!

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components/CurrentWeather.qml'
2--- components/CurrentWeather.qml 2014-01-27 14:56:23 +0000
3+++ components/CurrentWeather.qml 2014-02-06 18:45:53 +0000
4@@ -61,6 +61,7 @@
5 property int startY: 0
6 property double startTime: 0
7 property int sectionHeight: parent.height/hourly.count
8+ property int lastIndex: -1
9 // without tab header!
10 height: parent.height-units.gu(9.5)
11 width:parent.width
12@@ -99,8 +100,9 @@
13 // slow scrolling detected
14 var movement = Math.round(distance/sectionHeight);
15 if(movement > 0) {
16- var hourIndex = movement-1;
17- if(currentWeather.hourly.get(hourIndex) !== undefined) {
18+ var hourIndex = movement-1,
19+ currentHour = currentWeather.hourly.get(hourIndex);
20+ if( currentHour !== undefined && (lastIndex < 0 || lastIndex !== hourIndex)) {
21 wasHourlyScrolled = true;
22 currentConditionIcon.condition = currentWeather.hourly.get(hourIndex).icon;
23 var temp = currentWeather.hourly.get(hourIndex)[mainView.settings["units"]].temp;
24@@ -111,7 +113,9 @@
25 // TRANSLATORS: this is a date to which a time of the day will be appended
26 var dateTimeString = Qt.formatDateTime(dateTime, i18n.tr('dddd, dd MMMM')) + ' - ' + Qt.formatTime(dateTime);
27 dateComponent.dateString = dateTimeString;
28- dateComponent.renderText();
29+ dateComponent.renderText();
30+ hourlyScrollEffect.start();
31+ lastIndex = hourIndex;
32 }
33 }
34 }
35@@ -126,6 +130,7 @@
36 adjustBackground(Math.round(currentDayData.temp));
37 dateComponent.dateString = currentDayData.date;
38 dateComponent.renderText();
39+ lastIndex = -1;
40 }
41 }
42 }
43
44=== modified file 'components/LocationTab.qml'
45--- components/LocationTab.qml 2014-01-24 19:32:20 +0000
46+++ components/LocationTab.qml 2014-02-06 18:45:53 +0000
47@@ -19,6 +19,7 @@
48 import QtQuick 2.0
49 import Ubuntu.Components.Popups 0.1
50 import Ubuntu.Components 0.1
51+import QtFeedback 5.0
52
53 Tab {
54 id: locationTab
55@@ -86,6 +87,14 @@
56 }
57 }
58
59+ HapticsEffect {
60+ id: hourlyScrollEffect
61+ attackTime: 1
62+ intensity: 0.2
63+ duration: 5
64+ fadeTime: 1
65+ }
66+
67 // Menu for options
68 page: Page {
69 id: locationPage

Subscribers

People subscribed via source and target branches