Grouping events by location
This commit is contained in:
@@ -44,6 +44,7 @@ public class GroupedEvents extends EventList {
|
||||
private final int dayOfWeek;
|
||||
private final long startTime;
|
||||
private final long duration;
|
||||
private final String location;
|
||||
|
||||
private Group(Event event) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
@@ -51,6 +52,7 @@ public class GroupedEvents extends EventList {
|
||||
dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
|
||||
startTime = calendar.get(Calendar.HOUR_OF_DAY)*3600000+calendar.get(Calendar.MINUTE)*60000+calendar.get(Calendar.SECOND)*1000+calendar.get(Calendar.MILLISECOND);
|
||||
duration = event.getEndDate()-event.getStartDate();
|
||||
location = event.getLocation();
|
||||
|
||||
skippedDates = new ArrayList<>();
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
@@ -67,7 +69,8 @@ public class GroupedEvents extends EventList {
|
||||
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
|
||||
int startTime = calendar.get(Calendar.HOUR_OF_DAY)*3600000+calendar.get(Calendar.MINUTE)*60000+calendar.get(Calendar.SECOND)*1000+calendar.get(Calendar.MILLISECOND);
|
||||
long length = event.getEndDate()-event.getStartDate();
|
||||
if (this.dayOfWeek != dayOfWeek || this.startTime != startTime || this.duration != length)
|
||||
String location = event.getLocation();
|
||||
if (this.dayOfWeek != dayOfWeek || this.startTime != startTime || this.duration != length || this.location.equals(location))
|
||||
return false;
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
|
||||
Reference in New Issue
Block a user