Implemented event location
This commit is contained in:
@@ -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 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.setColor(e.getColor());
|
||||||
|
weekViewEvent.setLocation(e.getLocation());
|
||||||
events.add(weekViewEvent);
|
events.add(weekViewEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ class KVVModuleList extends HTTPService {
|
|||||||
errorCallback.onError(new NetworkError(101404, 500, "Currently running in offline mode!"));
|
errorCallback.onError(new NetworkError(101404, 500, "Currently running in offline mode!"));
|
||||||
return;
|
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();
|
String body = response.getParsed();
|
||||||
if (body == null) {
|
if (body == null) {
|
||||||
errorCallback.onError(new NetworkError(101401, 403, "No calendar retrieved!"));
|
errorCallback.onError(new NetworkError(101401, 403, "No calendar retrieved!"));
|
||||||
@@ -355,7 +355,8 @@ class KVVModuleList extends HTTPService {
|
|||||||
String siteId = site.getString("siteId");
|
String siteId = site.getString("siteId");
|
||||||
long duration = site.getLong("duration");
|
long duration = site.getLong("duration");
|
||||||
long firstTime = site.getJSONObject("firstTime").getLong("time");
|
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) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -14,14 +14,19 @@ public class Event implements Serializable {
|
|||||||
private final long duration;
|
private final long duration;
|
||||||
private final long firstTime;
|
private final long firstTime;
|
||||||
private final String siteId;
|
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.id = id;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
this.firstTime = firstTime;
|
this.firstTime = firstTime;
|
||||||
this.siteId = siteId;
|
this.siteId = siteId;
|
||||||
|
this.location = location
|
||||||
|
.replace(" Übungsraum", "")
|
||||||
|
.replace(" Konferenzraum", "")
|
||||||
|
.replace(" Seminarraum", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
@@ -44,6 +49,10 @@ public class Event implements Serializable {
|
|||||||
return this.firstTime+this.duration;
|
return this.firstTime+this.duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
public ColorRGB getColor() {
|
public ColorRGB getColor() {
|
||||||
MessageDigest digest;
|
MessageDigest digest;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user