Ejemplo n.º 1
0
 public static void getTimersFromSharedPrefs(
     SharedPreferences prefs, ArrayList<TimerObj> timers, int match) {
   Object[] timerStrings = prefs.getStringSet(PREF_TIMERS_LIST, new HashSet<String>()).toArray();
   if (timerStrings.length > 0) {
     for (int i = 0; i < timerStrings.length; i++) {
       TimerObj t = new TimerObj();
       t.mTimerId = Integer.parseInt((String) timerStrings[i]);
       t.readFromSharedPref(prefs);
       if (t.mState == match) {
         timers.add(t);
       }
     }
   }
 }
Ejemplo n.º 2
0
 public static void getTimersFromSharedPrefs(SharedPreferences prefs, ArrayList<TimerObj> timers) {
   Object[] timerStrings = prefs.getStringSet(PREF_TIMERS_LIST, new HashSet<String>()).toArray();
   if (timerStrings.length > 0) {
     for (int i = 0; i < timerStrings.length; i++) {
       TimerObj t = new TimerObj();
       t.mTimerId = Integer.parseInt((String) timerStrings[i]);
       t.readFromSharedPref(prefs);
       timers.add(t);
     }
     Collections.sort(
         timers,
         new Comparator<TimerObj>() {
           @Override
           public int compare(TimerObj timerObj1, TimerObj timerObj2) {
             return timerObj2.mTimerId - timerObj1.mTimerId;
           }
         });
   }
 }