List of usage examples for android.text.format Time equals
public boolean equals(Object obj)
From source file:it.sasabz.android.sasabus.fragments.OrarioFragment.java
/** * This method gets the next departure time and returns the * index of this element/*from w w w . jav a 2 s .c om*/ * @param c is the cursor to the list_view * @return the index of the next departure time */ private int getNextTimePosition(Vector<Passaggio> list) { int count = list.size(); if (count == 0) { return -1; } else if (count == 1) { return 0; } else { int i = 0; boolean found = false; while (i <= count - 2 && !found) { Time currentTime = new Time(); Time sasaTime = new Time(); Time sasaTimeNext = new Time(); currentTime.setToNow(); sasaTime = list.get(i).getOrario(); sasaTimeNext = list.get(i + 1).getOrario(); if (sasaTime.after(currentTime) || sasaTime.equals(currentTime) || sasaTime.before(currentTime) && (sasaTimeNext.equals(currentTime) || sasaTimeNext.after(currentTime))) { found = true; } else { i++; } } return i; } }
From source file:it.sasabz.android.sasabus.fragments.WayFragment.java
/** * This method gets the next departure time and returns the * index of this element/*w ww. ja v a2 s . co m*/ * @param c is the cursor to the list_view * @return the index of the next departure time */ private int getNextTimePosition(Vector<Passaggio> list) { int count = 0; if (list != null) { count = list.size(); } if (count == 0) { return -1; } else if (count == 1) { return 0; } else { int i = 0; boolean found = false; while (i <= count - 2 && !found) { Time currentTime = new Time(); Time sasaTime = new Time(); Time sasaTimeNext = new Time(); currentTime.setToNow(); sasaTime = list.get(i).getOrario(); sasaTimeNext = list.get(i + 1).getOrario(); if (sasaTime.after(currentTime) || sasaTime.equals(currentTime) || sasaTime.before(currentTime) && (sasaTimeNext.equals(currentTime) || sasaTimeNext.after(currentTime))) { found = true; } else { i++; } } return i; } }