diff --git a/res/layout/main.xml b/res/layout/main.xml
index 3a5f117..c2335b4 100644
--- a/res/layout/main.xml
+++ b/res/layout/main.xml
@@ -1,12 +1,7 @@
-
-
-
+
diff --git a/src/com/onirica/carrousel/Configuration.java b/src/com/onirica/carrousel/Configuration.java
index 73dc660..c8303e7 100644
--- a/src/com/onirica/carrousel/Configuration.java
+++ b/src/com/onirica/carrousel/Configuration.java
@@ -3,6 +3,7 @@ package com.onirica.carrousel;
import java.util.ArrayList;
import android.app.Activity;
+import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.DialogInterface;
@@ -10,8 +11,9 @@ import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
+import android.widget.ArrayAdapter;
-public class Configuration extends Activity {
+public class Configuration extends ListActivity {
private Results mResults;
private Intent intent;
private ProgressDialog progressDialog;
@@ -19,7 +21,6 @@ public class Configuration extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
intent = new Intent(getBaseContext(), Results.class);
startService(intent);
ServiceConnection conn = new ServiceConnection() {
@@ -53,5 +54,10 @@ public class Configuration extends Activity {
}
private void populateMatches() {
ArrayList matches = mResults.getMatches();
+ Match[] ms = new Match[matches.size()];
+ matches.toArray(ms);
+ ArrayAdapter adapter = new ArrayAdapter(this, R.layout.list_item, ms);
+ setListAdapter(adapter);
+
}
}
\ No newline at end of file
diff --git a/src/com/onirica/carrousel/Match.java b/src/com/onirica/carrousel/Match.java
index 4f84555..7d87cfe 100644
--- a/src/com/onirica/carrousel/Match.java
+++ b/src/com/onirica/carrousel/Match.java
@@ -47,4 +47,24 @@ public class Match {
goals.add(goal);
}
+ public int getLocalGoals() {
+ int count = 0;
+ for (Goal g : goals)
+ if (g.isLocal)
+ count++;
+ return count;
+ }
+
+ public int getVisitorGoals() {
+ int count = 0;
+ for (Goal g : goals)
+ if (!g.isLocal)
+ count++;
+ return count;
+ }
+
+ public String toString() {
+ return localTeam + " " + getLocalGoals() + " - " + getVisitorGoals() + " " + visitorTeam;
+ }
+
}