forked from alamkanak/Android-Week-View
-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathWeekViewEvent.java
More file actions
215 lines (181 loc) · 6.42 KB
/
WeekViewEvent.java
File metadata and controls
215 lines (181 loc) · 6.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
package com.alamkanak.weekview;
import java.util.Calendar;
/**
* Created by Raquib-ul-Alam Kanak on 7/21/2014.
* Website: http://april-shower.com
*/
public class WeekViewEvent {
private long mId;
private Calendar mStartTime;
private Calendar mEndTime;
private String mName;
private String mLocation;
private int mColor;
private int mIconId;
private int mIconColor;
public WeekViewEvent(){
}
/**
* Initializes the event for week view.
*
* @param id The id of the event.
* @param name Name of the event.
* @param startYear Year when the event starts.
* @param startMonth Month when the event starts.
* @param startDay Day when the event starts.
* @param startHour Hour (in 24-hour format) when the event starts.
* @param startMinute Minute when the event starts.
* @param endYear Year when the event ends.
* @param endMonth Month when the event ends.
* @param endDay Day when the event ends.
* @param endHour Hour (in 24-hour format) when the event ends.
* @param endMinute Minute when the event ends.
* @param iconId Icon associated at the event.
* @param iconColor Color of the icon associated at the event.
*/
public WeekViewEvent(long id, String name, int startYear, int startMonth, int startDay,
int startHour, int startMinute, int endYear, int endMonth, int endDay,
int endHour, int endMinute, int iconId, int iconColor) {
this.mId = id;
this.mStartTime = Calendar.getInstance();
this.mStartTime.set(Calendar.YEAR, startYear);
this.mStartTime.set(Calendar.MONTH, startMonth-1);
this.mStartTime.set(Calendar.DAY_OF_MONTH, startDay);
this.mStartTime.set(Calendar.HOUR_OF_DAY, startHour);
this.mStartTime.set(Calendar.MINUTE, startMinute);
this.mEndTime = Calendar.getInstance();
this.mEndTime.set(Calendar.YEAR, endYear);
this.mEndTime.set(Calendar.MONTH, endMonth-1);
this.mEndTime.set(Calendar.DAY_OF_MONTH, endDay);
this.mEndTime.set(Calendar.HOUR_OF_DAY, endHour);
this.mEndTime.set(Calendar.MINUTE, endMinute);
this.mName = name;
this.mIconId = iconId;
this.mIconColor = iconColor;
}
/**
* Initializes the event for week view.
*
* @param id The id of the event.
* @param name Name of the event.
* @param startYear Year when the event starts.
* @param startMonth Month when the event starts.
* @param startDay Day when the event starts.
* @param startHour Hour (in 24-hour format) when the event starts.
* @param startMinute Minute when the event starts.
* @param endYear Year when the event ends.
* @param endMonth Month when the event ends.
* @param endDay Day when the event ends.
* @param endHour Hour (in 24-hour format) when the event ends.
* @param endMinute Minute when the event ends.
*/
public WeekViewEvent(long id, String name, int startYear, int startMonth, int startDay,
int startHour, int startMinute, int endYear, int endMonth, int endDay,
int endHour, int endMinute) {
this(id, name, startYear, startMonth, startDay, startHour, startMinute,
endYear, endMonth, endDay, endHour, endMinute, 0, 0);
}
/**
* Initializes the event for week view.
*
* @param id The id of the event.
* @param name Name of the event.
* @param location The location of the event.
* @param startTime The time when the event starts.
* @param endTime The time when the event ends.
* @param iconId Icon associated at the event.
* @param iconColor Color of the icon associated at the event.
*/
public WeekViewEvent(long id, String name, String location, Calendar startTime, Calendar endTime,
int iconId, int iconColor) {
this.mId = id;
this.mName = name;
this.mLocation = location;
this.mStartTime = startTime;
this.mEndTime = endTime;
this.mIconId = iconId;
this.mIconColor = iconColor;
}
/**
* Initializes the event for week view.
*
* @param id The id of the event.
* @param name Name of the event.
* @param location The location of the event.
* @param startTime The time when the event starts.
* @param endTime The time when the event ends.
*/
public WeekViewEvent(long id, String name, String location, Calendar startTime, Calendar endTime) {
this(id, name, location, startTime, endTime, 0, 0);
}
/**
* Initializes the event for week view.
*
* @param id The id of the event.
* @param name Name of the event.
* @param startTime The time when the event starts.
* @param endTime The time when the event ends.
*/
public WeekViewEvent(long id, String name, Calendar startTime, Calendar endTime) {
this(id, name, null, startTime, endTime, 0, 0);
}
public Calendar getStartTime() {
return mStartTime;
}
public void setStartTime(Calendar startTime) {
this.mStartTime = startTime;
}
public Calendar getEndTime() {
return mEndTime;
}
public void setEndTime(Calendar endTime) {
this.mEndTime = endTime;
}
public String getName() {
return mName;
}
public void setName(String name) {
this.mName = name;
}
public String getLocation() {
return mLocation;
}
public void setLocation(String location) {
this.mLocation = location;
}
public int getColor() {
return mColor;
}
public void setColor(int color) {
this.mColor = color;
}
public long getId() {
return mId;
}
public void setId(long id) {
this.mId = id;
}
public int getIconId() {
return mIconId;
}
public void setIconId(int iconId) {
this.mIconId = iconId;
}
public int getIconColor() {
return mIconColor;
}
public void setIconColor(int iconColor) {
this.mIconColor = iconColor;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WeekViewEvent that = (WeekViewEvent) o;
return mId == that.mId;
}
@Override
public int hashCode() {
return (int) (mId ^ (mId >>> 32));
}
}