/******************************************************************************* * 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.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.RadioGroup; public class ItineraireActivity extends AbstractActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.itineraire); } @Override protected void init(Intent intent) { final EditText depart = (EditText) findViewById(R.id.depart); final EditText arrivee = (EditText) findViewById(R.id.arrivee); final RadioGroup choix = (RadioGroup) findViewById(R.id.choix); addCalendrier(intent); final CheckBox directUniquement = (CheckBox) findViewById(R.id.directUniquement); Button valid = (Button) findViewById(R.id.buttonValid); valid.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = null; if(choix.getCheckedRadioButtonId() == R.id.velo) { intent = new Intent(getApplicationContext(), ItineraireVeloResultActivity.class); } else { intent = new Intent(getApplicationContext(), ItineraireBusResultActivity.class); intent.putExtra("direct", directUniquement.isChecked()); } intent.putExtra("depart", depart.getText().toString()); intent.putExtra("arrivee", arrivee.getText().toString()); intent.putExtra("date", calendrier.getTimeInMillis()); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } }); } @Override protected String getTrackingName() { return "saisieItineraire"; } @Override protected int getMapIcon() { return 0; } }