package com.bba.crossing;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
public class crossingActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button sermonButton = (Button) findViewById(R.id.Button01);
sermonButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
Uri uri = Uri.parse("http://www.thecrossing.net/sermonpopup.shtml");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
{
}
Button imageButton = (Button) findViewById(R.id.ImageButton01);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse("http://thecrossing.net/index.html");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
Button quincyButton = (Button) findViewById(R.id.Button02);
quincyButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
Uri uri = Uri.parse("http://www.thecrossing.net/quincy.shtml");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});{}
Button macombButton = (Button) findViewById(R.id.Button03);
macombButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
Uri uri = Uri.parse("http://www.thecrossing.net/macomb.shtml");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});{}
Button kirkButton = (Button) findViewById(R.id.Button04);
kirkButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
Uri uri = Uri.parse("http://www.thecrossing.net/kirksville.shtml");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});{}
Button nineButton = (Button) findViewById(R.id.Button05);
nineButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
Uri uri = Uri.parse("http://www.thecrossing.net/929.shtml");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});{}
Button contactButton = (Button) findViewById(R.id.Button07);
contactButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
final CharSequence[] ChurchCampus = {"Quincy", "Macomb", "Kirksville", "929"};
AlertDialog.Builder ab=new AlertDialog.Builder(crossingActivity.this);
ab.setTitle("Which campus?");
ab.setSingleChoiceItems(ChurchCampus, -1, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
})
.setPositiveButton("Call", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
if (ChurchCampus.equals("Quincy")){
try {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:+2172246374"));
startActivity(callIntent);
} catch (Exception e) {
Log.e("CrossingApp", "Failed to start call", e);
}
} else if (ChurchCampus.equals("Macomb")){
try {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:+3092785117"));
startActivity(callIntent);
} catch (Exception e) {
Log.e("CrossingApp", "Failed to start call", e);
}
} else if (ChurchCampus.equals("Kirksville")){
try {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:+6606656000"));
startActivity(callIntent);
} catch (Exception e) {
Log.e("CrossingApp", "Failed to start call", e);
}
} else if (ChurchCampus.equals("929")){
try {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:+2172140929"));
startActivity(callIntent);
} catch (Exception e) {
Log.e("CrossingApp", "Failed to start call", e);
}
}
}})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// on cancel button action
}
});
ab.show();
}
});
Button aboutButton = (Button) findViewById(R.id.Button08);
aboutButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
// prepare the alert box
AlertDialog.Builder alertbox = new AlertDialog.Builder(crossingActivity.this);
// set the message to display
alertbox.setMessage("The Crossing version 0.5 BETA");
alertbox.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
}
});
// show it
alertbox.show();
}
});
}
;
}