Back to project page dbpendler.
The source code is released under:
Copyright 2013 Marcus Schiesser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Softw...
If you think the Android project dbpendler listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.marcusschiesser.dbpendler.client; /*from w w w.j a v a 2s . c o m*/ import java.util.Date; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.text.format.DateFormat; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.TextView; import de.marcusschiesser.dbpendler.client.adapters.ConnectionOverviewAdapter; import de.marcusschiesser.dbpendler.common.vo.ConnectionVO; public class Confirmation extends Activity { private static final int SUCCESS_DIALOG = 0; private TextView mPrice; private TextView mSeat; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.confirmation); Bundle extras = getIntent().getExtras(); ConnectionVO connection = (ConnectionVO) extras.getSerializable(DBPendler.EXTRA_SELECTED_CONNECTION); Date bookingDate = (Date) extras.getSerializable(DBPendler.EXTRA_BOOKING_DATE); TextView t = (TextView) findViewById(R.id.confirmation_connection); t.setText(ConnectionOverviewAdapter.formatConnection(connection)); t = (TextView) findViewById(R.id.confirmation_day); t.setText(DateFormat.format("dd.MM.yyyy", bookingDate)); t = (TextView) findViewById(R.id.confirmation_bahncard); t.setText("Bahncard: nein"); mSeat = (TextView) findViewById(R.id.confirmation_seat); mSeat.setText(""); mPrice = (TextView) findViewById(R.id.confirmation_price); mPrice.setText("18,50 ?"); CheckBox reserveSeat = (CheckBox) findViewById(R.id.confirmation_reserve_seat); reserveSeat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if(isChecked) { mSeat.setText("Reservierung: Gro?raum Gang"); mPrice.setText("21,00 ?"); } else { mSeat.setText(""); mPrice.setText("18,50 ?"); }; } }); Button bookButton = (Button) findViewById(R.id.confirmation_book); bookButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showDialog(SUCCESS_DIALOG); } }); } @Override protected Dialog onCreateDialog(int id) { switch (id) { case SUCCESS_DIALOG: AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.success_title); builder.setMessage(R.string.success_message); builder.setPositiveButton(R.string.confirmation_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { setResult(RESULT_OK); finish(); } }); return builder.create(); } return null; } }