Merge lp:~pkunal-parmar/ubuntu-calendar-app/day_weekview_animation into lp:ubuntu-calendar-app

Proposed by Kunal Parmar
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 118
Merged at revision: 119
Proposed branch: lp:~pkunal-parmar/ubuntu-calendar-app/day_weekview_animation
Merge into: lp:ubuntu-calendar-app
Diff against target: 660 lines (+306/-191)
10 files modified
DayView.qml (+69/-42)
HeaderDateComponent.qml (+36/-0)
MonthView.qml (+5/-10)
PathViewBase.qml (+14/-0)
TimeLineBaseComponent.qml (+7/-15)
TimeLineHeader.qml (+56/-102)
TimeLineHeaderComponent.qml (+57/-0)
ViewHeader.qml (+30/-0)
WeekView.qml (+26/-14)
YearView.qml (+6/-8)
To merge this branch: bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/day_weekview_animation
Reviewer Review Type Date Requested Status
Olivier Tilloy (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+185813@code.launchpad.net

Commit message

DayView and WeekView header transition

Description of the change

DayView and WeekView header transition

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
117. By Kunal Parmar

dayview header changed

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
118. By Kunal Parmar

Day format for Dayview corrected

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

This seems to work well, nice job!

I’d like design to comment on this implementation (I personally feel that the header not moving in sync with the swipe gesture is awkward), but I guess the best way to do this is to have it merged and released for them to play with it.

review: Approve
Revision history for this message
Olivier Tilloy (osomon) wrote :

Another point that I’d like design to comment on: I feel like swiping on the header to scroll days/weeks should be allowed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DayView.qml'
2--- DayView.qml 2013-09-04 12:59:33 +0000
3+++ DayView.qml 2013-09-17 13:14:51 +0000
4@@ -12,53 +12,80 @@
5
6 property var currentDay: new Date()
7
8- PathViewBase{
9- id: dayViewPath
10- objectName: "DayViewPathBase"
11-
12- property var startDay: currentDay.addDays(-1)
13-
14+ Column {
15+ id: column
16 anchors.top: parent.top
17 anchors.topMargin: units.gu(1.5)
18-
19- width: parent.width
20- height: parent.height - units.gu(3)
21-
22- onNextItemHighlighted: {
23- //next day
24- currentDay = currentDay.addDays(1);
25- }
26-
27- onPreviousItemHighlighted: {
28- //previous day
29- currentDay = currentDay.addDays(-1);
30- }
31-
32- delegate: TimeLineBaseComponent {
33- id: timeLineView
34- objectName: "DayComponent-"+index
35-
36+ width: parent.width; height: parent.height
37+
38+ ViewHeader{
39+ id: viewHeader
40+ date: currentDay
41+ }
42+
43+ TimeLineHeader{
44+ id: dayHeader
45 type: typeDay
46+ date: currentDay
47+ preferredHighlightBegin: 0.5
48+ preferredHighlightEnd: 0.5
49+ path: Path {
50+ startX: -(dayHeader.width/7); startY: dayHeader.height/2
51+ PathLine { x: (dayHeader.width/7) * 8 ; relativeY: 0; }
52+ }
53+ }
54+
55+ PathViewBase{
56+ id: dayViewPath
57+ objectName: "DayViewPathBase"
58+
59+ property var startDay: currentDay
60+
61+ preferredHighlightBegin: 0.5
62+ preferredHighlightEnd: 0.5
63
64 width: parent.width
65- height: parent.height
66-
67- startDay: getStartDay().addDays(-1);
68-
69- function getStartDay() {
70- //previous page
71- if (index === dayViewPath.currentIndex) {
72- return dayViewPath.startDay;
73- }
74-
75- //next page
76- var previousIndex = dayViewPath.currentIndex > 0 ? dayViewPath.currentIndex - 1 : 2
77- if ( index === previousIndex ) {
78- return dayViewPath.startDay.addDays(2);
79- }
80-
81- //current page
82- return dayViewPath.startDay.addDays(1);
83+ height: column.height - viewHeader.height - dayHeader.height
84+
85+ path: Path {
86+ startX: -(dayViewPath.width/1.75); startY: dayViewPath.height/2
87+ PathLine { x: (dayViewPath.width/7) * 11 ; relativeY: 0; }
88+ }
89+
90+ onNextItemHighlighted: {
91+ //next day
92+ currentDay = currentDay.addDays(1);
93+ dayHeader.incrementCurrentIndex()
94+ }
95+
96+ onPreviousItemHighlighted: {
97+ //previous day
98+ currentDay = currentDay.addDays(-1);
99+ dayHeader.decrementCurrentIndex()
100+ }
101+
102+ delegate: TimeLineBaseComponent {
103+ id: timeLineView
104+ objectName: "DayComponent-"+index
105+
106+ type: typeDay
107+
108+ width: parent.width/7 * 5
109+ height: parent.height
110+ z: index == dayViewPath.currentIndex ? 2 : 1
111+
112+ startDay: getStartDay()
113+
114+ function getStartDay() {
115+ switch( dayViewPath.indexType(index)) {
116+ case 0:
117+ return dayViewPath.startDay;
118+ case -1:
119+ return dayViewPath.startDay.addDays(-1);
120+ case 1:
121+ return dayViewPath.startDay.addDays(1);
122+ }
123+ }
124 }
125 }
126 }
127
128=== added file 'HeaderDateComponent.qml'
129--- HeaderDateComponent.qml 1970-01-01 00:00:00 +0000
130+++ HeaderDateComponent.qml 2013-09-17 13:14:51 +0000
131@@ -0,0 +1,36 @@
132+import QtQuick 2.0
133+import Ubuntu.Components 0.1
134+
135+Column{
136+ id: root
137+
138+ property var date;
139+
140+ property alias dateColor: dateLabel.color
141+ property alias dayColor: dayLabel.color
142+
143+ property int dayFormat: Locale.ShortFormat;
144+
145+ anchors.verticalCenter: parent.verticalCenter
146+
147+ width: parent.width
148+ spacing: units.gu(0.5)
149+
150+ Label{
151+ id: dayLabel
152+ property var day: Qt.locale().standaloneDayName(date.getDay(), dayFormat)
153+ text: day.toUpperCase();
154+ fontSize: "medium"
155+ horizontalAlignment: Text.AlignHCenter
156+ color: "#AEA79F"
157+ width: parent.width
158+ }
159+
160+ Label{
161+ id: dateLabel
162+ text: date.getDate();
163+ fontSize: "large"
164+ horizontalAlignment: Text.AlignHCenter
165+ width: parent.width
166+ }
167+}
168
169=== modified file 'MonthView.qml'
170--- MonthView.qml 2013-09-02 14:34:29 +0000
171+++ MonthView.qml 2013-09-17 13:14:51 +0000
172@@ -49,19 +49,14 @@
173 monthDate: getMonthDate();
174
175 function getMonthDate() {
176- //previous page
177- if (index === monthViewPath.currentIndex) {
178+ switch( monthViewPath.indexType(index)) {
179+ case 0:
180 return monthViewPath.startMonth;
181- }
182-
183- //next page
184- var previousIndex = monthViewPath.currentIndex > 0 ? monthViewPath.currentIndex - 1 : 2
185- if ( index === previousIndex ) {
186+ case -1:
187 return monthViewPath.addMonth(monthViewPath.startMonth,2);
188+ case 1:
189+ return monthViewPath.addMonth(monthViewPath.startMonth,1);
190 }
191-
192- //current page
193- return monthViewPath.addMonth(monthViewPath.startMonth,1);
194 }
195
196 onDateSelected: {
197
198=== modified file 'PathViewBase.qml'
199--- PathViewBase.qml 2013-08-10 06:03:17 +0000
200+++ PathViewBase.qml 2013-09-17 13:14:51 +0000
201@@ -16,6 +16,20 @@
202 PathLine { relativeX: root.width; relativeY: 0 }
203 }
204
205+ // 0= current index, -1= previous index, 1 next index
206+ function indexType(index) {
207+ if (index === root.currentIndex) {
208+ return 0;
209+ }
210+
211+ var previousIndex = root.currentIndex > 0 ? root.currentIndex - 1 : 2
212+ if ( index === previousIndex ) {
213+ return -1;
214+ }
215+
216+ return 1;
217+ }
218+
219 onCurrentIndexChanged: {
220 var diff = currentIndex - intern.previousIndex
221
222
223=== modified file 'TimeLineBaseComponent.qml'
224--- TimeLineBaseComponent.qml 2013-09-04 13:37:10 +0000
225+++ TimeLineBaseComponent.qml 2013-09-17 13:14:51 +0000
226@@ -22,19 +22,12 @@
227 timeLineView.scroll()
228 }
229
230- TimeLineHeader{
231- id: header
232- type: root.type
233- anchors.top: parent.top
234- startDay: root.startDay
235- }
236-
237 Flickable{
238 id: timeLineView
239
240- anchors.top: header.bottom
241+ anchors.top: parent.top
242 width: parent.width
243- height: parent.height - header.height
244+ height: parent.height
245
246 contentHeight: units.gu(10) * 24
247 contentWidth: width
248@@ -61,16 +54,16 @@
249 anchors.top: parent.top
250
251 Repeater{
252- model: type == typeWeek ? 7 : 3
253+ model: type == typeWeek ? 7 : 1
254
255 delegate: TimeLineBase {
256 property int idx: index
257 anchors.top: parent.top
258 width: {
259- if( type == typeWeek || (type == typeDay && index != 1 ) ) {
260- header.width/7
261+ if( type == typeWeek ) {
262+ parent.width/7
263 } else {
264- (header.width/7) * 5
265+ (parent.width)
266 }
267 }
268 height: parent.height
269@@ -85,8 +78,7 @@
270 id: comp
271 EventBubble{
272 type: {
273- if( root.type == typeWeek
274- || (root.type == typeDay && parent.idx !== 1) ) {
275+ if( root.type == typeWeek ) {
276 narrowType
277 } else {
278 wideType
279
280=== modified file 'TimeLineHeader.qml'
281--- TimeLineHeader.qml 2013-09-05 13:14:25 +0000
282+++ TimeLineHeader.qml 2013-09-17 13:14:51 +0000
283@@ -3,113 +3,67 @@
284
285 import "dateExt.js" as DateExt
286
287-Column {
288- id: root
289-
290- property int type: typeWeek
291-
292- property var startDay: DateExt.today();
293+PathViewBase {
294+ id: header
295
296 readonly property int typeWeek: 0
297 readonly property int typeDay: 1
298-
299- clip: true
300-
301+ property int type: typeWeek
302+
303+ interactive: false
304+ model:3
305+
306+ height: units.gu(10)
307 width: parent.width
308
309- Item{
310- id: monthHeader
311- width: parent.width
312- height: monthLabel.height
313-
314- Label{
315- id: monthLabel
316- fontSize: "large"
317- text: {
318- var monthDate = startDay;
319- if( type === typeDay ) {
320- monthDate = monthDate.addDays(1)
321- }
322- Qt.locale().standaloneMonthName(monthDate.getMonth())
323- }
324- anchors.leftMargin: units.gu(1)
325- anchors.left: parent.left
326- //color:"white"
327- anchors.verticalCenter: parent.verticalCenter
328- }
329-
330- Label{
331- id: yearLabel
332- fontSize: "medium"
333- text: root.startDay.getFullYear()
334- anchors.right: parent.right
335- anchors.rightMargin: units.gu(1)
336- color:"#AEA79F"
337- anchors.verticalCenter: parent.verticalCenter
338- }
339- }
340-
341- Row{
342- id: header
343-
344- width: parent.width
345- height: units.gu(10)
346-
347- Repeater{
348- model: type == typeWeek ? 7 : 3
349-
350- delegate: Item {
351- property var date : startDay.addDays(index);
352- property int weekDayWidth: header.width / 7
353-
354- width: {
355- if( type == typeWeek || (type == typeDay && index != 1 ) ) {
356- weekDayWidth
357- } else {
358- weekDayWidth * 5
359- }
360- }
361-
362- height: parent.height
363-
364- Column{
365- anchors.verticalCenter: parent.verticalCenter
366- anchors.horizontalCenter: parent.horizontalCenter
367- width: parent.width
368- spacing: units.gu(0.5)
369-
370- Label{
371- property var day: {
372- if( type == typeWeek || (type == typeDay && index != 1 ) ) {
373- Qt.locale().standaloneDayName(date.getDay(), Locale.ShortFormat)
374- } else {
375- Qt.locale().standaloneDayName(date.getDay(), Locale.LongFormat)
376- }
377- }
378-
379- text: day.toUpperCase();
380- fontSize: "medium"
381- horizontalAlignment: Text.AlignHCenter
382- color: "#AEA79F"
383- width: parent.width
384- }
385-
386- Label{
387- text: date.getDate();
388- fontSize: "large"
389- horizontalAlignment: Text.AlignHCenter
390- color: {
391- if( type == typeDay && index == 1 ) {
392- "white"
393- } else if( type == typeWeek && date.isSameDay(DateExt.today())){
394- "white"
395- } else {
396- "#AEA79F"
397- }
398- }
399- width: parent.width
400- }
401- }
402+ property var date;
403+
404+ delegate: TimeLineHeaderComponent{
405+ type: header.type
406+
407+ height: parent.height
408+ isCurrentItem: index == header.currentIndex
409+
410+ width: {
411+ if( type == typeWeek ) {
412+ parent.width
413+ } else if( type == typeDay && isCurrentItem ){
414+ (header.width/7) * 5
415+ } else {
416+ (header.width/7)
417+ }
418+ }
419+
420+ startDay: getStartDate();
421+
422+ function getStartDate() {
423+ switch(type) {
424+ case typeWeek:
425+ return getDateForWeek();
426+ case typeDay:
427+ return getDateForDay();
428+ }
429+ }
430+
431+ function getDateForDay() {
432+ switch( header.indexType(index)) {
433+ case 0:
434+ return date;
435+ case -1:
436+ return date.addDays(-1);
437+ case 1:
438+ return date.addDays(1);
439+ }
440+ }
441+
442+ function getDateForWeek() {
443+ switch( header.indexType(index)) {
444+ case 0:
445+ return date;
446+ case -1:
447+ return date.addDays(14);
448+ case 1:
449+ return date.addDays(7);
450 }
451 }
452 }
453
454=== added file 'TimeLineHeaderComponent.qml'
455--- TimeLineHeaderComponent.qml 1970-01-01 00:00:00 +0000
456+++ TimeLineHeaderComponent.qml 2013-09-17 13:14:51 +0000
457@@ -0,0 +1,57 @@
458+import QtQuick 2.0
459+import Ubuntu.Components 0.1
460+
461+import "dateExt.js" as DateExt
462+
463+Column {
464+ id: root
465+
466+ readonly property int typeWeek: 0
467+ readonly property int typeDay: 1
468+ property int type: typeWeek
469+
470+ property var startDay: DateExt.today();
471+ property bool isCurrentItem: false
472+
473+ width: parent.width
474+
475+ Row{
476+ id: header
477+
478+ width: parent.width
479+ height: parent.height
480+
481+ Repeater{
482+ model: type == typeWeek ? 7 : 1
483+
484+ delegate: HeaderDateComponent{
485+ date: startDay.addDays(index);
486+ dayFormat: {
487+ if( type == typeWeek || (type == typeDay && !root.isCurrentItem) ) {
488+ Locale.ShortFormat
489+ } else {
490+ Locale.LongFormat
491+ }
492+ }
493+
494+ dateColor: {
495+ if( type == typeWeek && date.isSameDay(DateExt.today())){
496+ "white"
497+ } else if( type == typeDay && root.isCurrentItem ) {
498+ "white"
499+ } else {
500+ "#AEA79F"
501+ }
502+ }
503+
504+ width: {
505+ if( type == typeWeek ) {
506+ header.width/7
507+ } else {
508+ header.width
509+ }
510+ }
511+ }
512+ }
513+ }
514+}
515
516=== added file 'ViewHeader.qml'
517--- ViewHeader.qml 1970-01-01 00:00:00 +0000
518+++ ViewHeader.qml 2013-09-17 13:14:51 +0000
519@@ -0,0 +1,30 @@
520+import QtQuick 2.0
521+import Ubuntu.Components 0.1
522+
523+Item{
524+ id: header
525+ width: parent.width
526+ height: monthLabel.height
527+
528+ property var date;
529+
530+ Label{
531+ id: monthLabel
532+ fontSize: "large"
533+ text: Qt.locale().standaloneMonthName(date.getMonth())
534+ anchors.leftMargin: units.gu(1)
535+ anchors.left: parent.left
536+ //color:"white"
537+ anchors.verticalCenter: parent.verticalCenter
538+ }
539+
540+ Label{
541+ id: yearLabel
542+ fontSize: "medium"
543+ text: date.getFullYear()
544+ anchors.right: parent.right
545+ anchors.rightMargin: units.gu(1)
546+ color:"#AEA79F"
547+ anchors.verticalCenter: parent.verticalCenter
548+ }
549+}
550
551=== modified file 'WeekView.qml'
552--- WeekView.qml 2013-09-04 12:59:33 +0000
553+++ WeekView.qml 2013-09-17 13:14:51 +0000
554@@ -2,13 +2,26 @@
555 import Ubuntu.Components 0.1
556
557 import "dateExt.js" as DateExt
558-import "dataService.js" as DataService
559
560-Item{
561+Column {
562 id: root
563+
564+ property var dayStart: new Date();
565+ anchors.top: parent.top
566+ anchors.topMargin: units.gu(1.5)
567+
568 anchors.fill: parent
569
570- property var dayStart: new Date();
571+ ViewHeader{
572+ id: viewHeader
573+ date: dayStart
574+ }
575+
576+ TimeLineHeader{
577+ id: weekHeader
578+ type: typeWeek
579+ date: weekViewPath.weekStart
580+ }
581
582 PathViewBase{
583 id: weekViewPath
584@@ -16,17 +29,17 @@
585 property var visibleWeek: dayStart.weekStart(Qt.locale().firstDayOfWeek);
586 property var weekStart: weekViewPath.visibleWeek.addDays(-7)
587
588- anchors.top: parent.top
589- anchors.topMargin: units.gu(1.5)
590 width: parent.width
591- height: parent.height - units.gu(3)
592+ height: root.height - viewHeader.height - weekHeader.height
593
594 onNextItemHighlighted: {
595 nextWeek();
596+ weekHeader.incrementCurrentIndex()
597 }
598
599 onPreviousItemHighlighted: {
600 previousWeek();
601+ weekHeader.decrementCurrentIndex()
602 }
603
604 function nextWeek() {
605@@ -49,20 +62,19 @@
606 startDay: getWeekStart();
607
608 function getWeekStart() {
609- if (index === weekViewPath.currentIndex) {
610+ switch( weekViewPath.indexType(index)) {
611+ case 0:
612 return weekViewPath.weekStart;
613- }
614- var previousIndex = weekViewPath.currentIndex > 0 ? weekViewPath.currentIndex - 1 : 2
615-
616- if ( index === previousIndex ) {
617+ case -1:
618 var weekStartDay= weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek);
619 return weekStartDay.addDays(14);
620+ case 1:
621+ var weekStartDay = weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek);
622+ return weekStartDay.addDays(7);
623 }
624-
625- var weekStartDay = weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek);
626- return weekStartDay.addDays(7);
627 }
628 }
629 }
630 }
631
632+
633
634=== modified file 'YearView.qml'
635--- YearView.qml 2013-09-02 14:34:29 +0000
636+++ YearView.qml 2013-09-17 13:14:51 +0000
637@@ -35,17 +35,15 @@
638
639 property var year: getYear();
640
641- function getYear(){
642- if (index === root.currentIndex) {
643+ function getYear() {
644+ switch( root.indexType(index)) {
645+ case 0:
646 return intern.startYear;
647- }
648- var previousIndex = root.currentIndex > 0 ? root.currentIndex - 1 : 2
649-
650- if ( index === previousIndex ) {
651+ case -1:
652 return getDateFromYear(intern.startYear.getFullYear() - 1);
653+ case 1:
654+ return getDateFromYear(intern.startYear.getFullYear() + 1);
655 }
656-
657- return getDateFromYear(intern.startYear.getFullYear() + 1);
658 }
659
660 width: parent.width

Subscribers

People subscribed via source and target branches

to status/vote changes: