Archived
Can sort on categories. Centered main view.
This commit is contained in:
1 parent
c9e55191bd
commit
9b2d04f41a
3 files changed
+17
-6
No files matched your search
@@ -22,7 +22,19 @@ public class DataHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Event[] populateList() {
|
||||
return events.toArray(new Event[events.size()]);
|
||||
public Event[] populateList(String category) {
|
||||
LinkedList<Event> sorted = new LinkedList<Event>();
|
||||
|
||||
if (category == "all") {
|
||||
return events.toArray(new Event[events.size()]);
|
||||
} else {
|
||||
for (int i = 0; i < events.size(); i++) {
|
||||
Event tmp = events.get(i);
|
||||
|
||||
if (category.equals(tmp.category))
|
||||
sorted.add(tmp);
|
||||
}
|
||||
return sorted.toArray(new Event[sorted.size()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class ProgramListActivity extends BaseDnsActivity {
|
||||
}
|
||||
|
||||
protected ListAdapter createAdapter() {
|
||||
Event[] events = dataHandler.populateList();
|
||||
Event[] events = dataHandler.populateList("all");
|
||||
|
||||
ListAdapter adapter = new ArrayAdapter<Event>(this, R.layout.event_list_row, R.id.event_list_row_text, events) {
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user