/*******************************************************************************
* Copyright (c) 2011 Michel DAVID mimah35-at-gmail.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package fr.gotorennes;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.os.AsyncTask;
public class ItineraireBusDetailActivity extends AbstractMapActivity {
private AsyncTask<String, String, Itineraire> t;
@Override
protected int getLayout() {
return R.layout.map_itineraire;
}
@Override
protected void init() {
final Itineraire itineraire = goToRennes.itineraireCourant;
final ProgressDialog waitDialog = ProgressDialog.show(this, getString(R.string.titre), getString(R.string.itineraire), true, true, new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
if(t != null){
t.cancel(true);
}
finish();
}
});
t = new AsyncTask<String, String, Itineraire>() {
@Override
protected Itineraire doInBackground(String... params) {
waitDialog.setMessage("Calcul des tracés");
calculeRoutes(itineraire);
return itineraire;
}
@Override
protected void onPostExecute(Itineraire result) {
populateItineraireDetails(result);
waitDialog.dismiss();
}
@Override
protected void onProgressUpdate(String... values) {
waitDialog.setMessage(values[0]);
}
};
t.execute();
}
@Override
protected String getTrackingName() {
return "itineraireBus";
}
@Override
protected void loadProximityData() {
// Rien
}
}