Exemple #1
0
 public static String getEmailForUser(String user) {
   if (UserData.getLogin().equalsIgnoreCase(user)) return UserData.getEmail();
   for (UgUser u : UgApplication.getInstance().getUsers()) {
     if (u.getUserName().equalsIgnoreCase(user)) return u.getEmail();
   }
   return "";
 }
Exemple #2
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;
 }
Exemple #3
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);
 }
Exemple #4
0
 public static SharedPreferences getUserPreferences() {
   return UgApplication.getInstance().getSharedPreferences(PREFS_NAME_USER, Context.MODE_PRIVATE);
 }