Implemented event location

This commit is contained in:
Caesar2011
2018-07-31 22:45:55 +02:00
parent 2598e11ac5
commit d8e3a68344
3 changed files with 14 additions and 3 deletions

View File

@@ -129,6 +129,7 @@ public class ScheduleFragment extends Fragment implements MonthLoader.MonthChang
WeekViewEvent weekViewEvent = new WeekViewEvent(e.getId(), e.getTitle(), start.get(Calendar.YEAR), start.get(Calendar.MONTH) + 1, start.get(Calendar.DAY_OF_MONTH), start.get(Calendar.HOUR_OF_DAY), start.get(Calendar.MINUTE), ende.get(Calendar.YEAR), ende.get(Calendar.MONTH) + 1, ende.get(Calendar.DAY_OF_MONTH), ende.get(Calendar.HOUR_OF_DAY), ende.get(Calendar.MINUTE));
weekViewEvent.setColor(e.getColor());
weekViewEvent.setLocation(e.getLocation());
events.add(weekViewEvent);
}
}

View File

@@ -336,7 +336,7 @@ class KVVModuleList extends HTTPService {
errorCallback.onError(new NetworkError(101404, 500, "Currently running in offline mode!"));
return;
}
get(String.format("https://kvv.imp.fu-berlin.de/direct/calendar/site/%s.json", ID), token.getCookies(), response -> {
get(String.format("https://kvv.imp.fu-berlin.de/direct/calendar/site/%s.json?detailed=true", ID), token.getCookies(), response -> {
String body = response.getParsed();
if (body == null) {
errorCallback.onError(new NetworkError(101401, 403, "No calendar retrieved!"));
@@ -355,7 +355,8 @@ class KVVModuleList extends HTTPService {
String siteId = site.getString("siteId");
long duration = site.getLong("duration");
long firstTime = site.getJSONObject("firstTime").getLong("time");
events.add(new Event(id, type, title, duration, firstTime, siteId));
String location = site.getString("location");
events.add(new Event(id, type, title, duration, firstTime, siteId, location));
}
} catch (JSONException e) {
e.printStackTrace();

View File

@@ -14,14 +14,19 @@ public class Event implements Serializable {
private final long duration;
private final long firstTime;
private final String siteId;
private final String location;
public Event(String id, String type, String title, long duration, long firstTime, String siteId) {
public Event(String id, String type, String title, long duration, long firstTime, String siteId, String location) {
this.id = id;
this.type = type;
this.title = title;
this.duration = duration;
this.firstTime = firstTime;
this.siteId = siteId;
this.location = location
.replace(" Übungsraum", "")
.replace(" Konferenzraum", "")
.replace(" Seminarraum", "");
}
public String getId() {
@@ -44,6 +49,10 @@ public class Event implements Serializable {
return this.firstTime+this.duration;
}
public String getLocation() {
return location;
}
public ColorRGB getColor() {
MessageDigest digest;
try {