Commit 171c43d1 authored by Robert Hitt's avatar Robert Hitt
Browse files

Current day is now highlighted in schedule

parent d38df244
Pipeline #750 passed with stages
in 24 minutes and 10 seconds
......@@ -192,8 +192,10 @@ public class FacilityPresenter {
}
// Parses the schedule into an HTML string
// Kind of a hacky approach
public String getSchedule(Facility facility, Calendar now) {
RealmList<OpenTimes> openTimesList = getActiveSchedule(facility, now);
int currentDay = (5 + now.get(Calendar.DAY_OF_WEEK)) % 7;
if(openTimesList.size() == 0)
return "No schedule available";
......@@ -209,10 +211,17 @@ public class FacilityPresenter {
else
scheduleString.append("<br/>");
// the current day's schedule should be highlighted
if(o.getStartDay() <= currentDay && o.getEndDay() >= currentDay)
scheduleString.append("<strong>");
scheduleString.append("<b>" + parseIntToDay(o.getStartDay()) + "</b>: ");
scheduleString.append(parseTo12HourTime(o.getStartTime()));
scheduleString.append(" - ");
scheduleString.append(parseTo12HourTime(o.getEndTime()));
if(o.getStartDay() <= currentDay && o.getEndDay() >= currentDay)
scheduleString.append("</strong>");
}
return scheduleString.toString();
......
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment