1
0
mirror of https://github.com/balkian/Carrousel-Android.git synced 2024-12-22 21:18:13 +00:00

I6: Dialogo de progreso

This commit is contained in:
Fernando Herrera 2011-03-09 23:41:02 +01:00
parent 698302cccc
commit 060492e8a1

View File

@ -3,7 +3,9 @@ package com.onirica.carrousel;
import java.util.ArrayList;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
@ -12,6 +14,7 @@ import android.os.IBinder;
public class Configuration extends Activity {
private Results mResults;
private Intent intent;
private ProgressDialog progressDialog;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
@ -24,6 +27,7 @@ public class Configuration extends Activity {
public void onServiceConnected(ComponentName className, IBinder service) {
mResults = ((Results.LocalBinder)service).getService();
populateMatches();
progressDialog.dismiss();
}
@Override
@ -34,6 +38,18 @@ public class Configuration extends Activity {
}
};
bindService(intent, conn, BIND_AUTO_CREATE);
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();
}
private void populateMatches() {
ArrayList<Match> matches = mResults.getMatches();