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
+2
-3
@@ -17,11 +17,10 @@
|
||||
<!-- Formålsparagraf -->
|
||||
<ImageView
|
||||
android:id="@+id/paragraph"
|
||||
android:layout_marginTop="100px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_below="@id/header"
|
||||
android:layout_above="@id/footer"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:src="@drawable/partest" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -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