2011-03-09 21:41:31 +00:00
|
|
|
package com.onirica.carrousel;
|
|
|
|
|
2011-03-09 22:33:35 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
2011-03-09 21:41:31 +00:00
|
|
|
import android.app.Activity;
|
2011-03-09 22:41:02 +00:00
|
|
|
import android.app.ProgressDialog;
|
2011-03-09 22:14:57 +00:00
|
|
|
import android.content.ComponentName;
|
2011-03-09 22:41:02 +00:00
|
|
|
import android.content.DialogInterface;
|
2011-03-09 22:14:57 +00:00
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.ServiceConnection;
|
2011-03-09 21:41:31 +00:00
|
|
|
import android.os.Bundle;
|
2011-03-09 22:14:57 +00:00
|
|
|
import android.os.IBinder;
|
2011-03-09 21:41:31 +00:00
|
|
|
|
|
|
|
public class Configuration extends Activity {
|
2011-03-09 22:14:57 +00:00
|
|
|
private Results mResults;
|
2011-03-09 22:33:35 +00:00
|
|
|
private Intent intent;
|
2011-03-09 22:41:02 +00:00
|
|
|
private ProgressDialog progressDialog;
|
2011-03-09 21:41:31 +00:00
|
|
|
/** Called when the activity is first created. */
|
|
|
|
@Override
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
setContentView(R.layout.main);
|
2011-03-09 22:33:35 +00:00
|
|
|
intent = new Intent(getBaseContext(), Results.class);
|
2011-03-09 22:14:57 +00:00
|
|
|
startService(intent);
|
|
|
|
ServiceConnection conn = new ServiceConnection() {
|
|
|
|
@Override
|
|
|
|
public void onServiceConnected(ComponentName className, IBinder service) {
|
|
|
|
mResults = ((Results.LocalBinder)service).getService();
|
2011-03-09 22:33:35 +00:00
|
|
|
populateMatches();
|
2011-03-09 22:41:02 +00:00
|
|
|
progressDialog.dismiss();
|
2011-03-09 22:14:57 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
public void onServiceDisconnected(ComponentName className) {
|
|
|
|
mResults = null;
|
2011-03-09 22:33:35 +00:00
|
|
|
stopService(intent);
|
|
|
|
finish();
|
2011-03-09 22:14:57 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
bindService(intent, conn, BIND_AUTO_CREATE);
|
2011-03-09 22:41:02 +00:00
|
|
|
progressDialog = new ProgressDialog(this);
|
|
|
|
progressDialog.setMessage("Retrieving match list");
|
|
|
|
progressDialog.setIndeterminate(true);
|
|
|
|
progressDialog.setCancelable(true);
|
|
|
|
progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
|
|
|
public void onCancel(DialogInterface dialog) {
|
|
|
|
//Log.i(TAG, "dialog cancel has been invoked");
|
|
|
|
stopService(intent);
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
progressDialog.show();
|
2011-03-09 21:41:31 +00:00
|
|
|
}
|
2011-03-09 22:33:35 +00:00
|
|
|
private void populateMatches() {
|
|
|
|
ArrayList<Match> matches = mResults.getMatches();
|
|
|
|
}
|
2011-03-09 21:41:31 +00:00
|
|
|
}
|