Beispiel #1
0
 public static long getFisrtEventDate() {
   List<Event> events = new ArrayList();
   events.addAll(UgApplication.getInstance().getAllEvents());
   if (events.size() == 0) return 0;
   long date = events.get(0).getDate();
   for (Event e : events) {
     if (e.getDate() < date && e.getDate() > System.currentTimeMillis()) date = e.getDate();
   }
   return date;
 }
Beispiel #2
0
 private String getUserStatus() {
   boolean isEventRunningNow = false, isEventComeSoon = false, isEventHasBeen = false;
   for (Event event : UgApplication.getInstance().getAllEvents()) {
     long delta = event.getDate() - System.currentTimeMillis();
     long hours = TimeUnit.MILLISECONDS.toHours(Math.abs(delta));
     if (delta >= 0) {
       // will
       if (hours < 12) {
         isEventComeSoon = true;
       }
     } else {
       // was
       if (hours < 5) {
         isEventRunningNow = true;
       } else if (hours < 24) {
         isEventHasBeen = true;
       }
     }
   }
   if (isEventRunningNow) return getString(R.string.status_in_event);
   if (isEventComeSoon) return getString(R.string.status_event_soon);
   if (isEventHasBeen) return getString(R.string.status_after_event);
   return getString(R.string.status_not_in_event);
 }