mirror of
https://github.com/balkian/Carrousel-Android.git
synced 2024-12-22 21:18:13 +00:00
I7: Mostrar los partidos
This commit is contained in:
parent
060492e8a1
commit
2ec6d7f717
@ -1,12 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/hello"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -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<Match> matches = mResults.getMatches();
|
||||
Match[] ms = new Match[matches.size()];
|
||||
matches.toArray(ms);
|
||||
ArrayAdapter<Match> adapter = new ArrayAdapter<Match>(this, R.layout.list_item, ms);
|
||||
setListAdapter(adapter);
|
||||
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user