コード例 #1
0
 /**
  * creates a new Calendar from the Main calendar url: <a href="{@value #CALENDAR_URL}">See
  * Calendar Url</a>
  *
  * @param numDays the number of days to extend from the current day.
  */
 public Unit5Calendar(int numDays) {
   WestNewsReader westNews =
       new WestNewsReader(
           "http://www.unit5.org/site/RSS.aspx?DomainID=30&ModuleInstanceID=1852&PageID=53");
   RSSReader unit5News =
       new RSSReader("http://www.unit5.org/site/RSS.aspx?DomainID=4&ModuleInstanceID=4&PageID=1");
   setNewsRssReaders(westNews, unit5News);
   newsTask = new ReadAllFeedTask();
   dates = new CalendarDate[numDays];
   String currentDate = Time.getCurrentDate(Time.FORMAT_BASIC_DATE);
   int currentDateNum = Time.getDateAsNumber(currentDate);
   String previousDate = currentDate;
   for (int i = 0; i < dates.length; i++) {
     if (i == 0) {
       dates[0] = new CalendarDate(currentDate);
     } else {
       currentDate = Time.getDateAfterDate(previousDate);
       dates[i] = new CalendarDate(currentDate);
       previousDate = currentDate;
     }
   }
   if (Utils.hadInternetOnLastCheck) {
     loadCalendar();
   }
 }
コード例 #2
0
 /**
  * creates a new Calendar from the Main calendar url: <a href="{@value #CALENDAR_URL}">See
  * Calendar Url</a>
  *
  * @param numDays the number of days to extend from the current day.
  * @param loadCalendarImmediately true to load the calendar in the constructor, false to load the
  *     calendar from calling a loadcalendar() function.
  */
 public Unit5Calendar(int numDays, boolean loadCalendarImmediately) {
   dates = new CalendarDate[numDays];
   String currentDate = Time.getCurrentDate(Time.FORMAT_BASIC_DATE);
   int currentDateNum = Time.getDateAsNumber(currentDate);
   String previousDate = currentDate;
   for (int i = 0; i < dates.length; i++) {
     if (i == 0) {
       dates[0] = new CalendarDate(currentDate);
     } else {
       currentDate = Time.getDateAfterDate(previousDate);
       dates[i] = new CalendarDate(currentDate);
       previousDate = currentDate;
     }
   }
   if (loadCalendarImmediately && Utils.hadInternetOnLastCheck) {
     loadCalendar();
   }
 }
コード例 #3
0
 /**
  * @param date the date to get the events for
  * @return a CalendarEvent[] containing all the events happening on that day. If the date is
  *     blank, it will return an empty array.
  *     <ul>
  *       You can test if the returned array is blank by doing this:
  *       <li>&nbsp;&nbsp;&nbsp;&nbsp;returned array == Calendar.NO_CALENDAR_EVENTS
  *     </ul>
  */
 public CalendarEvent[] getEventsForDate(String date) {
   List<CalendarEvent> events = new ArrayList<>();
   for (CalendarEvent event : calendarEvents) {
     if (Time.isDateEqualToDate(date, event.getDate())) {
       events.add(event);
     }
   }
   if (events.size() < 1) return NO_CALENDAR_EVENTS;
   CalendarEvent[] events_array = new CalendarEvent[events.size()];
   events.toArray(events_array);
   return events_array;
 }
コード例 #4
0
 /**
  * This would combine all of today's info onto one date (events, lunch meals, breakfast meals,
  * announcements, and anything else. Perhaps we should make an Overall 'CalendarDate' class or
  * something).
  */
 public void loadTodaysInformation() {
   String date = Time.getCurrentDate(Time.FORMAT_BASIC_DATE);
 }