Projects >> Android-Application >>aac73c7a675161ecc695ffd8f7fc16c0ee9dbfd2

Chunk
Conflicting content
import me.pdthx.Widget.Adapters.ArrayWheelAdapter;

public class ACHAccountSetupActivity extends BaseActivity implements
<<<<<<< HEAD
OnCheckedChangeListener{
	Button editAcct;
	Button addAcct;
	Button backAcctBtn;
	RadioGroup btnAcctType;
	Spinner spinnerReceiveAcct;
	Spinner spinnerSendAcct;

	private String nameOnAccount;
	private String routingNumber;
	private String accountNumber;
	private String accountType;
	private String questions[];
	private String passcodeCreation;
	private String nickname;

	private String preferredSend;
	private String preferredReceive;

	private int currentId;

=======
    OnCheckedChangeListener{

	final private int SETUPACHACCOUNT_FAILED = 3;
	final private int USERREGISTRATION_ACHNUMBERMISMATCH = 8;
	private Button btnEnablePayments;
	private Button btnACHRemindMeLater;
	private ACHAccountSetupRequest request;
	private ACHAccountSetupResponse response;
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
	private boolean isCheckingAcct;
	private ACHAccountSetupRequest request;
	private ACHAccountSetupResponse setupResponse;
Solution content
import me.pdthx.Widget.Adapters.ArrayWheelAdapter;

public class ACHAccountSetupActivity extends BaseActivity implements
OnCheckedChangeListener{
	Button editAcct;
	Button addAcct;
	Button backAcctBtn;
	RadioGroup btnAcctType;
	Spinner spinnerReceiveAcct;
	Spinner spinnerSendAcct;

	private String nameOnAccount;
	private String routingNumber;
	private String accountNumber;
	private String accountType;
	private String questions[];
	private String passcodeCreation;
	private String nickname;

	private String preferredSend;
	private String preferredReceive;

	private int currentId;
	private boolean isCheckingAcct;
	private ACHAccountSetupRequest request;
	private ACHAccountSetupResponse setupResponse;
File
ACHAccountSetupActivity.java
Developer's decision
Version 1
Kind of conflict
Attribute
Chunk
Conflicting content
							thread.start();

						.toString()
						.trim()
						.equals(((EditText) findViewById(R.id.txtConfirmAccountNumber))
<<<<<<< HEAD
								.getText().toString().trim())
						&& (txtAccountNumber.getText().toString().length() != 0)) {

					nameOnAccount = txtNameOnAccount.getText().toString()
							.trim();
					routingNumber = txtRoutingNumber.getText().toString()
							.trim();
					accountNumber = txtAccountNumber.getText().toString()
							.trim();
					nickname = txtNickname.getText().toString().trim();
					if (isCheckingAcct) {
						accountType = "Checking";
					} else {
						accountType = "Savings";
					}

					if (userInfo.PaymentAccountId.length() != 0
							|| (listofBanks != null && listofBanks.size() > 0)) {
						// user has security pin
						// 1.) confirm pin
						// 2.) confirm question
						confirmPin();
					} else {
						// user does not have security pin
						// 1.) show setup pin creation screen
						// 2.) show create question screen
						confirmCreation();
					}
				} else {
					achSetupHandler
							.sendEmptyMessage(USERREGISTRATION_ACHNUMBERMISMATCH);
				}
			}
		});

		Button back = (Button) findViewById(R.id.btnACHBack);
		back.setOnClickListener(new OnClickListener() {
						} else {

			@Override
			public void onClick(View v) {
				finish();
			}

		});
	}

	public void confirmCreation() {
		setContentView(R.layout.setup_security_controller);

		Button btnSetupSecurityPin = (Button) findViewById(R.id.btnSetupSecurityPin);
		btnSetupSecurityPin.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				createSecurityPin();
			}

		});
	}

	public void createSecurityPin() {
		setContentView(R.layout.setup_security_dialog);

		final CustomLockView ctrlSecurityPin = (CustomLockView) findViewById(R.id.ctrlSecurityPin);
		ctrlSecurityPin.invalidate();
		ctrlSecurityPin.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {

				passcode = ctrlSecurityPin.getPasscode();

				if (passcode.length() > 3) {
					confirmPin();
				} else
					achSetupHandler
							.sendEmptyMessage(USERSECURITYPIN_INVALIDLENGTH);

				return false;

			}
		});
	}

	public void confirmPin() {
		setContentView(R.layout.setup_security_dialog);

		TextView header = (TextView) findViewById(R.id.setupSecurityHeader);
		header.setText("Confirm Your Pin");
		TextView body = (TextView) findViewById(R.id.setupSecurityBody);
		body.setText("Re-enter your security pin in order to continue account creation.");

		final CustomLockView ctrlSecurityPin = (CustomLockView) findViewById(R.id.ctrlSecurityPin);
		ctrlSecurityPin.invalidate();
		ctrlSecurityPin.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {

				String confirmPasscode = ctrlSecurityPin.getPasscode();

				if (confirmPasscode.length() > 3) {
					if (userInfo.PaymentAccountId.length() != 0
							|| (listofBanks != null && listofBanks.size() > 0)) {
						passcode = confirmPasscode;
						createQuestion();
					} else {

						if (confirmPasscode.equals(passcode)) {
							final SecurityPinSetupRequest setupSecurityPin = new SecurityPinSetupRequest();
							setupSecurityPin.SecurityPin = passcode;
							setupSecurityPin.UserId = prefs.getString("userId",
									"");

							// send pincode to server
							progressDialog.setMessage("Sending Info...");
							progressDialog
									.setProgressStyle(ProgressDialog.STYLE_SPINNER);
							progressDialog.show();

							Thread thread = new Thread(new Runnable() {

								@Override
								public void run() {
									// TODO Auto-generated method stub
									try {
										response = UserService
												.setupSecurityPin(setupSecurityPin);
									} catch (Exception e) {
										e.printStackTrace();
									}
									progressDialog.dismiss();

									if (response.Success) {
										runOnUiThread(new Runnable() {
											public void run() {

												createQuestion();

											}
										});
									} else {
										achSetupHandler
												.sendEmptyMessage(USERDATA_FAILED);
									}
								}

							});
							achSetupHandler
									.sendEmptyMessage(USERSECURITYPIN_CONFIRMMISMATCH);
						}
					}
				} else
					achSetupHandler
							.sendEmptyMessage(USERSECURITYPIN_INVALIDLENGTH);

				return false;

			}
		});

	}

	public void confirmPinUpdateAccts() {
		setContentView(R.layout.setup_security_dialog);

		TextView header = (TextView) findViewById(R.id.setupSecurityHeader);
		header.setText("Confirm Your Pin");
		TextView body = (TextView) findViewById(R.id.setupSecurityBody);
		body.setText("Re-enter your security pin in order to continue account creation.");

		final CustomLockView ctrlSecurityPin = (CustomLockView) findViewById(R.id.ctrlSecurityPin);
		ctrlSecurityPin.invalidate();
		ctrlSecurityPin.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {

				String confirmPasscode = ctrlSecurityPin.getPasscode();

				if (confirmPasscode.length() > 3) {
					passcode = confirmPasscode;

					final ACHAccountDetailRequest requestPreferredSend = new ACHAccountDetailRequest();
					final ACHAccountDetailRequest requestPreferredReceive = new ACHAccountDetailRequest();

					requestPreferredSend.UserId = prefs.getString("userId", "");
					requestPreferredSend.AccountId = preferredSend;
					requestPreferredSend.SecurityPin = passcode;
					requestPreferredReceive.UserId = prefs.getString("userId",
							"");
					requestPreferredReceive.AccountId = preferredReceive;
					requestPreferredReceive.SecurityPin = passcode;

					progressDialog.setMessage("Sending Info...");
=======
								.getText().toString().trim())) {

					request = new ACHAccountSetupRequest();
					request.UserId = prefs.getString("userId", "");
					request.NameOnAccount = txtNameOnAccount.getText()
							.toString().trim();
					request.RoutingNumber = txtRoutingNumber.getText()
							.toString().trim();
					request.AccountNumber = txtAccountNumber.getText()
							.toString().trim();
					request.AccountType = isCheckingAcct ? "Checking" : "Savings";

					progressDialog.setMessage("Setting up ACH Account...");
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
					progressDialog
							.setProgressStyle(ProgressDialog.STYLE_SPINNER);
					progressDialog.show();
Solution content
									try {
					achSetupHandler
						.toString()
						.trim()
						.equals(((EditText) findViewById(R.id.txtConfirmAccountNumber))
								.getText().toString().trim())
						&& (txtAccountNumber.getText().toString().length() != 0)) {

					nameOnAccount = txtNameOnAccount.getText().toString()
							.trim();
					routingNumber = txtRoutingNumber.getText().toString()
							.trim();
					accountNumber = txtAccountNumber.getText().toString()
							.trim();
					nickname = txtNickname.getText().toString().trim();
					if (isCheckingAcct) {
						accountType = "Checking";
					} else {
						accountType = "Savings";
					}

					if (userInfo.PaymentAccountId.length() != 0

							|| (listofBanks != null && listofBanks.size() > 0)) {
						// user has security pin
						// 1.) confirm pin
						// 2.) confirm question
						confirmPin();
					} else {
						// user does not have security pin
						// 1.) show setup pin creation screen
						// 2.) show create question screen
						confirmCreation();
					}
				} else {
					achSetupHandler
							.sendEmptyMessage(USERREGISTRATION_ACHNUMBERMISMATCH);
				}
			}
		});

		Button back = (Button) findViewById(R.id.btnACHBack);
		back.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}

		});
	}

	public void confirmCreation() {
		setContentView(R.layout.setup_security_controller);

		Button btnSetupSecurityPin = (Button) findViewById(R.id.btnSetupSecurityPin);
		btnSetupSecurityPin.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				createSecurityPin();
			}

		});
	}

	public void createSecurityPin() {
		setContentView(R.layout.setup_security_dialog);

		final CustomLockView ctrlSecurityPin = (CustomLockView) findViewById(R.id.ctrlSecurityPin);
		ctrlSecurityPin.invalidate();
		ctrlSecurityPin.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {

				passcode = ctrlSecurityPin.getPasscode();

				if (passcode.length() > 3) {
					confirmPin();
				} else
							.sendEmptyMessage(USERSECURITYPIN_INVALIDLENGTH);

				return false;

			}
		});
	}

	public void confirmPin() {
		setContentView(R.layout.setup_security_dialog);

		TextView header = (TextView) findViewById(R.id.setupSecurityHeader);
		header.setText("Confirm Your Pin");
		TextView body = (TextView) findViewById(R.id.setupSecurityBody);
		body.setText("Re-enter your security pin in order to continue account creation.");

		final CustomLockView ctrlSecurityPin = (CustomLockView) findViewById(R.id.ctrlSecurityPin);
		ctrlSecurityPin.invalidate();
		ctrlSecurityPin.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {

				String confirmPasscode = ctrlSecurityPin.getPasscode();

				if (confirmPasscode.length() > 3) {
					if (userInfo.PaymentAccountId.length() != 0
							|| (listofBanks != null && listofBanks.size() > 0)) {
						passcode = confirmPasscode;
						createQuestion();
					} else {

						if (confirmPasscode.equals(passcode)) {
							final SecurityPinSetupRequest setupSecurityPin = new SecurityPinSetupRequest();
							setupSecurityPin.SecurityPin = passcode;
							setupSecurityPin.UserId = prefs.getString("userId",
									"");

							// send pincode to server
							progressDialog.setMessage("Sending Info...");
							progressDialog
									.setProgressStyle(ProgressDialog.STYLE_SPINNER);
							progressDialog.show();

							Thread thread = new Thread(new Runnable() {

								@Override
								public void run() {
									// TODO Auto-generated method stub
										response = UserService
												.setupSecurityPin(setupSecurityPin);
									} catch (Exception e) {
										e.printStackTrace();
									}
									progressDialog.dismiss();

									if (response.Success) {
										runOnUiThread(new Runnable() {
											public void run() {

												createQuestion();

											}
										});
									} else {
										achSetupHandler
												.sendEmptyMessage(USERDATA_FAILED);
									}
								}

							});
							thread.start();

						} else {
							achSetupHandler
									.sendEmptyMessage(USERSECURITYPIN_CONFIRMMISMATCH);
						}
					}
				} else
					achSetupHandler
							.sendEmptyMessage(USERSECURITYPIN_INVALIDLENGTH);

				return false;

			}
		});

	}

	public void confirmPinUpdateAccts() {
		setContentView(R.layout.setup_security_dialog);

		TextView header = (TextView) findViewById(R.id.setupSecurityHeader);
		header.setText("Confirm Your Pin");
		TextView body = (TextView) findViewById(R.id.setupSecurityBody);
		body.setText("Re-enter your security pin in order to continue account creation.");

		final CustomLockView ctrlSecurityPin = (CustomLockView) findViewById(R.id.ctrlSecurityPin);
		ctrlSecurityPin.invalidate();
		ctrlSecurityPin.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {

				String confirmPasscode = ctrlSecurityPin.getPasscode();

				if (confirmPasscode.length() > 3) {
					passcode = confirmPasscode;
					final ACHAccountDetailRequest requestPreferredSend = new ACHAccountDetailRequest();
					final ACHAccountDetailRequest requestPreferredReceive = new ACHAccountDetailRequest();

					requestPreferredSend.UserId = prefs.getString("userId", "");
					requestPreferredSend.AccountId = preferredSend;
					requestPreferredSend.SecurityPin = passcode;
					requestPreferredReceive.UserId = prefs.getString("userId",
							"");
					requestPreferredReceive.AccountId = preferredReceive;
					requestPreferredReceive.SecurityPin = passcode;

					progressDialog.setMessage("Sending Info...");
					progressDialog
							.setProgressStyle(ProgressDialog.STYLE_SPINNER);
					progressDialog.show();
File
ACHAccountSetupActivity.java
Developer's decision
Version 1
Kind of conflict
Attribute
Cast expression
If statement
Method declaration
Method invocation
Method signature
Variable
Chunk
Conflicting content
import me.pdthx.Requests.ACHAccountDeleteRequest;
import me.pdthx.Requests.ACHAccountDetailRequest;
import me.pdthx.Requests.ACHAccountUpdateRequest;
<<<<<<< HEAD
=======
import me.pdthx.Requests.SecurityPinSetupRequest;
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
import me.pdthx.Responses.ACHAccountResponse;
import me.pdthx.Responses.Response;
import me.pdthx.Responses.UserSignInResponse;
Solution content
import me.pdthx.Requests.ACHAccountDeleteRequest;
import me.pdthx.Requests.ACHAccountDetailRequest;
import me.pdthx.Requests.ACHAccountUpdateRequest;
import me.pdthx.Responses.ACHAccountResponse;
import me.pdthx.Responses.Response;
import me.pdthx.Responses.UserSignInResponse;
File
AccountManagerActivity.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
import me.pdthx.Responses.Response;
import me.pdthx.Responses.UserSignInResponse;
import me.pdthx.Services.PaymentAcctService;
<<<<<<< HEAD
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
=======
import me.pdthx.Services.UserService;
import me.pdthx.Widget.OnWheelChangedListener;
import me.pdthx.Widget.WheelView;
import me.pdthx.Widget.Adapters.ArrayWheelAdapter;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences.Editor;
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
Solution content
import me.pdthx.Responses.Response;
import me.pdthx.Responses.UserSignInResponse;
import me.pdthx.Services.PaymentAcctService;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
File
AccountManagerActivity.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
import android.widget.RadioGroup.OnCheckedChangeListener;

public class AccountManagerActivity extends BaseActivity implements
<<<<<<< HEAD
		OnCheckedChangeListener {

	Button editAcct;
	Button addAcct;
	Button backAcctBtn;
	RadioGroup btnAcctType;
	Spinner spinnerReceiveAcct;
	Spinner spinnerSendAcct;

	private String preferredSend;
	private String preferredReceive;

	private boolean isCheckingAcct;
	private Response response;
	private ACHAccountResponse updateResponse;
	private Response sendResponse;
	private Response receiveResponse;
	private ACHAccountUpdateRequest updateRequest;
	private ACHAccountDeleteRequest deleteRequest;
	private UserSignInResponse userInfo;

	final private int USERREGISTRATION_ACHNUMBERMISMATCH = 15;
	final private int INVALID_PINCODE_LENGTH = 13;
	final private int USERDATA_FAILED = 10;
	final private int ACCOUNT_REG_SUCCESS = 1;
	final private int ACCOUNT_DEL_SUCCESS = 3;
	final private int ACCT_UPDATE_SUCCESS = 5;
	final private int USERSECURITYPIN_INVALIDLENGTH = 11;
	final private int USERSECURITYPIN_CONFIRMMISMATCH = 6;
	final private int UPDATEACCTMNG_SUCCESS = 18;
	final private int UPDATEACCTMNG_FAILED = 4;

	private String passcode = "";
	private int clickedBankId;
	private ArrayList listofBanks;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		userInfo = new UserSignInResponse();
		userInfo.UserId = prefs.getString("userId", "");
		userInfo.PaymentAccountId = prefs.getString("paymentAccountId", "");
		showAccountScreen();
	}

	Handler achSetupHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {
			switch (msg.what) {
			/*
			 * case (SETUPACHACCOUNT_FAILED): alertDialog = new
			 * AlertDialog.Builder( AccountManagerActivity.this).create();
			 * alertDialog.setTitle("Setup Failed"); alertDialog
			 * .setMessage("There was an error setting up your ACH account: " +
			 * response.ReasonPhrase + " Please try again.");
			 * alertDialog.setButton("OK", new DialogInterface.OnClickListener()
			 * { public void onClick(DialogInterface dialog, int which) {
			 * dialog.dismiss(); } });
			 * 
			 * alertDialog.show(); break;
			 */
			case (USERREGISTRATION_ACHNUMBERMISMATCH):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("ACH Account Number Mismatch.");
				alertDialog
						.setMessage("The ACH account numbers you entered must match and not be empty. Please try again.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
							}
						});

				alertDialog.show();
				break;

			case (INVALID_PINCODE_LENGTH):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Invalid pincode.");
				alertDialog
						.setMessage("Your pincode consists of 3 pins or greater. Please try again.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
							}
						});

				alertDialog.show();
				break;

			case (UPDATEACCTMNG_SUCCESS):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Updated Accounts.");
				alertDialog
						.setMessage("Your account settings have been updated.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
								finish();
							}
						});

				alertDialog.show();
				break;

			case (UPDATEACCTMNG_FAILED):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Failed to update.");
				alertDialog
						.setMessage("A problem occurred with updating your account settings. Please try again.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
								finish();
							}
						});

				alertDialog.show();
				break;

			case (USERSECURITYPIN_CONFIRMMISMATCH):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Security Pins Mismatch.");
				alertDialog
						.setMessage("The two security pins you just swiped don't match. Please try again.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
							}
						});

				alertDialog.show();
				break;

			case (ACCT_UPDATE_SUCCESS):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Account updated.");
				alertDialog.setMessage("Your account was successfully updated.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
								runOnUiThread(new Runnable() {
									public void run() {
										showAccountScreen();
									}
								});
							}
						});

				alertDialog.show();
				break;

			case (ACCOUNT_REG_SUCCESS):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Added new account.");
				alertDialog.setMessage("Your new account was created.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
								finish();
							}
						});

				alertDialog.show();
				break;

			case (ACCOUNT_DEL_SUCCESS):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Deleted your account.");
				alertDialog.setMessage("Your account was deleted.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
								runOnUiThread(new Runnable() {
									public void run() {
										showAccountScreen();
									}
								});
				alertDialog.show();
							}
						});

				break;

			case (USERDATA_FAILED):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Account data failed.");
				alertDialog
						.setMessage("There was an error with your data. Please try again.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
							}
						});

				alertDialog.show();
				break;

			case (USERSECURITYPIN_INVALIDLENGTH):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Invalid Length");
				alertDialog
						.setMessage("Your pincode must consist of a code of at least 3 inputs.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
							}
						});

				alertDialog.show();
				break;

			// case(USERREGISTRATION_PHONENUMBERFORMATERROR):
			// alertDialog = new AlertDialog.Builder(parent)
			// .create();
			// alertDialog.setTitle("Phone Number Format error.");
			// alertDialog
			// .setMessage("Phone number does not have 10 digits. Please try again.");
			// alertDialog.setButton("OK", new DialogInterface.OnClickListener()
			// {
			// public void onClick(DialogInterface dialog, int which) {
			// dialog.dismiss();
			// }
			// });
			//
			// alertDialog.show();
			// break;
			}

		}

	};

	public void showEditAccount() {
		setContentView(R.layout.achaccountsetup_controller);
		TextView title = (TextView) findViewById(R.id.txtACHTitle);
		title.setText("Edit Account");

		final ACHAccountResponse bankInfo = listofBanks.get(clickedBankId);

		// txtNameOnAccount
		final TextView nicknameonAccount = (TextView) findViewById(R.id.txtNicknameonAcct);
		if (!bankInfo.Nickname.equals("null")) {
			nicknameonAccount.setHint(bankInfo.Nickname);
		}
		final TextView nameonAccount = (TextView) findViewById(R.id.txtNameOnAccount);
		nameonAccount.setHint(bankInfo.NameOnAccount);
		// txtRoutingNumber
		final TextView routingNumber = (TextView) findViewById(R.id.txtRoutingNumber);
		routingNumber.setHint(bankInfo.RoutingNumber);
		// txtAccountNumber
		TextView accountNumber = (TextView) findViewById(R.id.txtAccountNumber);
		accountNumber.setHint("******" + bankInfo.AccountNumber);
		accountNumber.setEnabled(false);
		TextView confirm = (TextView) findViewById(R.id.txtConfirmAccountNumber);
		confirm.setVisibility(View.GONE);

		btnAcctType = (RadioGroup) findViewById(R.id.achBankCategories);
		btnAcctType.setOnCheckedChangeListener(this);
		if (bankInfo.AccountType.equals("Checking")) {
			RadioButton checkings = (RadioButton) findViewById(R.id.achCheckings);
			RadioButton savings = (RadioButton) findViewById(R.id.achSavings);
			checkings.setChecked(true);
			savings.setChecked(false);
		} else {
			RadioButton checkings = (RadioButton) findViewById(R.id.achCheckings);
			RadioButton savings = (RadioButton) findViewById(R.id.achSavings);
			checkings.setChecked(false);
			savings.setChecked(true);
		}

		Button remindLater = (Button) findViewById(R.id.btnRemindMeLater);
				});
		remindLater.setVisibility(View.GONE);

		Button removeButton = (Button) findViewById(R.id.btnremoveACHAcct);
		removeButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				deleteRequest = new ACHAccountDeleteRequest();
				deleteRequest.UserId = prefs.getString("userId", "");
				deleteRequest.BankId = bankInfo.BankId;

				// send pincode to server
				progressDialog.setMessage("Deleting Account...");
				progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
				progressDialog.show();

				Thread thread = new Thread(new Runnable() {

					@Override
					public void run() {
						// TODO Auto-generated method stub
						try {
							response = PaymentAcctService
									.deleteAccount(deleteRequest);
						} catch (Exception e) {
							e.printStackTrace();
						}
						progressDialog.dismiss();

						if (response.Success) {
							setResult(RESULT_OK);
							achSetupHandler
									.sendEmptyMessage(ACCOUNT_DEL_SUCCESS);
						} else {
							achSetupHandler.sendEmptyMessage(USERDATA_FAILED);
						}
					}

				});
				thread.start();
			}

		});

		Button updateButton = (Button) findViewById(R.id.btnSubmitACHAccount);
		updateButton.setText("Update Account");
		updateButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				updateRequest = new ACHAccountUpdateRequest();
				if (nameonAccount.getText().length() > 0) {
					updateRequest.NameOnAccount = nameonAccount.getText()
							.toString().trim();
				} else {
					updateRequest.NameOnAccount = bankInfo.NameOnAccount;
				}
				if (routingNumber.getText().length() > 0) {
					updateRequest.RoutingNumber = routingNumber.getText()
							.toString().trim();
				} else {
					updateRequest.RoutingNumber = bankInfo.RoutingNumber;
				}

				if (nicknameonAccount.getText().length() > 0) {
					updateRequest.Nickname = nicknameonAccount.getText()
							.toString().trim();
				} else {
					updateRequest.Nickname = bankInfo.Nickname;
				}
				if (isCheckingAcct) {
					updateRequest.AccountType = "Checking";

				} else {

					updateRequest.AccountType = "Savings";
				}
				updateRequest.UserId = prefs.getString("userId", "");
				updateRequest.BankId = bankInfo.BankId;

				// send pincode to server
				progressDialog.setMessage("Updating Account...");
				progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
				progressDialog.show();

				Thread thread = new Thread(new Runnable() {

					@Override
					public void run() {
						// TODO Auto-generated method stub
						try {
							updateResponse = PaymentAcctService
									.updateAccount(updateRequest);
						} catch (Exception e) {
							e.printStackTrace();
						}
						progressDialog.dismiss();

						if (updateResponse.Success) {
							setResult(RESULT_OK);
							achSetupHandler
									.sendEmptyMessage(ACCT_UPDATE_SUCCESS);
						} else {
							achSetupHandler.sendEmptyMessage(USERDATA_FAILED);
						}
					}

				thread.start();
			}
		});

		Button back = (Button) findViewById(R.id.btnACHBack);
		back.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				showAccountScreen();
			}

		});

		LinearLayout bottom = (LinearLayout) findViewById(R.id.stepsToCompleteLayout);
		bottom.setVisibility(View.GONE);
	}

	public void showAccountScreen() {
		setContentView(R.layout.account_controller);

		listofBanks = PaymentAcctService.getAccounts(userInfo);

		LinearLayout list = (LinearLayout) findViewById(R.id.bankIDs);
		if (listofBanks != null) {
			for (int i = 0; i < listofBanks.size(); i++) {
				final ACHAccountResponse bank = listofBanks.get(i);

				// add image view then text view
				ImageView img = new ImageView(this);
				img.setImageResource(R.drawable.amt_icon);
				img.setMaxHeight(60);
				img.setMaxWidth(60);
				img.setAdjustViewBounds(true);

				LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
						LinearLayout.LayoutParams.WRAP_CONTENT,
						LinearLayout.LayoutParams.WRAP_CONTENT);

				layoutParams.setMargins(10, 0, 0, 0);
				TextView bankTitle = new TextView(this);
				bankTitle.setWidth(150);
				if (bank.Nickname.equals("null") || bank.Nickname.equals("")) {
					bankTitle.setText(bank.NameOnAccount + " - "
							+ bank.AccountType + " - " + bank.AccountNumber);
				} else {
					bankTitle.setText(bank.Nickname);
				}

				LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(
						LinearLayout.LayoutParams.WRAP_CONTENT,
						LinearLayout.LayoutParams.WRAP_CONTENT);

				layoutParams2.setMargins(20, 0, 0, 0);
				Button editRemove = new Button(this);
				editRemove.setBackgroundDrawable(null);
				editRemove.setTextColor(Color.parseColor("#2FA7C2"));
				editRemove.setText("Edit/Remove");
				editRemove.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {
						for (int j = 0; j < listofBanks.size(); j++) {
							if (bank.AccountNumber == listofBanks.get(j).AccountNumber) {
								clickedBankId = j;
								showEditAccount();
							}
						}
					}

				});

				LinearLayout layout = new LinearLayout(this);
				LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(
						LinearLayout.LayoutParams.WRAP_CONTENT,
						LinearLayout.LayoutParams.WRAP_CONTENT);
				layoutParams3.setMargins(0, 5, 0, 5);
				layout.setLayoutParams(layoutParams3);
				layout.setOrientation(LinearLayout.HORIZONTAL);
				layout.setGravity(Gravity.CENTER);

				layout.addView(img);
				layout.addView(bankTitle, layoutParams);
				layout.addView(editRemove, layoutParams2);

				list.addView(layout);
			}
		}

		addAcct = (Button) findViewById(R.id.bankAddAcct);
		editAcct = (Button) findViewById(R.id.bankUpdateAcct);

		addAcct.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {

				startActivity(new Intent(getApplicationContext(), AddLinkAccountActivity.class));
				finish();

			}

		});

		backAcctBtn = (Button) findViewById(R.id.acct_BackButton);

		backAcctBtn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				finish();
			}

		});

		// create list of bank names
		if (listofBanks != null) {
			ArrayList bankNames = new ArrayList();
			for (int i = 0; i < listofBanks.size(); i++) {
				ACHAccountResponse rep = listofBanks.get(i);
				if (rep.Nickname.equals("null") || rep.Nickname.equals("")) {
					bankNames.add(rep.NameOnAccount + " - " + rep.AccountType
							+ " - " + rep.AccountNumber);
				} else {
					bankNames.add(rep.Nickname);
				}
			}
			ArrayAdapter dataAdapter = new ArrayAdapter(
					getApplicationContext(),
					android.R.layout.simple_spinner_item, bankNames);
			dataAdapter
					.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

			spinnerSendAcct = (Spinner) findViewById(R.id.accountDefaultSendAcct);
			spinnerSendAcct.setAdapter(dataAdapter);

			ArrayAdapter dataAdapter2 = new ArrayAdapter(
					getApplicationContext(),
					android.R.layout.simple_spinner_item, bankNames);
			dataAdapter2
					.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
			spinnerReceiveAcct = (Spinner) findViewById(R.id.accountDefaultReceiveAcct);
			spinnerReceiveAcct.setAdapter(dataAdapter2);
		}

		editAcct.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (listofBanks.size() > 0) {
					String refSend = String.valueOf(spinnerSendAcct
							.getSelectedItem());
					String refReceive = String.valueOf(spinnerReceiveAcct
							.getSelectedItem());
					for (int k = 0; k < listofBanks.size(); k++) {
						String ref = listofBanks.get(k).NameOnAccount + " - "
								+ listofBanks.get(k).AccountType + " - "
								+ listofBanks.get(k).AccountNumber;
						if (refSend.equals(ref)
								|| refSend.equals(listofBanks.get(k).Nickname)) {
							preferredSend = listofBanks.get(k).BankId;
						}
						if (refReceive.equals(ref)
								|| refReceive.equals(listofBanks.get(k).Nickname)) {
							preferredReceive = listofBanks.get(k).BankId;
						}
					}
					confirmPinUpdateAccts();
				} else {
					finish();
				}
			}

		});
	}

	public void confirmPinUpdateAccts() {
		setContentView(R.layout.setup_security_dialog);

		TextView header = (TextView) findViewById(R.id.setupSecurityHeader);
		header.setText("Confirm Your Pin");
		TextView body = (TextView) findViewById(R.id.setupSecurityBody);
		body.setText("Re-enter your security pin in order to continue account creation.");

		final CustomLockView ctrlSecurityPin = (CustomLockView) findViewById(R.id.ctrlSecurityPin);
		ctrlSecurityPin.invalidate();
		ctrlSecurityPin.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {

				String confirmPasscode = ctrlSecurityPin.getPasscode();

				if (confirmPasscode.length() > 3) {
					passcode = confirmPasscode;

					final ACHAccountDetailRequest requestPreferredSend = new ACHAccountDetailRequest();
					final ACHAccountDetailRequest requestPreferredReceive = new ACHAccountDetailRequest();

					requestPreferredSend.UserId = prefs.getString("userId", "");
					requestPreferredSend.AccountId = preferredSend;
					requestPreferredSend.SecurityPin = passcode;
					requestPreferredReceive.UserId = prefs.getString("userId",
							"");
					requestPreferredReceive.AccountId = preferredReceive;
            public void onClick(View v) {
					requestPreferredReceive.SecurityPin = passcode;

					progressDialog.setMessage("Sending Info...");
					progressDialog
							.setProgressStyle(ProgressDialog.STYLE_SPINNER);
					progressDialog.show();

					Thread thread = new Thread(new Runnable() {

						@Override
						public void run() {
							// TODO Auto-generated method stub
							try {
								sendResponse = PaymentAcctService
										.updatePreferredSendAcct(requestPreferredSend);
								receiveResponse = PaymentAcctService
										.updatePreferredReceiveAcct(requestPreferredReceive);
							} catch (Exception e) {
								e.printStackTrace();
							}
							progressDialog.dismiss();

							if (sendResponse.Success && receiveResponse.Success) {
								achSetupHandler
										.sendEmptyMessage(UPDATEACCTMNG_SUCCESS);
							} else {
								achSetupHandler
										.sendEmptyMessage(UPDATEACCTMNG_FAILED);
							}
						}

					});
					thread.start();

				} else {
					achSetupHandler
							.sendEmptyMessage(USERSECURITYPIN_INVALIDLENGTH);
				}
				return false;
			}
		});

	}

	@Override
	public void onCheckedChanged(RadioGroup arg0, int arg1) {
		if (arg1 == R.id.achCheckings) {
			isCheckingAcct = true;
		}
		if (arg1 == R.id.achSavings) {
			isCheckingAcct = false;
		}
	}

	/*
	 * protected void SubmitPaymentRequest() {
	 * 
	 * PaymentRequest paymentRequest = new PaymentRequest();
	 * paymentRequest.UserId = prefs.getString("userId", "");
	 * paymentRequest.SecurityPin = passcode; paymentRequest.SenderUri =
	 * prefs.getString("login", ""); paymentRequest.RecipientUri = recipientUri;
	 * paymentRequest.Amount = amount; paymentRequest.Comments = comments;
	 * paymentRequest.SenderAccountId = prefs.getString("paymentAccountId",
	 * "0");
	 * 
	 * if (location != null) { paymentRequest.Latitude = location.getLatitude();
	 * paymentRequest.Longitude = location.getLongitude(); }
	 * 
	 * paymentResponse = PaymentServices.sendMoney(paymentRequest);
	 * 
	 * }
	 */
=======
OnCheckedChangeListener {

    Button editAcct;
    Button addAcct;
    Button backAcctBtn;
    RadioGroup btnAcctType;
    Spinner spinnerReceiveAcct;
    Spinner spinnerSendAcct;

    private String nameOnAccount;
    private String routingNumber;
    private String accountNumber;
    private String accountType;
    private String questions[];
    private String passcodeCreation;
    private String nickname;

    private String preferredSend;
    private String preferredReceive;

    private int currentId;

    private boolean isCheckingAcct;
    private ACHAccountSetupRequest request;
    private ACHAccountSetupResponse setupResponse;
    private Response response;
    private Response sendResponse;
    private Response receiveResponse;
    private ACHAccountUpdateRequest updateRequest;
    private ACHAccountDeleteRequest deleteRequest;
    private UserSignInResponse userInfo;

    final private int USERREGISTRATION_ACHNUMBERMISMATCH = 15;
    final private int INVALID_PINCODE_LENGTH = 13;
    final private int USERDATA_FAILED = 10;
            @Override
    final private int ACCOUNT_REG_SUCCESS = 1;
    final private int ACCOUNT_DEL_SUCCESS = 3;
    final private int ACCT_UPDATE_SUCCESS = 5;
    final private int USERSECURITYPIN_INVALIDLENGTH = 11;
    final private int USERSECURITYPIN_CONFIRMMISMATCH = 6;
    final private int UPDATEACCTMNG_SUCCESS = 18;
    final private int UPDATEACCTMNG_FAILED = 4;

    private String passcode = "";
    private int clickedBankId;
    private ArrayList listofBanks;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        userInfo = new UserSignInResponse();
        userInfo.UserId = prefs.getString("userId", "");
        userInfo.PaymentAccountId = prefs.getString("paymentAccountId", "");
        showAccountScreen();
    }

    Handler achSetupHandler = new Handler() {

        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
/*
 * case (SETUPACHACCOUNT_FAILED): alertDialog = new
 * AlertDialog.Builder( AccountManagerActivity.this).create();
 * alertDialog.setTitle("Setup Failed"); alertDialog
 * .setMessage("There was an error setting up your ACH account: " +
 * response.ReasonPhrase + " Please try again.");
 * alertDialog.setButton("OK", new DialogInterface.OnClickListener()
 * { public void onClick(DialogInterface dialog, int which) {
 * dialog.dismiss(); } });
 *
 * alertDialog.show(); break;
 */
                case (USERREGISTRATION_ACHNUMBERMISMATCH):
                    alertDialog = new AlertDialog.Builder(
                        AccountManagerActivity.this).create();
                alertDialog.setTitle("ACH Account Number Mismatch.");
                alertDialog
                .setMessage("The ACH account numbers you entered must match and not be empty. Please try again.");
                alertDialog.setButton("OK",
                    new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                        int which) {
                        dialog.dismiss();
                    }
                });

                alertDialog.show();
                break;

                case (INVALID_PINCODE_LENGTH):
                    alertDialog = new AlertDialog.Builder(
                        AccountManagerActivity.this).create();
                alertDialog.setTitle("Invalid pincode.");
                alertDialog
                .setMessage("Your pincode consists of 3 pins or greater. Please try again.");
                alertDialog.setButton("OK",
                    new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                        int which) {
                        dialog.dismiss();
                    }
                });

                alertDialog.show();
                break;

                case (UPDATEACCTMNG_SUCCESS):
                    alertDialog = new AlertDialog.Builder(
                        AccountManagerActivity.this).create();
                alertDialog.setTitle("Updated Accounts.");
                alertDialog
                .setMessage("Your account settings have been updated.");
                alertDialog.setButton("OK",
                    new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                        int which) {
                        dialog.dismiss();
                        finish();
                    }
                });

                alertDialog.show();
                break;

                case (UPDATEACCTMNG_FAILED):
            public void onClick(View v) {
                    alertDialog = new AlertDialog.Builder(
                        AccountManagerActivity.this).create();
                alertDialog.setTitle("Failed to update.");
                alertDialog
                .setMessage("A problem occurred with updating your account settings. Please try again.");
                alertDialog.setButton("OK",
                    new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                        int which) {
                        dialog.dismiss();
                        finish();
                    }
                });

                alertDialog.show();
                break;

                case (USERSECURITYPIN_CONFIRMMISMATCH):
                    alertDialog = new AlertDialog.Builder(
                        AccountManagerActivity.this).create();
                alertDialog.setTitle("Security Pins Mismatch.");
                alertDialog
                .setMessage("The two security pins you just swiped don't match. Please try again.");
                alertDialog.setButton("OK",
                    new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                        int which) {
                        dialog.dismiss();
                    }
                });

                alertDialog.show();
                break;

                case (ACCT_UPDATE_SUCCESS):
                    alertDialog = new AlertDialog.Builder(
                        AccountManagerActivity.this).create();
                alertDialog.setTitle("Account updated.");
                alertDialog.setMessage("Your account was successfully updted.");
                alertDialog.setButton("OK",
                    new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                        int which) {
                        dialog.dismiss();
                        showAccountScreen();
                    }
                });

                alertDialog.show();
                break;

                case (ACCOUNT_REG_SUCCESS):
                    alertDialog = new AlertDialog.Builder(
                        AccountManagerActivity.this).create();
                alertDialog.setTitle("Added new account.");
                alertDialog.setMessage("Your new account was created.");
                alertDialog.setButton("OK",
                    new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                        int which) {
                        dialog.dismiss();
                        finish();
                    }
                });

                alertDialog.show();
                break;

                case (ACCOUNT_DEL_SUCCESS):
                    alertDialog = new AlertDialog.Builder(
                        AccountManagerActivity.this).create();
                alertDialog.setTitle("Deleted your account.");
                alertDialog.setMessage("Your account was deleted.");
                alertDialog.setButton("OK",
                    new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                        int which) {
                        dialog.dismiss();
                        showAccountScreen();
                    }
                });

                alertDialog.show();
                break;

                case (USERDATA_FAILED):
                    alertDialog = new AlertDialog.Builder(
                        AccountManagerActivity.this).create();
                alertDialog.setTitle("Account data failed.");
                alertDialog
                .setMessage("There was an error with your data. Please try again.");
                alertDialog.setButton("OK",
                    new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                        int which) {
                        dialog.dismiss();
                    }
                });

                alertDialog.show();
                break;

                case (USERSECURITYPIN_INVALIDLENGTH):
                    alertDialog = new AlertDialog.Builder(
                        AccountManagerActivity.this).create();
                alertDialog.setTitle("Invalid Length");
                alertDialog
                .setMessage("Your pincode must consist of a code of at least 3 inputs.");
                alertDialog.setButton("OK",
                    new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                        int which) {
                        dialog.dismiss();
                    }
                });

                alertDialog.show();
                break;

// case(USERREGISTRATION_PHONENUMBERFORMATERROR):
// alertDialog = new AlertDialog.Builder(parent)
// .create();
// alertDialog.setTitle("Phone Number Format error.");
// alertDialog
// .setMessage("Phone number does not have 10 digits. Please try again.");
// alertDialog.setButton("OK", new DialogInterface.OnClickListener()
// {
// public void onClick(DialogInterface dialog, int which) {
// dialog.dismiss();
// }
// });
//
// alertDialog.show();
// break;
            }

        }

    };

    public void showEditAccount() {
        setContentView(R.layout.achaccountsetup_controller);
        TextView title = (TextView) findViewById(R.id.txtACHTitle);
        title.setText("Edit Account");

        final ACHAccountResponse bankInfo = listofBanks.get(clickedBankId);

// txtNameOnAccount
        final TextView nicknameonAccount = (TextView) findViewById(R.id.txtNicknameonAcct);
        nicknameonAccount.setHint(bankInfo.Nickname);
        final TextView nameonAccount = (TextView) findViewById(R.id.txtNameOnAccount);
        nameonAccount.setHint(bankInfo.NameOnAccount);
// txtRoutingNumber
        final TextView routingNumber = (TextView) findViewById(R.id.txtRoutingNumber);
        routingNumber.setHint(bankInfo.RoutingNumber);
// txtAccountNumber
        TextView accountNumber = (TextView) findViewById(R.id.txtAccountNumber);
        accountNumber.setHint("******" + bankInfo.AccountNumber);
        accountNumber.setEnabled(false);
        TextView confirm = (TextView) findViewById(R.id.txtConfirmAccountNumber);
        confirm.setVisibility(View.GONE);

        btnAcctType = (RadioGroup) findViewById(R.id.achBankCategories);
        btnAcctType.setOnCheckedChangeListener(this);
        if (bankInfo.AccountType.equals("Checking")) {
            RadioButton checkings = (RadioButton) findViewById(R.id.achCheckings);
            RadioButton savings = (RadioButton) findViewById(R.id.achSavings);
            checkings.setChecked(true);
            savings.setChecked(false);
        } else {
            RadioButton checkings = (RadioButton) findViewById(R.id.achCheckings);
            RadioButton savings = (RadioButton) findViewById(R.id.achSavings);
            checkings.setChecked(false);
            savings.setChecked(true);
        }

        Button remindLater = (Button) findViewById(R.id.btnRemindMeLater);
        remindLater.setVisibility(View.GONE);

        Button removeButton = (Button) findViewById(R.id.btnremoveACHAcct);
        removeButton.setOnClickListener(new OnClickListener() {

            @Override
                deleteRequest = new ACHAccountDeleteRequest();
                deleteRequest.UserId = prefs.getString("userId", "");
                deleteRequest.BankId = bankInfo.BankId;

// send pincode to server
                progressDialog.setMessage("Deleting Account...");
                progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                progressDialog.show();

                Thread thread = new Thread(new Runnable() {

                    @Override
                    public void run() {
// TODO Auto-generated method stub
                        try {
                            response = PaymentAcctService
                                .deleteAccount(deleteRequest);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        progressDialog.dismiss();

                        if (response.Success) {
                            setResult(RESULT_OK);
                            achSetupHandler
                            .sendEmptyMessage(ACCOUNT_DEL_SUCCESS);
                        } else {
                            achSetupHandler.sendEmptyMessage(USERDATA_FAILED);
                        }
                    }

                });
                thread.start();
            }

        });

        Button updateButton = (Button) findViewById(R.id.btnSubmitACHAccount);
        updateButton.setText("Update Account");
        updateButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                updateRequest = new ACHAccountUpdateRequest();
                updateRequest.NameOnAccount = nameonAccount.getText()
                    .toString().trim();
                updateRequest.RoutingNumber = routingNumber.getText()
                    .toString().trim();
                updateRequest.Nickname = nicknameonAccount.getText().toString()
                    .trim();
                if (isCheckingAcct) {
                    updateRequest.AccountType = "Checking";

                } else {

                    updateRequest.AccountType = "Savings";
                }
                updateRequest.UserId = prefs.getString("userId", "");
                updateRequest.BankId = bankInfo.BankId;

// send pincode to server
                progressDialog.setMessage("Updating Account...");
                progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                progressDialog.show();

                Thread thread = new Thread(new Runnable() {

                    @Override
                    public void run() {
// TODO Auto-generated method stub
                        try {
                            response = PaymentAcctService
                                .updateAccount(updateRequest);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        progressDialog.dismiss();

                        if (response.Success) {
                            setResult(RESULT_OK);
                            achSetupHandler
                            .sendEmptyMessage(ACCT_UPDATE_SUCCESS);
                        } else {
                            achSetupHandler.sendEmptyMessage(USERDATA_FAILED);
                        }
                    }

                });
                thread.start();
            }
        });

        Button back = (Button) findViewById(R.id.btnACHBack);
        back.setOnClickListener(new OnClickListener() {

                showAccountScreen();
            }

        });

        LinearLayout bottom = (LinearLayout) findViewById(R.id.stepsToCompleteLayout);
        bottom.setVisibility(View.GONE);
    }

    public void showAddAccounts() {
        setContentView(R.layout.achaccountsetup_controller);
        TextView title = (TextView) findViewById(R.id.txtACHTitle);
        title.setText("Add Account");

        btnAcctType = (RadioGroup) findViewById(R.id.achBankCategories);
        btnAcctType.setOnCheckedChangeListener(this);

        Button remindLater = (Button) findViewById(R.id.btnRemindMeLater);
        remindLater.setVisibility(View.GONE);
        Button removeButton = (Button) findViewById(R.id.btnremoveACHAcct);
        removeButton.setVisibility(View.GONE);
        LinearLayout bottom = (LinearLayout) findViewById(R.id.stepsToCompleteLayout);
        bottom.setVisibility(View.GONE);

        Button addAccount = (Button) findViewById(R.id.btnSubmitACHAccount);
        addAccount.setOnClickListener(new OnClickListener() {
            public void onClick(View argO) {
                EditText txtNameOnAccount = (EditText) findViewById(R.id.txtNameOnAccount);
                EditText txtRoutingNumber = (EditText) findViewById(R.id.txtRoutingNumber);
                EditText txtAccountNumber = (EditText) findViewById(R.id.txtAccountNumber);
                EditText txtNickname = (EditText) findViewById(R.id.txtNicknameonAcct);

                if (txtAccountNumber
                    .getText()
                    .toString()
                    .trim()
                    .equals(((EditText) findViewById(R.id.txtConfirmAccountNumber))
                        .getText().toString().trim())
                        && (txtAccountNumber.getText().toString().length() != 0)) {

                    nameOnAccount = txtNameOnAccount.getText().toString()
                        .trim();
                    routingNumber = txtRoutingNumber.getText().toString()
                        .trim();
                    accountNumber = txtAccountNumber.getText().toString()
                        .trim();
                    nickname = txtNickname.getText().toString().trim();
                    if (isCheckingAcct) {
                        accountType = "Checking";
                    } else {
                        accountType = "Savings";
                    }

                    if (userInfo.PaymentAccountId.length() != 0
                        || (listofBanks != null && listofBanks.size() > 0)) {
// user has security pin
// 1.) confirm pin
// 2.) confirm question
                        confirmPin();
                    } else {
// user does not have security pin
// 1.) show setup pin creation screen
// 2.) show create question screen
                        confirmCreation();
                    }
                } else {
                    achSetupHandler
                    .sendEmptyMessage(USERREGISTRATION_ACHNUMBERMISMATCH);
                }
            }
        });

        Button back = (Button) findViewById(R.id.btnACHBack);
        back.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                showAccountScreen();
            }

        });

    }

    public void showAccountScreen() {
        setContentView(R.layout.account_controller);

        listofBanks = PaymentAcctService.getAccounts(userInfo);

        LinearLayout list = (LinearLayout) findViewById(R.id.bankIDs);
        if (listofBanks != null) {

            for (int i = 0; i < listofBanks.size(); i++) {
            @Override
                final ACHAccountResponse bank = listofBanks.get(i);

// add image view then text view
                ImageView img = new ImageView(this);
                img.setImageResource(R.drawable.amt_icon);
                img.setMaxHeight(60);
                img.setMaxWidth(60);
                img.setAdjustViewBounds(true);

                LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.WRAP_CONTENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT);

                layoutParams.setMargins(10, 0, 0, 0);
                TextView bankTitle = new TextView(this);
                bankTitle.setWidth(150);
                if (bank.Nickname.equals("null") || bank.Nickname.equals("")) {
                    bankTitle.setText(bank.NameOnAccount + " - "
                        + bank.AccountType + " - " + bank.AccountNumber);
                } else {
                    bankTitle.setText(bank.Nickname);
                }

                LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.WRAP_CONTENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT);

                layoutParams2.setMargins(20, 0, 0, 0);
                Button editRemove = new Button(this);
                editRemove.setBackgroundDrawable(null);
                editRemove.setTextColor(Color.parseColor("#2FA7C2"));
                editRemove.setText("Edit/Remove");
                editRemove.setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        for (int j = 0; j < listofBanks.size(); j++) {
                            if (bank.AccountNumber == listofBanks.get(j).AccountNumber) {
                                clickedBankId = j;
                                showEditAccount();
                            }
                        }
                    }

                });

                LinearLayout layout = new LinearLayout(this);
                LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.WRAP_CONTENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT);
                layoutParams3.setMargins(0, 5, 0, 5);
                layout.setLayoutParams(layoutParams3);
                layout.setOrientation(LinearLayout.HORIZONTAL);
                layout.setGravity(Gravity.CENTER);

                layout.addView(img);
                layout.addView(bankTitle, layoutParams);
                layout.addView(editRemove, layoutParams2);

                list.addView(layout);
            }
        }

        addAcct = (Button) findViewById(R.id.bankAddAcct);
        editAcct = (Button) findViewById(R.id.bankUpdateAcct);

        addAcct.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {

                showAddAccounts();

            }

        });

        backAcctBtn = (Button) findViewById(R.id.acct_BackButton);
        backAcctBtn.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                finish();
            }

        });

// create list of bank names
        if (listofBanks != null) {
            ArrayList bankNames = new ArrayList();
            for (int i = 0; i < listofBanks.size(); i++) {
                ACHAccountResponse rep = listofBanks.get(i);
                if (rep.Nickname.equals("null") || rep.Nickname.equals("")) {
                    bankNames.add(rep.NameOnAccount + " - " + rep.AccountType
                        + " - " + rep.AccountNumber);
                } else {
                    bankNames.add(rep.Nickname);
                }
            }
            ArrayAdapter dataAdapter = new ArrayAdapter(
                getApplicationContext(),
                android.R.layout.simple_spinner_item, bankNames);
            dataAdapter
            .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

            spinnerSendAcct = (Spinner) findViewById(R.id.accountDefaultSendAcct);
            spinnerSendAcct.setAdapter(dataAdapter);

            ArrayAdapter dataAdapter2 = new ArrayAdapter(
                getApplicationContext(),
                android.R.layout.simple_spinner_item, bankNames);
            dataAdapter2
            .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            spinnerReceiveAcct = (Spinner) findViewById(R.id.accountDefaultReceiveAcct);
            spinnerReceiveAcct.setAdapter(dataAdapter2);
        }

        editAcct.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                if (listofBanks.size() > 0) {
                    String refSend = String.valueOf(spinnerSendAcct
                        .getSelectedItem());
                    String refReceive = String.valueOf(spinnerReceiveAcct
                        .getSelectedItem());
                    for (int k = 0; k < listofBanks.size(); k++) {
                        String ref = listofBanks.get(k).NameOnAccount + " - "
                            + listofBanks.get(k).AccountType + " - "
                            + listofBanks.get(k).AccountNumber;
                        if (refSend.equals(ref)
                            || refSend.equals(listofBanks.get(k).Nickname)) {
                            preferredSend = listofBanks.get(k).BankId;
                        }
                        if (refReceive.equals(ref)
                            || refReceive.equals(listofBanks.get(k).Nickname)) {
                            preferredReceive = listofBanks.get(k).BankId;
                        }
                    }
                    confirmPinUpdateAccts();
                } else {
                    finish();
                }
            }

        });
    }

    public void confirmCreation() {
        setContentView(R.layout.setup_security_controller);

        Button btnSetupSecurityPin = (Button) findViewById(R.id.btnSetupSecurityPin);
        btnSetupSecurityPin.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                createSecurityPin();
            }

        });
    }

    public void createSecurityPin() {
        setContentView(R.layout.setup_security_dialog);

        final CustomLockView ctrlSecurityPin = (CustomLockView) findViewById(R.id.ctrlSecurityPin);
        ctrlSecurityPin.invalidate();
        ctrlSecurityPin.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {

                passcode = ctrlSecurityPin.getPasscode();

                if (passcode.length() > 3) {
                    confirmPin();
                } else
                    achSetupHandler
                    .sendEmptyMessage(USERSECURITYPIN_INVALIDLENGTH);

                return false;

            }
        });
    }


    public void confirmPin() {
        setContentView(R.layout.setup_security_dialog);

        TextView header = (TextView) findViewById(R.id.setupSecurityHeader);
        header.setText("Confirm Your Pin");
        TextView body = (TextView) findViewById(R.id.setupSecurityBody);
        body.setText("Re-enter your security pin in order to continue account creation.");

        final CustomLockView ctrlSecurityPin = (CustomLockView) findViewById(R.id.ctrlSecurityPin);
        ctrlSecurityPin.invalidate();
        ctrlSecurityPin.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {

                String confirmPasscode = ctrlSecurityPin.getPasscode();

                if (confirmPasscode.length() > 3) {
                    if (userInfo.PaymentAccountId.length() != 0
                        || (listofBanks != null && listofBanks.size() > 0)) {
                        passcode = confirmPasscode;
                        createQuestion();
                    } else {

                        if (confirmPasscode.equals(passcode)) {
                            final SecurityPinSetupRequest setupSecurityPin = new SecurityPinSetupRequest();
                            setupSecurityPin.SecurityPin = passcode;
                            setupSecurityPin.UserId = prefs.getString("userId",
                                "");

// send pincode to server
                            progressDialog.setMessage("Sending Info...");
                            progressDialog
                            .setProgressStyle(ProgressDialog.STYLE_SPINNER);
                            progressDialog.show();

                            Thread thread = new Thread(new Runnable() {

                                @Override
                                public void run() {
// TODO Auto-generated method stub
                                    try {
                                        response = UserService
                                            .setupSecurityPin(setupSecurityPin);
                                    } catch (Exception e) {
                                        e.printStackTrace();
                                    }
                                    progressDialog.dismiss();

                                    if (response.Success) {
                                        runOnUiThread(new Runnable() {
                                            public void run() {

                                                createQuestion();

                                            }
                                        });
                                    } else {
                                        achSetupHandler
                                        .sendEmptyMessage(USERDATA_FAILED);
                                    }
                                }

                            });
                            thread.start();

                        } else {
                            achSetupHandler
                            .sendEmptyMessage(USERSECURITYPIN_CONFIRMMISMATCH);
                        }
                    }
                } else
                    achSetupHandler
                    .sendEmptyMessage(USERSECURITYPIN_INVALIDLENGTH);

                return false;

            }
        });

    }

    public void confirmPinUpdateAccts() {
        setContentView(R.layout.setup_security_dialog);

        TextView header = (TextView) findViewById(R.id.setupSecurityHeader);
        header.setText("Confirm Your Pin");
        TextView body = (TextView) findViewById(R.id.setupSecurityBody);
        body.setText("Re-enter your security pin in order to continue account creation.");

        list.addChangingListener(new OnWheelChangedListener() {
        final CustomLockView ctrlSecurityPin = (CustomLockView) findViewById(R.id.ctrlSecurityPin);
        ctrlSecurityPin.invalidate();
        ctrlSecurityPin.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {

                String confirmPasscode = ctrlSecurityPin.getPasscode();

                if (confirmPasscode.length() > 3) {
                    passcode = confirmPasscode;

                    final ACHAccountDetailRequest requestPreferredSend = new ACHAccountDetailRequest();
                    final ACHAccountDetailRequest requestPreferredReceive = new ACHAccountDetailRequest();

                    requestPreferredSend.UserId = prefs.getString("userId", "");
                    requestPreferredSend.AccountId = preferredSend;
                    requestPreferredSend.SecurityPin = passcode;
                    requestPreferredReceive.UserId = prefs.getString("userId",
                        "");
                    requestPreferredReceive.AccountId = preferredReceive;
                    requestPreferredReceive.SecurityPin = passcode;

                    progressDialog.setMessage("Sending Info...");
                    progressDialog
                    .setProgressStyle(ProgressDialog.STYLE_SPINNER);
                    progressDialog.show();

                    Thread thread = new Thread(new Runnable() {

                        @Override
                        public void run() {
// TODO Auto-generated method stub
                            try {
                                sendResponse = PaymentAcctService
                                    .updatePreferredSendAcct(requestPreferredSend);
                                receiveResponse = PaymentAcctService
                                    .updatePreferredReceiveAcct(requestPreferredReceive);
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                            progressDialog.dismiss();

                            if (sendResponse.Success && receiveResponse.Success) {
                                achSetupHandler.sendEmptyMessage(UPDATEACCTMNG_SUCCESS);
                            } else {
                                achSetupHandler
                                .sendEmptyMessage(UPDATEACCTMNG_FAILED);
                            }
                        }

                    });
                    thread.start();

                } else {
                    achSetupHandler
                    .sendEmptyMessage(USERSECURITYPIN_INVALIDLENGTH);
                }
                return false;
            }
        });

    }

    public void createQuestion() {
        setContentView(R.layout.create_security_question);

        if (userInfo.PaymentAccountId.length() != 0
            || (listofBanks != null && listofBanks.size() > 0)) {
            TextView body = (TextView) findViewById(R.id.securityQuestionBody);
            body.setText("Choose your previously created security question and answer it in order to confirm your new account creation.");
        }

        final TextView txtAnswer = (TextView) findViewById(R.id.security_question_selected);

        final WheelView list = (WheelView) findViewById(R.id.security_question_list);

        int curr = 1;
        final ArrayList securityQuestions = UserService
            .getSecurityQuestions();
        questions = new String[securityQuestions.size()];
        for (int i = 0; i < securityQuestions.size(); i++) {
            questions[i] = securityQuestions.get(i).Question;
        }
        ArrayWheelAdapter adapter = new ArrayWheelAdapter(this,
            questions);
        adapter.setTextSize(14);
        list.setViewAdapter(adapter);
        list.setCurrentItem(curr);
            public void onChanged(WheelView wheel, int oldValue, int newValue) {
                txtAnswer.setText(questions[newValue]);
                currentId = newValue;
            }

        });

        Button confirmBtn = (Button) findViewById(R.id.securityquestion_confirmbtn);
        confirmBtn.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                EditText userAnswer = (EditText) findViewById(R.id.setupSecurityTxtAnswer);
                String answer = userAnswer.getText().toString().trim();

                request = new ACHAccountSetupRequest();
                request.AccountNumber = accountNumber;
                request.AccountType = accountType;
                request.NameOnAccount = nameOnAccount;
                request.RoutingNumber = routingNumber;
                request.SecurityPin = passcode;
                request.SecurityAnswer = answer;
                request.SecurityQuestionId = currentId;
                request.Nickname = nickname;
                request.UserId = prefs.getString("userId", "");

                progressDialog.setMessage("Sending Info...");
                progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                progressDialog.show();

                Thread thread = new Thread(new Runnable() {

                    @Override
                    public void run() {
// TODO Auto-generated method stub
                        try {
                            setupResponse = UserService
                                .setupACHAccount(request);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        progressDialog.dismiss();

                        if (setupResponse.Success) {
                            if (userInfo.PaymentAccountId.length() != 0
                                || (listofBanks != null && listofBanks
                                .size() > 0)) {
                                runOnUiThread(new Runnable() {
                                    public void run() {
                                        Editor editor = prefs.edit();
                                        editor.remove("paymentAccountId");
                                        editor.putString("paymentAccountId",
                                            setupResponse.PaymentAccountId);
                                        editor.commit();
                                    }
                                });
                            }
                            achSetupHandler
                            .sendEmptyMessage(ACCOUNT_REG_SUCCESS);
                        } else {
                            achSetupHandler.sendEmptyMessage(USERDATA_FAILED);
                        }
                    }

                });
                thread.start();
            }

        });
    }

    @Override
    public void onCheckedChanged(RadioGroup arg0, int arg1) {
        if (arg1 == R.id.achCheckings) {
            isCheckingAcct = true;
        }
        if (arg1 == R.id.achSavings) {
            isCheckingAcct = false;
        }
    }

/*
 * protected void SubmitPaymentRequest() {
 *
 * PaymentRequest paymentRequest = new PaymentRequest();
 * paymentRequest.UserId = prefs.getString("userId", "");
 * paymentRequest.SecurityPin = passcode; paymentRequest.SenderUri =
 * prefs.getString("login", ""); paymentRequest.RecipientUri = recipientUri;
 * paymentRequest.Amount = amount; paymentRequest.Comments = comments;
 * paymentRequest.SenderAccountId = prefs.getString("paymentAccountId",
 * "0");
 *
 * if (location != null) { paymentRequest.Latitude = location.getLatitude();
 * paymentRequest.Longitude = location.getLongitude(); }
 *
 * paymentResponse = PaymentServices.sendMoney(paymentRequest);
 *
 * }
 */
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
}
Solution content
							}
						});
import android.widget.RadioGroup.OnCheckedChangeListener;

public class AccountManagerActivity extends BaseActivity implements
		OnCheckedChangeListener {

	Button editAcct;
	Button addAcct;
	Button backAcctBtn;
	RadioGroup btnAcctType;
	Spinner spinnerReceiveAcct;
	Spinner spinnerSendAcct;

	private String preferredSend;

				alertDialog.show();
				break;
							}
						}

						try {
					}

				});


				alertDialog.show();
			 * alertDialog.setTitle("Setup Failed"); alertDialog
				break;
	private String preferredReceive;

	private boolean isCheckingAcct;
	private Response response;
	private ACHAccountResponse updateResponse;
	private Response sendResponse;
	private Response receiveResponse;
	private ACHAccountUpdateRequest updateRequest;
	private ACHAccountDeleteRequest deleteRequest;
	private UserSignInResponse userInfo;

	final private int USERREGISTRATION_ACHNUMBERMISMATCH = 15;
	final private int INVALID_PINCODE_LENGTH = 13;
	final private int USERDATA_FAILED = 10;
	final private int ACCOUNT_REG_SUCCESS = 1;
	final private int ACCOUNT_DEL_SUCCESS = 3;
	final private int ACCT_UPDATE_SUCCESS = 5;
	final private int USERSECURITYPIN_INVALIDLENGTH = 11;
	final private int USERSECURITYPIN_CONFIRMMISMATCH = 6;
	final private int UPDATEACCTMNG_SUCCESS = 18;
	final private int UPDATEACCTMNG_FAILED = 4;

	private String passcode = "";
	private int clickedBankId;
	private ArrayList listofBanks;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		userInfo = new UserSignInResponse();
		userInfo.UserId = prefs.getString("userId", "");
		userInfo.PaymentAccountId = prefs.getString("paymentAccountId", "");
		showAccountScreen();
	}

	Handler achSetupHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {
			switch (msg.what) {
			/*
			 * case (SETUPACHACCOUNT_FAILED): alertDialog = new
			 * AlertDialog.Builder( AccountManagerActivity.this).create();
			 * .setMessage("There was an error setting up your ACH account: " +
			 * response.ReasonPhrase + " Please try again.");
			 * alertDialog.setButton("OK", new DialogInterface.OnClickListener()
			 * { public void onClick(DialogInterface dialog, int which) {
			 * dialog.dismiss(); } });
			 * 
			 * alertDialog.show(); break;
			 */
			case (USERREGISTRATION_ACHNUMBERMISMATCH):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("ACH Account Number Mismatch.");
				alertDialog
						.setMessage("The ACH account numbers you entered must match and not be empty. Please try again.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
							}
						});

				alertDialog.show();
				break;

			case (INVALID_PINCODE_LENGTH):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Invalid pincode.");
				alertDialog
						.setMessage("Your pincode consists of 3 pins or greater. Please try again.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
							}
						});

				alertDialog.show();
				break;

			case (UPDATEACCTMNG_SUCCESS):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Updated Accounts.");
				alertDialog
						.setMessage("Your account settings have been updated.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
								finish();
							}
						});
			case (UPDATEACCTMNG_FAILED):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Failed to update.");
				alertDialog
						.setMessage("A problem occurred with updating your account settings. Please try again.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
								finish();
							}
						});

				alertDialog.show();
				break;

			case (USERSECURITYPIN_CONFIRMMISMATCH):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Security Pins Mismatch.");
				alertDialog
						.setMessage("The two security pins you just swiped don't match. Please try again.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
							}
						});

				alertDialog.show();
				break;

			case (ACCT_UPDATE_SUCCESS):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Account updated.");
				alertDialog.setMessage("Your account was successfully updated.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
								runOnUiThread(new Runnable() {
									public void run() {
										showAccountScreen();
									}
								});
							}
						});

				alertDialog.show();
				break;

			case (ACCOUNT_REG_SUCCESS):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Added new account.");
				alertDialog.setMessage("Your new account was created.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
								finish();
							}
						});

				alertDialog.show();
				break;

			case (ACCOUNT_DEL_SUCCESS):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Deleted your account.");
				alertDialog.setMessage("Your account was deleted.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
								runOnUiThread(new Runnable() {
									public void run() {
										showAccountScreen();
									}
								});
							}
						});

				alertDialog.show();
				break;

			case (USERDATA_FAILED):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Account data failed.");
				alertDialog
						.setMessage("There was an error with your data. Please try again.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
			case (USERSECURITYPIN_INVALIDLENGTH):
				alertDialog = new AlertDialog.Builder(
						AccountManagerActivity.this).create();
				alertDialog.setTitle("Invalid Length");
				alertDialog
						.setMessage("Your pincode must consist of a code of at least 3 inputs.");
				alertDialog.setButton("OK",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								dialog.dismiss();
							}
						});

				alertDialog.show();
				break;

			// case(USERREGISTRATION_PHONENUMBERFORMATERROR):
			// alertDialog = new AlertDialog.Builder(parent)
			// .create();
			// alertDialog.setTitle("Phone Number Format error.");
			// alertDialog
			// .setMessage("Phone number does not have 10 digits. Please try again.");
			// alertDialog.setButton("OK", new DialogInterface.OnClickListener()
			// {
			// public void onClick(DialogInterface dialog, int which) {
			// dialog.dismiss();
			// }
			// });
			//
			// alertDialog.show();
			// break;
			}

		}

	};

	public void showEditAccount() {
		setContentView(R.layout.achaccountsetup_controller);
		TextView title = (TextView) findViewById(R.id.txtACHTitle);
		title.setText("Edit Account");

		final ACHAccountResponse bankInfo = listofBanks.get(clickedBankId);

		// txtNameOnAccount
					updateRequest.Nickname = bankInfo.Nickname;
		final TextView nicknameonAccount = (TextView) findViewById(R.id.txtNicknameonAcct);
		if (!bankInfo.Nickname.equals("null")) {
			nicknameonAccount.setHint(bankInfo.Nickname);
		}
		final TextView nameonAccount = (TextView) findViewById(R.id.txtNameOnAccount);
		nameonAccount.setHint(bankInfo.NameOnAccount);
		// txtRoutingNumber
		final TextView routingNumber = (TextView) findViewById(R.id.txtRoutingNumber);
		routingNumber.setHint(bankInfo.RoutingNumber);
		// txtAccountNumber
		TextView accountNumber = (TextView) findViewById(R.id.txtAccountNumber);
		accountNumber.setHint("******" + bankInfo.AccountNumber);
		accountNumber.setEnabled(false);
		TextView confirm = (TextView) findViewById(R.id.txtConfirmAccountNumber);
		confirm.setVisibility(View.GONE);

		btnAcctType = (RadioGroup) findViewById(R.id.achBankCategories);
		btnAcctType.setOnCheckedChangeListener(this);
		if (bankInfo.AccountType.equals("Checking")) {
			RadioButton checkings = (RadioButton) findViewById(R.id.achCheckings);
			RadioButton savings = (RadioButton) findViewById(R.id.achSavings);
			checkings.setChecked(true);
			savings.setChecked(false);
		} else {
			RadioButton checkings = (RadioButton) findViewById(R.id.achCheckings);
			RadioButton savings = (RadioButton) findViewById(R.id.achSavings);
			checkings.setChecked(false);
			savings.setChecked(true);
		}

		Button remindLater = (Button) findViewById(R.id.btnRemindMeLater);
		remindLater.setVisibility(View.GONE);

		Button removeButton = (Button) findViewById(R.id.btnremoveACHAcct);
		removeButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				deleteRequest = new ACHAccountDeleteRequest();
				deleteRequest.UserId = prefs.getString("userId", "");
				deleteRequest.BankId = bankInfo.BankId;

				// send pincode to server
				progressDialog.setMessage("Deleting Account...");
				progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
				progressDialog.show();

				Thread thread = new Thread(new Runnable() {

					@Override
					public void run() {
						// TODO Auto-generated method stub
				}
							response = PaymentAcctService
									.deleteAccount(deleteRequest);
						} catch (Exception e) {
							e.printStackTrace();
						}
						progressDialog.dismiss();

						if (response.Success) {
							setResult(RESULT_OK);
							achSetupHandler
									.sendEmptyMessage(ACCOUNT_DEL_SUCCESS);
						} else {
							achSetupHandler.sendEmptyMessage(USERDATA_FAILED);
						}
					}

				});
				thread.start();
			}

		});

		Button updateButton = (Button) findViewById(R.id.btnSubmitACHAccount);
		updateButton.setText("Update Account");
		updateButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				updateRequest = new ACHAccountUpdateRequest();
				if (nameonAccount.getText().length() > 0) {
					updateRequest.NameOnAccount = nameonAccount.getText()
							.toString().trim();
				} else {
					updateRequest.NameOnAccount = bankInfo.NameOnAccount;
				}
				if (routingNumber.getText().length() > 0) {
					updateRequest.RoutingNumber = routingNumber.getText()
							.toString().trim();
				} else {
					updateRequest.RoutingNumber = bankInfo.RoutingNumber;
				}

				if (nicknameonAccount.getText().length() > 0) {
					updateRequest.Nickname = nicknameonAccount.getText()
							.toString().trim();
				} else {
				if (isCheckingAcct) {
					updateRequest.AccountType = "Checking";

				} else {

					updateRequest.AccountType = "Savings";
				}
				updateRequest.UserId = prefs.getString("userId", "");
				updateRequest.BankId = bankInfo.BankId;

				// send pincode to server
				progressDialog.setMessage("Updating Account...");
				progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
				progressDialog.show();

				Thread thread = new Thread(new Runnable() {

					@Override
					public void run() {
						// TODO Auto-generated method stub
						try {
							updateResponse = PaymentAcctService
									.updateAccount(updateRequest);
						} catch (Exception e) {
							e.printStackTrace();
						}
						progressDialog.dismiss();

						if (updateResponse.Success) {
							setResult(RESULT_OK);
							achSetupHandler
									.sendEmptyMessage(ACCT_UPDATE_SUCCESS);
						} else {
							achSetupHandler.sendEmptyMessage(USERDATA_FAILED);
						}
					}

				});
				thread.start();
			}
		});

		Button back = (Button) findViewById(R.id.btnACHBack);
		back.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				showAccountScreen();
			}

		});

		LinearLayout bottom = (LinearLayout) findViewById(R.id.stepsToCompleteLayout);
		bottom.setVisibility(View.GONE);
	}

	public void showAccountScreen() {
		setContentView(R.layout.account_controller);

		listofBanks = PaymentAcctService.getAccounts(userInfo);

		LinearLayout list = (LinearLayout) findViewById(R.id.bankIDs);
		if (listofBanks != null) {
			for (int i = 0; i < listofBanks.size(); i++) {
				final ACHAccountResponse bank = listofBanks.get(i);

				// add image view then text view
				ImageView img = new ImageView(this);
				img.setImageResource(R.drawable.amt_icon);
				img.setMaxHeight(60);
				img.setMaxWidth(60);
				img.setAdjustViewBounds(true);

				LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
						LinearLayout.LayoutParams.WRAP_CONTENT,
						LinearLayout.LayoutParams.WRAP_CONTENT);

				layoutParams.setMargins(10, 0, 0, 0);
				TextView bankTitle = new TextView(this);
				bankTitle.setWidth(150);
				if (bank.Nickname.equals("null") || bank.Nickname.equals("")) {
					bankTitle.setText(bank.NameOnAccount + " - "
							+ bank.AccountType + " - " + bank.AccountNumber);
				} else {
					bankTitle.setText(bank.Nickname);
				}

				LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(
						LinearLayout.LayoutParams.WRAP_CONTENT,
						LinearLayout.LayoutParams.WRAP_CONTENT);

				layoutParams2.setMargins(20, 0, 0, 0);
				Button editRemove = new Button(this);
				editRemove.setBackgroundDrawable(null);
				editRemove.setTextColor(Color.parseColor("#2FA7C2"));
				editRemove.setText("Edit/Remove");
				editRemove.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {
						for (int j = 0; j < listofBanks.size(); j++) {
							if (bank.AccountNumber == listofBanks.get(j).AccountNumber) {
								clickedBankId = j;
								showEditAccount();
				LinearLayout layout = new LinearLayout(this);
				LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(
						LinearLayout.LayoutParams.WRAP_CONTENT,
						LinearLayout.LayoutParams.WRAP_CONTENT);
				layoutParams3.setMargins(0, 5, 0, 5);
				layout.setLayoutParams(layoutParams3);
				layout.setOrientation(LinearLayout.HORIZONTAL);
				layout.setGravity(Gravity.CENTER);

				layout.addView(img);
				layout.addView(bankTitle, layoutParams);
				layout.addView(editRemove, layoutParams2);

				list.addView(layout);
			}
		}

		addAcct = (Button) findViewById(R.id.bankAddAcct);
		editAcct = (Button) findViewById(R.id.bankUpdateAcct);

		addAcct.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {

				startActivity(new Intent(getApplicationContext(), AddLinkAccountActivity.class));
				finish();

			}

		});

		backAcctBtn = (Button) findViewById(R.id.acct_BackButton);
		backAcctBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}

		});

		// create list of bank names
		if (listofBanks != null) {
			ArrayList bankNames = new ArrayList();
			for (int i = 0; i < listofBanks.size(); i++) {
				ACHAccountResponse rep = listofBanks.get(i);
				if (rep.Nickname.equals("null") || rep.Nickname.equals("")) {
					bankNames.add(rep.NameOnAccount + " - " + rep.AccountType
							+ " - " + rep.AccountNumber);
				} else {
					bankNames.add(rep.Nickname);
				}
			}
			ArrayAdapter dataAdapter = new ArrayAdapter(
					getApplicationContext(),
					android.R.layout.simple_spinner_item, bankNames);
			dataAdapter
					.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

			spinnerSendAcct = (Spinner) findViewById(R.id.accountDefaultSendAcct);
			spinnerSendAcct.setAdapter(dataAdapter);

			ArrayAdapter dataAdapter2 = new ArrayAdapter(
					getApplicationContext(),
					android.R.layout.simple_spinner_item, bankNames);
			dataAdapter2
					.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
			spinnerReceiveAcct = (Spinner) findViewById(R.id.accountDefaultReceiveAcct);
			spinnerReceiveAcct.setAdapter(dataAdapter2);
		}

		editAcct.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (listofBanks.size() > 0) {
					String refSend = String.valueOf(spinnerSendAcct
							.getSelectedItem());
					String refReceive = String.valueOf(spinnerReceiveAcct
							.getSelectedItem());
					for (int k = 0; k < listofBanks.size(); k++) {
						String ref = listofBanks.get(k).NameOnAccount + " - "
								+ listofBanks.get(k).AccountType + " - "
								+ listofBanks.get(k).AccountNumber;
						if (refSend.equals(ref)
								|| refSend.equals(listofBanks.get(k).Nickname)) {
							preferredSend = listofBanks.get(k).BankId;
						}
						if (refReceive.equals(ref)
								|| refReceive.equals(listofBanks.get(k).Nickname)) {
							preferredReceive = listofBanks.get(k).BankId;
						}
					}
					confirmPinUpdateAccts();
				} else {
					finish();
				}
			}

		});
	}

	public void confirmPinUpdateAccts() {
		setContentView(R.layout.setup_security_dialog);

		TextView header = (TextView) findViewById(R.id.setupSecurityHeader);
		header.setText("Confirm Your Pin");
		TextView body = (TextView) findViewById(R.id.setupSecurityBody);
		body.setText("Re-enter your security pin in order to continue account creation.");

		final CustomLockView ctrlSecurityPin = (CustomLockView) findViewById(R.id.ctrlSecurityPin);
		ctrlSecurityPin.invalidate();
		ctrlSecurityPin.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {

				String confirmPasscode = ctrlSecurityPin.getPasscode();

				if (confirmPasscode.length() > 3) {
					passcode = confirmPasscode;

					final ACHAccountDetailRequest requestPreferredSend = new ACHAccountDetailRequest();
					final ACHAccountDetailRequest requestPreferredReceive = new ACHAccountDetailRequest();

					requestPreferredSend.UserId = prefs.getString("userId", "");
					requestPreferredSend.AccountId = preferredSend;
					requestPreferredSend.SecurityPin = passcode;
					requestPreferredReceive.UserId = prefs.getString("userId",
							"");
					requestPreferredReceive.AccountId = preferredReceive;
					requestPreferredReceive.SecurityPin = passcode;

					progressDialog.setMessage("Sending Info...");
					progressDialog
							.setProgressStyle(ProgressDialog.STYLE_SPINNER);
					progressDialog.show();

					Thread thread = new Thread(new Runnable() {

						@Override
						public void run() {
							// TODO Auto-generated method stub
							try {
								sendResponse = PaymentAcctService
										.updatePreferredSendAcct(requestPreferredSend);
								receiveResponse = PaymentAcctService
										.updatePreferredReceiveAcct(requestPreferredReceive);
							} catch (Exception e) {
								e.printStackTrace();
							}
							progressDialog.dismiss();

							if (sendResponse.Success && receiveResponse.Success) {
								achSetupHandler
										.sendEmptyMessage(UPDATEACCTMNG_SUCCESS);
							} else {
								achSetupHandler
										.sendEmptyMessage(UPDATEACCTMNG_FAILED);
							}
						}

					});
					thread.start();

				} else {
					achSetupHandler
							.sendEmptyMessage(USERSECURITYPIN_INVALIDLENGTH);
				}
				return false;
			}
		});

	}

	@Override
	public void onCheckedChanged(RadioGroup arg0, int arg1) {
		if (arg1 == R.id.achCheckings) {
			isCheckingAcct = true;
		}
		if (arg1 == R.id.achSavings) {
			isCheckingAcct = false;
		}
	}

	/*
	 * protected void SubmitPaymentRequest() {
	 * 
	 * PaymentRequest paymentRequest = new PaymentRequest();
	 * paymentRequest.UserId = prefs.getString("userId", "");
	 * paymentRequest.SecurityPin = passcode; paymentRequest.SenderUri =
	 * prefs.getString("login", ""); paymentRequest.RecipientUri = recipientUri;
	 * paymentRequest.Amount = amount; paymentRequest.Comments = comments;
	 * paymentRequest.SenderAccountId = prefs.getString("paymentAccountId",
	 * "0");
	 * 
	 * if (location != null) { paymentRequest.Latitude = location.getLatitude();
	 * paymentRequest.Longitude = location.getLongitude(); }
	 * 
	 * paymentResponse = PaymentServices.sendMoney(paymentRequest);
	 * 
	 * }
	 */
}
File
AccountManagerActivity.java
Developer's decision
Version 1
Kind of conflict
Annotation
Attribute
Comment
Method declaration
Method invocation
Chunk
Conflicting content
//		parameters.setPictureFormat(ImageFormat.JPEG);
//		mCamera.setParameters(parameters);
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
<<<<<<< HEAD
import android.widget.ImageView;
import android.widget.TextView;

public class CameraActivity extends BaseActivity {
	
	/**private static final int MEDIA_TYPE_IMAGE = 1;
    private Camera mCamera;
    private CameraPreview mPreview;
    private Button capture;
    private ImageView blah;**/
	
	private Button btn;
	private ImageView img;
	private TextView field;
	private String imagePath;
	private boolean isTaken;
	
	protected static final String PHOTO_TAKEN = "photo_taken";
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        tracker.trackPageView("Take Check Image");
        showCameraPreview();
    }
    public void showCameraPreview()
    {
    	setContentView(R.layout.camera_preview);
/**
        // Create an instance of Camera
        mCamera = getCameraInstance();
       // blah = (ImageView) findViewById(R.id.blaaah);
        // Create our Preview view and set it as the content of our activity.
        mPreview = new CameraPreview(this, mCamera);
        FrameLayout preview = (FrameLayout) findViewById(R.id.preview);
        preview.addView(capture);
//        preview.addView(blah);
        preview.addView(mPreview);
     	

       // Add a listener to the Capture button
       Button captureButton = (Button) findViewById(R.id.takepicture);
       captureButton.setOnClickListener(
           new View.OnClickListener() {
               @Override
               public void onClick(View v) {
                   // get an image from the camera
                   mCamera.takePicture(null, null, mPicture);                 
               }
           });
           
           **/
    	
    	
    }

    /** A safe way to get an instance of the Camera object. */
    public static Camera getCameraInstance(){
        Camera c = null;
        try {
            c = Camera.open(); // attempt to get a Camera instance
        }
        catch (Exception e){
            // Camera is not available (in use or does not exist)
        }
        return c; // returns null if camera is unavailable
    }
    
    /** Create a File for saving the image */
=======

public class CameraActivity extends BaseActivity {

	private static final int MEDIA_TYPE_IMAGE = 1;
	private Camera mCamera;
	private CameraPreview mPreview;
	private UserCheckImageRequest checkRequest;
	private UserCheckImageResponse checkResponse;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		tracker.trackPageView("Take Check Image");
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
		showCameraPreview();
	}
	
	
	public void showCameraPreview()
	{
		setContentView(R.layout.camera_preview);
//    	Camera.Parameters parameters = mCamera.getParameters();
		
		mCamera = getCameraInstance();
		if(mCamera == null)
		{
		//	finish();
		}
		// Create our Preview view and set it as the content of our activity.
		mPreview = new CameraPreview(this, mCamera);
		FrameLayout preview = (FrameLayout) findViewById(R.id.preview);

		preview.addView(mPreview);


		// Add a listener to the Capture button
		Button captureButton = (Button) findViewById(R.id.takepicture);
		captureButton.setOnClickListener(
				new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						// get an image from the camera
						mCamera.takePicture(null, null, mPicture);                 
					}
				});
	}

	/** A safe way to get an instance of the Camera object. */
	public static Camera getCameraInstance(){
		Camera c = null;
		try {
			c = Camera.open(); // attempt to get a Camera instance
		}
		catch (Exception e){
			e.printStackTrace();
			// Camera is not available (in use or does not exist)
		}
		return c; // returns null if camera is unavailable
	}

	/** Create a File for saving the image */
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
	private static File getOutputMediaFile(int type){

		File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(
Solution content
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

public class CameraActivity extends BaseActivity {
	
	private static final int MEDIA_TYPE_IMAGE = 1;
    private Camera mCamera;
    private CameraPreview mPreview;
    private Button capture;
    private ImageView blah;
	
	private Button btn;
	private ImageView img;
	private TextView field;
	private String imagePath;
	private boolean isTaken;
	
	protected static final String PHOTO_TAKEN = "photo_taken";
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        tracker.trackPageView("Take Check Image");
        showCameraPreview();
    }
    public void showCameraPreview()
    {
    	setContentView(R.layout.camera_preview);
    	
        // Create an instance of Camera
        mCamera = getCameraInstance();
       // blah = (ImageView) findViewById(R.id.blaaah);
        // Create our Preview view and set it as the content of our activity.
        mPreview = new CameraPreview(this, mCamera);
        FrameLayout preview = (FrameLayout) findViewById(R.id.preview);
        preview.addView(capture);
//        preview.addView(blah);
        preview.addView(mPreview);
     	

       // Add a listener to the Capture button
       Button captureButton = (Button) findViewById(R.id.takepicture);
       captureButton.setOnClickListener(
           new View.OnClickListener() {
               @Override
               public void onClick(View v) {
                   // get an image from the camera
                   mCamera.takePicture(null, null, mPicture);                 
               }
           });  	
    	
    }
    /** A safe way to get an instance of the Camera object. */
    public static Camera getCameraInstance(){
        Camera c = null;
        try {
            c = Camera.open(); // attempt to get a Camera instance
        }
        catch (Exception e){
            // Camera is not available (in use or does not exist)
        }
        return c; // returns null if camera is unavailable
    }
    
    /** Create a File for saving the image */
	private static File getOutputMediaFile(int type){
File
CameraActivity.java
Developer's decision
Manual
Kind of conflict
Annotation
Attribute
Comment
Import
Method declaration
Chunk
Conflicting content
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
<<<<<<< HEAD
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
=======
import android.text.InputType;
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
Solution content
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
File
ProfileControllerActivity.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
	private boolean hasCredit;

	private Button backBtn;
<<<<<<< HEAD
	private String selectedState;
=======
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65

	private UserResponse userResponse;
Solution content
	private boolean hasCredit;

	private Button backBtn;
	private String selectedState;

	private UserResponse userResponse;
File
ProfileControllerActivity.java
Developer's decision
Version 1
Kind of conflict
Attribute
Chunk
Conflicting content
				}
			});
		}
<<<<<<< HEAD

		if (addressBtn.isClickable()) {
			addressBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					showAddressDialog();
				}

			});
		}

		if (cityBtn.isClickable()) {
			cityBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					showCityDialog();
				}

			});
		}

		if (stateBtn.isClickable()) {
			stateBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					showStateDialog();
				}

			});
		}

		if (zipCodeBtn.isClickable()) {
			zipCodeBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					showZipcodeDialog();
				}

			});
		}

		if (birthdayBtn.isClickable()) {
			birthdayBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					showBirthdayDialog();
				}

			});
		}
		
		if (genderBtn.isClickable()) {
			genderBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					showGenderDialog();
				}

			});
		}
		// ETC
		// photo id
		// ssn
=======
		
		if(addressBtn.isClickable())
		{
			addressBtn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
				showAddressDialog();
				}
				
			});
		}
		
		if(cityBtn.isClickable()){
			cityBtn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					showCityDialog();
				}
				
			});
		}
		
		if(stateBtn.isClickable()){
			stateBtn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					Toast.makeText(getApplicationContext(), "State feature unavailible", Toast.LENGTH_SHORT);
				}
				
			});
		}
		
		if(zipCodeBtn.isClickable()){
			zipCodeBtn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					showZipcodeDialog();
				}
				
			});
		}
		
		// ETC
		// photo id
		// ssn
		// birthday
		// gender
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
		// income
		// credit
	}
Solution content
			cityBtn.setOnClickListener(new OnClickListener() {

				@Override
				}
			});
		}

		if (addressBtn.isClickable()) {
			addressBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					showAddressDialog();
				}

			});
		}

		if (cityBtn.isClickable()) {
				public void onClick(View v) {
					showCityDialog();
				}

			});
		}

		if (stateBtn.isClickable()) {
			stateBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					showStateDialog();
				}

			});
		}

		if (zipCodeBtn.isClickable()) {
			zipCodeBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					showZipcodeDialog();
				}

			});
		}

		if (birthdayBtn.isClickable()) {
			birthdayBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					showBirthdayDialog();
				}

			});
		}
		
		if (genderBtn.isClickable()) {
			genderBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					showGenderDialog();
				}

			});
		}
	
	}
File
ProfileControllerActivity.java
Developer's decision
Combination
Kind of conflict
Comment
If statement
Chunk
Conflicting content
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your first name in the textbox below.");

<<<<<<< HEAD
		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

=======
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setHint("First Name");
Solution content
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your first name in the textbox below.");

		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setHint("First Name");
File
ProfileControllerActivity.java
Developer's decision
Version 1
Kind of conflict
Cast expression
Method invocation
Variable
Chunk
Conflicting content
		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
<<<<<<< HEAD
=======
		// if button is clicked, close the custom dialog
		dialogButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				String userInput = input.getText().toString().trim();
				if (userInput != null || userInput.length() > 0 || userInput.length() > 0) {
					TextView firstName = (TextView) firstNameBtn
							.findViewById(R.id.firstNameProfile);
					firstName.setText(userInput);
					firstName.setTextColor(Color.parseColor("#9C9C9C"));
					firstName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) firstNameBtn
							.findViewById(R.id.firstNameProfile_Pts);
					pts.setVisibility(View.GONE);
					firstNameBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							firstNameBtn.invalidate();
						}
					});
				}
				dialog.dismiss();
			}
		});
		dialog.show();
	}

	public void showLastNameDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Last Name");

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your last name in the textbox below.");

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setHint("Last Name");

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		// if button is clicked, close the custom dialog
		dialogButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				String userInput = input.getText().toString().trim();
				if (userInput != null || userInput.length() > 0) {
					TextView lastName = (TextView) lastNameBtn
							.findViewById(R.id.lastNameProfile);
					lastName.setText(userInput);
					lastName.setTextColor(Color.parseColor("#9C9C9C"));
					lastName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) lastNameBtn
							.findViewById(R.id.lastNameProfile_Pts);
					pts.setVisibility(View.GONE);
					lastNameBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							lastNameBtn.invalidate();
						}
					});
				}
				dialog.dismiss();
			}
		});
		dialog.show();
	}

	public void showEmailDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Email Address");

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your email address in the textbox below.");

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setHint("Email Address");

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
		// if button is clicked, close the custom dialog
		dialogButton.setOnClickListener(new OnClickListener() {
			@Override
Solution content
		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);

		// if button is clicked, close the custom dialog
		dialogButton.setOnClickListener(new OnClickListener() {
			@Override
File
ProfileControllerActivity.java
Developer's decision
Version 1
Kind of conflict
Cast expression
Comment
Method declaration
Method invocation
Method signature
Variable
Chunk
Conflicting content
			@Override
			public void onClick(View v) {
				String userInput = input.getText().toString().trim();
<<<<<<< HEAD
				if (userInput != null || userInput.length() > 0
						|| userInput.length() > 0) {
					TextView firstName = (TextView) firstNameBtn
							.findViewById(R.id.firstNameProfile);
					firstName.setText(userInput);
					firstName.setTextColor(Color.parseColor("#9C9C9C"));
					firstName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) firstNameBtn
							.findViewById(R.id.firstNameProfile_Pts);
					pts.setVisibility(View.GONE);
					firstNameBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							firstNameBtn.invalidate();
=======
				if (userInput != null || userInput.length() > 0) {
					TextView email = (TextView) emailBtn
							.findViewById(R.id.emailProfile);
					email.setText(userInput);
					email.setTextColor(Color.parseColor("#9C9C9C"));
					email.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) emailBtn
							.findViewById(R.id.emailProfile_Pts);
					pts.setVisibility(View.GONE);
					emailBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							emailBtn.invalidate();
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
						}
					});
				}
Solution content
			@Override
			public void onClick(View v) {
				String userInput = input.getText().toString().trim();
				if (userInput != null || userInput.length() > 0 || userInput.length() > 0) {
					TextView firstName = (TextView) firstNameBtn
							.findViewById(R.id.firstNameProfile);
					firstName.setText(userInput);
					firstName.setTextColor(Color.parseColor("#9C9C9C"));
					firstName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) firstNameBtn
							.findViewById(R.id.firstNameProfile_Pts);
					pts.setVisibility(View.GONE);
					firstNameBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							firstNameBtn.invalidate();
						}
					});
				}
File
ProfileControllerActivity.java
Developer's decision
Version 1
Kind of conflict
Cast expression
If statement
Method invocation
Variable
Chunk
Conflicting content
		});
		dialog.show();
	}
<<<<<<< HEAD

	public void showLastNameDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Last Name");

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your last name in the textbox below.");

		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setHint("Last Name");

=======

	public void showPhoneDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Phone Number");

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your phone number in the textbox below.");

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setHint("Phone #");

>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		// if button is clicked, close the custom dialog
Solution content
		});
		dialog.show();
	}

	public void showLastNameDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Last Name");

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your last name in the textbox below.");

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setHint("Last Name");

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		// if button is clicked, close the custom dialog
File
ProfileControllerActivity.java
Developer's decision
Combination
Kind of conflict
Cast expression
Comment
Method invocation
Method signature
Variable
Chunk
Conflicting content
			public void onClick(View v) {
				String userInput = input.getText().toString().trim();
				if (userInput != null || userInput.length() > 0) {
<<<<<<< HEAD
					TextView lastName = (TextView) lastNameBtn
							.findViewById(R.id.lastNameProfile);
					lastName.setText(userInput);
					lastName.setTextColor(Color.parseColor("#9C9C9C"));
					lastName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) lastNameBtn
							.findViewById(R.id.lastNameProfile_Pts);
					pts.setVisibility(View.GONE);
					lastNameBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							lastNameBtn.invalidate();
=======
					TextView phone = (TextView) phoneBtn
							.findViewById(R.id.phoneNumberProfile);
					phone.setText(userInput);
					phone.setTextColor(Color.parseColor("#9C9C9C"));
					phone.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) phoneBtn
							.findViewById(R.id.phoneNumberProfile_Pts);
					pts.setVisibility(View.GONE);
					phoneBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							phoneBtn.invalidate();
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
						}
					});
				}
Solution content
			public void onClick(View v) {
				String userInput = input.getText().toString().trim();
				if (userInput != null || userInput.length() > 0) {
					TextView lastName = (TextView) lastNameBtn
							.findViewById(R.id.lastNameProfile);
					lastName.setText(userInput);
					lastName.setTextColor(Color.parseColor("#9C9C9C"));
					lastName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) lastNameBtn
							.findViewById(R.id.lastNameProfile_Pts);
					pts.setVisibility(View.GONE);
					lastNameBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							lastNameBtn.invalidate();
						}
					});
				}
File
ProfileControllerActivity.java
Developer's decision
Version 1
Kind of conflict
Cast expression
Method invocation
Variable
Chunk
Conflicting content
		dialog.show();
	}

<<<<<<< HEAD
	public void showEmailDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Email Address");

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your email address in the textbox below.");

		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);
		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setInputType(InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS);
		input.setHint("Email Address");

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		// if button is clicked, close the custom dialog
		dialogButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				String userInput = input.getText().toString().trim();
				if (userInput != null || userInput.length() > 0) {
					TextView email = (TextView) emailBtn
							.findViewById(R.id.emailProfile);
					email.setText(userInput);
					email.setTextColor(Color.parseColor("#9C9C9C"));
					email.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) emailBtn
							.findViewById(R.id.emailProfile_Pts);
					pts.setVisibility(View.GONE);
					emailBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							emailBtn.invalidate();
						}
					});
				}
				dialog.dismiss();
			}
		});
		dialog.show();
	}

	public void showPhoneDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Phone Number");

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your phone number in the textbox below.");

		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setHint("Phone #");
		input.setInputType(InputType.TYPE_CLASS_PHONE);

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		// if button is clicked, close the custom dialog
		dialogButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				String userInput = input.getText().toString().trim();
				if (userInput != null || userInput.length() > 0) {
					TextView phone = (TextView) phoneBtn
							.findViewById(R.id.phoneNumberProfile);
					phone.setText(userInput);
					phone.setTextColor(Color.parseColor("#9C9C9C"));
					phone.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) phoneBtn
							.findViewById(R.id.phoneNumberProfile_Pts);
					pts.setVisibility(View.GONE);
					phoneBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							phoneBtn.invalidate();
						}
					});
				}
				dialog.dismiss();
			}
		});
		dialog.show();
	}

=======
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
	public void showAboutMeDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
Solution content
		dialog.show();
	}

	public void showEmailDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Email Address");

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your email address in the textbox below.");

		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);
		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setInputType(InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS);
		input.setHint("Email Address");

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		// if button is clicked, close the custom dialog
		dialogButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				String userInput = input.getText().toString().trim();
				if (userInput != null || userInput.length() > 0) {
					TextView email = (TextView) emailBtn
							.findViewById(R.id.emailProfile);
					email.setText(userInput);
					email.setTextColor(Color.parseColor("#9C9C9C"));
					email.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) emailBtn
							.findViewById(R.id.emailProfile_Pts);
					pts.setVisibility(View.GONE);
					emailBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							emailBtn.invalidate();
						}
					});
				}
				dialog.dismiss();
			}
		});
		dialog.show();
	}

	public void showPhoneDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Phone Number");

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your phone number in the textbox below.");

		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setHint("Phone #");
		input.setInputType(InputType.TYPE_CLASS_PHONE);

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		// if button is clicked, close the custom dialog
		dialogButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				String userInput = input.getText().toString().trim();
				if (userInput != null || userInput.length() > 0) {
					TextView phone = (TextView) phoneBtn
							.findViewById(R.id.phoneNumberProfile);
					phone.setText(userInput);
					phone.setTextColor(Color.parseColor("#9C9C9C"));
					phone.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) phoneBtn
							.findViewById(R.id.phoneNumberProfile_Pts);
					pts.setVisibility(View.GONE);
					phoneBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							phoneBtn.invalidate();
						}
					});
				}
				dialog.dismiss();
			}
		});
		dialog.show();
	}

	public void showAboutMeDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
File
ProfileControllerActivity.java
Developer's decision
Version 1
Kind of conflict
Method declaration
Chunk
Conflicting content
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter a small paragraph about yourself.");

<<<<<<< HEAD
		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

=======
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
Solution content
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter a small paragraph about yourself.");

		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
File
ProfileControllerActivity.java
Developer's decision
Version 1
Kind of conflict
Cast expression
Method invocation
Variable
Chunk
Conflicting content
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your address below.");

<<<<<<< HEAD
		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);
		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

=======
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
Solution content
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your address below.");

		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);
		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
File
ProfileControllerActivity.java
Developer's decision
Version 1
Kind of conflict
Cast expression
Method invocation
Variable
Chunk
Conflicting content
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("City");

<<<<<<< HEAD
		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

=======
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter the city corresponding to your address below.");
Solution content
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("City");
		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);
		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter the city corresponding to your address below.");
File
ProfileControllerActivity.java
Developer's decision
Version 1
Kind of conflict
Cast expression
Method invocation
Variable
Chunk
Conflicting content
			public void onClick(View v) {
			@Override
		dialog.show();
	}

<<<<<<< HEAD
	public void showStateDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("State");

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter the state address below.");

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

		final AutoCompleteTextView listofStates = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		final String[] STATES = new String[] { "Alabama", "Alaska", "Arizona",
				"Arkansas", "California", "Colorado", "Connecticut",
				"Delaware", "Florida", "Georgia", "Hawaii", "Idaho",
				"Illinois", "Indiana", "Iowa", "Kansas", "Kentucky",
				"Louisana", "Maine", "Maryland", "Massachusetts", "Michigan",
				"Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska",
				"Nevada", "New Hampshire", "New Jersey", "New Mexico",
				"New York", "North Carolina", "North Dakota", "Ohio",
				"Oklahoma", "Oregon", "Pennyslvania", "Rhode Island",
				"South Carolina", "South Dakota", "Tennessee", "Texas", "Utah",
				"Vermont", "Virginia", "Washington", "West Virginia",
				"Wisconsin", "Wyoming" };

		ArrayAdapter adapter = new ArrayAdapter(this,
				android.R.layout.simple_dropdown_item_1line, STATES);
		listofStates.setAdapter(adapter);

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		// if button is clicked, close the custom dialog
		dialogButton.setOnClickListener(new OnClickListener() {
				if (listofStates.getText().toString().trim() != null
						|| listofStates.getText().toString().trim().length() > 0) {
					TextView email = (TextView) stateBtn
							.findViewById(R.id.stateProfile);
					email.setText(listofStates.getText().toString().trim());
					email.setTextColor(Color.parseColor("#9C9C9C"));
					email.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) stateBtn
							.findViewById(R.id.stateProfile_Pts);
					pts.setVisibility(View.GONE);
					stateBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							stateBtn.invalidate();
						}
					});
				}
				dialog.dismiss();
			}
		});
		dialog.show();
	}

=======
	// public void showStateDialog() <-- different layout, use a list of states
	
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
	public void showZipcodeDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
Solution content
		dialog.show();
	}

	public void showStateDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("State");

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter the state address below.");

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

		final AutoCompleteTextView listofStates = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		final String[] STATES = new String[] { "Alabama", "Alaska", "Arizona",
				"Arkansas", "California", "Colorado", "Connecticut",
				"Delaware", "Florida", "Georgia", "Hawaii", "Idaho",
				"Illinois", "Indiana", "Iowa", "Kansas", "Kentucky",
				"Louisana", "Maine", "Maryland", "Massachusetts", "Michigan",
				"Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska",
				"Nevada", "New Hampshire", "New Jersey", "New Mexico",
				"New York", "North Carolina", "North Dakota", "Ohio",
				"Oklahoma", "Oregon", "Pennyslvania", "Rhode Island",
				"South Carolina", "South Dakota", "Tennessee", "Texas", "Utah",
				"Vermont", "Virginia", "Washington", "West Virginia",
				"Wisconsin", "Wyoming" };

		ArrayAdapter adapter = new ArrayAdapter(this,
				android.R.layout.simple_dropdown_item_1line, STATES);
		listofStates.setAdapter(adapter);

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		// if button is clicked, close the custom dialog
		dialogButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (listofStates.getText().toString().trim() != null
						|| listofStates.getText().toString().trim().length() > 0) {
					TextView email = (TextView) stateBtn
							.findViewById(R.id.stateProfile);
					email.setText(listofStates.getText().toString().trim());
					email.setTextColor(Color.parseColor("#9C9C9C"));
					email.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) stateBtn
							.findViewById(R.id.stateProfile_Pts);
					pts.setVisibility(View.GONE);
					stateBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							stateBtn.invalidate();
						}
					});
				}
				dialog.dismiss();
			}
		});
		dialog.show();
	}

	public void showZipcodeDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
File
ProfileControllerActivity.java
Developer's decision
Version 1
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Zipcode");
<<<<<<< HEAD
		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
=======

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setInputType(InputType.TYPE_CLASS_NUMBER);
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
		text.setText("Enter your zipcode below.");

		final EditText input = (EditText) dialog
Solution content
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Zipcode");
		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);

		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);

		text.setInputType(InputType.TYPE_CLASS_NUMBER);
		text.setText("Enter your zipcode below.");

		final EditText input = (EditText) dialog
File
ProfileControllerActivity.java
Developer's decision
Combination
Kind of conflict
Cast expression
Comment
Method invocation
Variable
Chunk
Conflicting content
		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
<<<<<<< HEAD
		input.setInputType(InputType.TYPE_NUMBER_VARIATION_NORMAL|InputType.TYPE_CLASS_NUMBER);
=======
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
Solution content
		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
File
ProfileControllerActivity.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
	}

	// photo id?
<<<<<<< HEAD

	// social security number

	public void showBirthdayDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Birthday");
		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);
		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your birthday below.");

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setInputType(InputType.TYPE_DATETIME_VARIATION_DATE);

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		// if button is clicked, close the custom dialog
		dialogButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				String userInput = input.getText().toString().trim();
				if (userInput != null || userInput.length() > 0) {
					TextView birthday = (TextView) birthdayBtn
							.findViewById(R.id.birthdayProfile);
					birthday.setText(userInput);
					birthday.setTextColor(Color.parseColor("#9C9C9C"));
					birthday.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) birthdayBtn
							.findViewById(R.id.birthdayProfile_Pts);
					pts.setVisibility(View.GONE);
					birthdayBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							birthdayBtn.invalidate();
						}
					});
				}
				dialog.dismiss();
			}
		});
		dialog.show();
	}

	public void showGenderDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Birthday");
		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		EditText hide2 = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		hide2.setVisibility(View.GONE);
		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your birthday below.");

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		dialogButton.setVisibility(View.GONE);

		LinearLayout maleBtn = (LinearLayout) dialog.findViewById(R.id.profileDialogMale);
		maleBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				TextView gender = (TextView) genderBtn
						.findViewById(R.id.genderProfile);
				gender.setText("Male");
				gender.setTextColor(Color.parseColor("#9C9C9C"));
				gender.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
				TextView pts = (TextView)genderBtn
						.findViewById(R.id.genderProfile_Pts);
				pts.setVisibility(View.GONE);
				genderBtn.setClickable(false);
				runOnUiThread(new Runnable() {
					public void run() {
						genderBtn.invalidate();
					}
				});
				dialog.dismiss();
			}
		});

		LinearLayout femaleBtn = (LinearLayout) dialog.findViewById(R.id.profileDialogFemale);
		femaleBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				TextView gender = (TextView) genderBtn
						.findViewById(R.id.genderProfile);
				gender.setText("Female");
				gender.setTextColor(Color.parseColor("#9C9C9C"));
				gender.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
				TextView pts = (TextView)genderBtn
						.findViewById(R.id.genderProfile_Pts);
				pts.setVisibility(View.GONE);
				genderBtn.setClickable(false);
				runOnUiThread(new Runnable() {
					public void run() {
						genderBtn.invalidate();
					}
				});
				dialog.dismiss();
			}
		});
		
		dialog.show();
	}

	// income <-- diff. layout, have list of options

	// credit ?

=======
	
	// social security number
	
	// birthday <-- set up auto-format
	
	// gender <-- diff. layout with two buttons: male or female
	
	// income <-- diff. layout, have list of options
	
	// credit ?
	
	
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65
	// pre-enter all user data that user has already inserted into the
	// profile fields.
	public void enterUserData() {
Solution content
				if (userInput != null || userInput.length() > 0) {
	}

	// social security number

	public void showBirthdayDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Birthday");
		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		LinearLayout genderHide = (LinearLayout) dialog
				.findViewById(R.id.profileEnterGender);
		genderHide.setVisibility(View.GONE);
		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your birthday below.");

		final EditText input = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		input.setInputType(InputType.TYPE_DATETIME_VARIATION_DATE);

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		// if button is clicked, close the custom dialog
		dialogButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				String userInput = input.getText().toString().trim();
					TextView birthday = (TextView) birthdayBtn
							.findViewById(R.id.birthdayProfile);
					birthday.setText(userInput);
					birthday.setTextColor(Color.parseColor("#9C9C9C"));
					birthday.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
					TextView pts = (TextView) birthdayBtn
							.findViewById(R.id.birthdayProfile_Pts);
					pts.setVisibility(View.GONE);
					birthdayBtn.setClickable(false);
					runOnUiThread(new Runnable() {
						public void run() {
							birthdayBtn.invalidate();
						}
					});
				}
				dialog.dismiss();
			}
		});
		dialog.show();
	}

	public void showGenderDialog() {
		final Dialog dialog = new Dialog(this);
		dialog.setContentView(R.layout.profile_dialog_input);
		dialog.setTitle("Birthday");
		AutoCompleteTextView hide = (AutoCompleteTextView) dialog
				.findViewById(R.id.profileEnterState);
		hide.setVisibility(View.GONE);

		EditText hide2 = (EditText) dialog
				.findViewById(R.id.profileDialogInput);
		hide2.setVisibility(View.GONE);
		// set the custom dialog components - text, image and button
		TextView text = (TextView) dialog.findViewById(R.id.profileDialogBody);
		text.setText("Enter your birthday below.");

		Button dialogButton = (Button) dialog
				.findViewById(R.id.profileDialogBtn);
		dialogButton.setVisibility(View.GONE);

		LinearLayout maleBtn = (LinearLayout) dialog.findViewById(R.id.profileDialogMale);
		maleBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				TextView gender = (TextView) genderBtn
						.findViewById(R.id.genderProfile);
				gender.setText("Male");
				gender.setTextColor(Color.parseColor("#9C9C9C"));
				gender.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
				TextView pts = (TextView)genderBtn
						.findViewById(R.id.genderProfile_Pts);
				pts.setVisibility(View.GONE);
				genderBtn.setClickable(false);
				runOnUiThread(new Runnable() {
					public void run() {
						genderBtn.invalidate();
					}
				});
				dialog.dismiss();
			}
		});

		LinearLayout femaleBtn = (LinearLayout) dialog.findViewById(R.id.profileDialogFemale);
		femaleBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				TextView gender = (TextView) genderBtn
						.findViewById(R.id.genderProfile);
				gender.setText("Female");
				gender.setTextColor(Color.parseColor("#9C9C9C"));
				gender.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
				TextView pts = (TextView)genderBtn
						.findViewById(R.id.genderProfile_Pts);
				pts.setVisibility(View.GONE);
				genderBtn.setClickable(false);
				runOnUiThread(new Runnable() {
					public void run() {
						genderBtn.invalidate();
					}
				});
				dialog.dismiss();
			}
		});
		
		dialog.show();
	}

	// income <-- diff. layout, have list of options

	// credit ?

	// pre-enter all user data that user has already inserted into the
	// profile fields.
	public void enterUserData() {
File
ProfileControllerActivity.java
Developer's decision
Version 1
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
					.create();

public class RequestPaymentActivity extends BaseActivity {

<<<<<<< HEAD
	public static final String TAG = "RequestMoneyActivity";

	private String recipientUri;
	private double amount = 0;
	private String comments = "";
	private String errorMessage = "";

	private Location location;
	private LocationManager locationManager;
	private LocationListener locationListener;

	private Friend friend;
	
	private ImageButton btnCamera;
	private Button btnAddContacts;
	private Button txtAmount;
	private EditText txtComments;
	private Button btnRequestMoney;
	private String passcode = "";

	final private int ADDING_FRIEND = 6;
	final private int SUBMITREQUEST_DIALOG = 0;
	final private int NORECIPIENTSPECIFIED_DIALOG = 1;
	final private int NOAMOUNTSPECIFIED_DIALOG = 2;
	final private int SUBMITREQUESTFAILED_DIALOG = 3;
	final private int SUBMITREQUESTSUCCESS_DIALOG = 4;
	final private int INVALIDPASSCODELENGTH_DIALOG = 5;
	final private int PAYMENTEXCEEDSLIMIT_DIALOG = 6;
	final private int ADD_MONEY = 8;
	final private int SUBMITREQUEST_ACTION = 1;
	final private int CAMERA = 20;
	
	private View requestMoneyView = null;
	private Response paymentResponse;

	private Dialog dialog = null;
	private Handler dialogHandler = new Handler() {
		public void handleMessage(Message msg) {
			dialog.dismiss();
			switch (msg.what) {
			case SUBMITREQUEST_ACTION:
				removeDialog(SUBMITREQUEST_DIALOG);

				if (paymentResponse != null
						&& paymentResponse.Success) {
					showDialog(SUBMITREQUESTSUCCESS_DIALOG);

				} else if (paymentResponse != null) {
					errorMessage = paymentResponse.ReasonPhrase;
					showDialog(SUBMITREQUESTFAILED_DIALOG);
				} else {
					showDialog(SUBMITREQUESTFAILED_DIALOG);
				}
				break;
			}
		}
	};

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setTitle("Request Money");

	    locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
		locationListener = new LocationListener() {

			@Override
			public void onLocationChanged(Location arg0) {
				// TODO Auto-generated method stub
				if (isBetterLocation(arg0, location)) {
					location = arg0;
				}
			}

			@Override
			public void onProviderDisabled(String arg0) {
				// TODO Auto-generated method stub

			}

			@Override
			public void onProviderEnabled(String provider) {
				// TODO Auto-generated method stub

			}

			@Override
			public void onStatusChanged(String provider, int status,
					Bundle extras) {
				// TODO Auto-generated method stub

			}

		};

		launchRequestMoneyView();
	}

	@Override
	public void onResume() {
		super.onResume();
		tracker.trackPageView("Request Money");
		locationManager.requestLocationUpdates(
				LocationManager.GPS_PROVIDER, 0, 0, locationListener);
//		locationManager.requestLocationUpdates(
//				LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);


	}

	@Override
	public void onPause() {
		super.onPause();

		locationManager.removeUpdates(locationListener);
	}

	protected android.app.Dialog onCreateDialog(int id) {
		
		AlertDialog alertDialog = null;
		ProgressDialog progressDialog = null;
		Thread thread = null;
		switch (id) {
		case SUBMITREQUEST_DIALOG:
			progressDialog = new ProgressDialog(this);
			tracker.trackPageView("Request Money: Confirm");
			progressDialog.setMessage("Submitting Request...");
			progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);

			thread = new Thread(new Runnable() {

				@Override
				public void run() {
					try {
						SubmitRequest();

					} catch (Exception e) {
						e.printStackTrace();
					}
					dialogHandler.sendEmptyMessage(SUBMITREQUEST_ACTION);
				}

			});
			dialog = progressDialog;
			thread.start();

			return dialog;
		case SUBMITREQUESTFAILED_DIALOG:
			alertDialog = new AlertDialog.Builder(this).create();
			alertDialog.setTitle("Failed");

			alertDialog
					.setMessage(errorMessage);
			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();

				}
			});

			return alertDialog;
		case SUBMITREQUESTSUCCESS_DIALOG:
			tracker.trackPageView("Request Money: Completed");
			alertDialog = new AlertDialog.Builder(this).create();
			alertDialog.setTitle("Request Sumitted");
			NumberFormat nf = NumberFormat.getCurrencyInstance();

			alertDialog.setMessage(String.format(
					"Your request for %s was sent to %s.", nf.format(amount),
					recipientUri));
			
			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					removeDialog(4);
					dialog.dismiss();

					friend = null;
					btnAddContacts.setText("Add recipient");
					txtAmount.setText("$0.00");
					txtComments.setText("");
				}
			});
			return alertDialog;
		case NORECIPIENTSPECIFIED_DIALOG:
			alertDialog = new AlertDialog.Builder(RequestPaymentActivity.this)
					.create();
			alertDialog.setTitle("Invalid Recipient");
			alertDialog
					.setMessage("Your recipient does not have a valid paypoint.");

			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});

			return alertDialog;
		case NOAMOUNTSPECIFIED_DIALOG:
			alertDialog = new AlertDialog.Builder(RequestPaymentActivity.this)
					.create();
			alertDialog.setTitle("Please Specify an Amount");
			alertDialog.setMessage("You must specify the amount to send.");

			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});

			return alertDialog;

		case INVALIDPASSCODELENGTH_DIALOG:
			alertDialog = new AlertDialog.Builder(RequestPaymentActivity.this)
			alertDialog.setTitle("Invalid Passcode");
			alertDialog
					.setMessage("Your passcode is atleast 4 buttons. Please try again.");

			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});

			return alertDialog;

		case PAYMENTEXCEEDSLIMIT_DIALOG:
			alertDialog = new AlertDialog.Builder(RequestPaymentActivity.this)
			.create();
			alertDialog.setTitle("Exceeds Limit");
			alertDialog
			.setMessage("The payment exceeds your upper limit. Please try again.");

			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});

			return alertDialog;

		}

		return null;
	}

	protected void launchRequestMoneyView() {

		requestMoneyView = View.inflate(this, R.layout.requestmoney_controller, null);
		setContentView(requestMoneyView);


		txtComments = (EditText) findViewById(R.id.txtRequestMoneyComments);
		btnRequestMoney = (Button) findViewById(R.id.btnSubmit);
		Typeface type = Typeface.createFromAsset(getAssets(),"HelveticaWorld-Bold.ttf");
		btnRequestMoney.setTypeface(type);
		btnRequestMoney.setTextColor(Color.WHITE);

		txtAmount = (Button) findViewById(R.id.txtRequestMoneyAmount);
		txtAmount.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				startActivityForResult(new Intent(RequestPaymentActivity.this, AddMoneyActivity.class), ADD_MONEY);
			}
		});
		
		btnCamera = (ImageButton) findViewById(R.id.camera);
		btnCamera.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View v) {
				startActivityForResult(new Intent(RequestPaymentActivity.this, CameraActivity.class), CAMERA);
			}	
		});

		btnAddContacts = (Button) findViewById(R.id.addRecipient);
		btnAddContacts.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				startActivityForResult(new Intent(RequestPaymentActivity.this, FriendsListActivity.class), ADDING_FRIEND);
			}

		});

		btnRequestMoney.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				boolean isValid = true;

				amount = Double.parseDouble(txtAmount.getText().toString()
						.replaceAll("[$,]*", ""));
				comments = txtComments.getText().toString();

				if (isValid & recipientUri.length() == 0) {
					showDialog(NORECIPIENTSPECIFIED_DIALOG);
					isValid = false;
				}
				if (isValid & amount == 0) {
					showDialog(NOAMOUNTSPECIFIED_DIALOG);
					isValid = false;
				}
				if (isValid && amount > prefs.getInt("upperLimit", 0)) {
					showDialog(PAYMENTEXCEEDSLIMIT_DIALOG);
					isValid = false;
				}
				if (isValid) {

					Location lastKnownLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

					if (isBetterLocation(lastKnownLocation, location)) {
						location = lastKnownLocation;
					}

					if(prefs.getString("userId", "").length() == 0) {
            case SUBMITREQUEST_DIALOG:
						startActivityForResult(new Intent(RequestPaymentActivity.this, SignInActivity.class), 1);
					} else {
						showSecurityPinDialog();
					}
				}
			}
		});

		btnRequestMoney.setVisibility(View.VISIBLE);
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (resultCode == RESULT_OK) {
			if (requestCode == ADDING_FRIEND) {
				Bundle bundle = data.getExtras();
				if (bundle.getString("id") != null)
                {
                    Friend chosenContact = new Friend();
                    chosenContact.setId(bundle.getString("id"));
                    friend = friendsList.get(friendsList.indexOf(chosenContact));
=======
    public static final String TAG = "RequestMoneyActivity";

    private String recipientUri;
    private double amount = 0;
    private String comments = "";
    private String errorMessage = "";

    private Location location;
    private LocationManager locationManager;
    private LocationListener locationListener;

    private Friend friend;

    private Button btnCamera;
    private Button btnAddContacts;
    private Button txtAmount;
    private EditText txtComments;
    private Button btnRequestMoney;
    private String passcode = "";
    private boolean addingACHAccount = false;

    final private int ADDING_FRIEND = 6;
    final private int SUBMITREQUEST_DIALOG = 0;
    final private int NORECIPIENTSPECIFIED_DIALOG = 1;
    final private int NOAMOUNTSPECIFIED_DIALOG = 2;
    final private int SUBMITREQUESTFAILED_DIALOG = 3;
    final private int SUBMITREQUESTSUCCESS_DIALOG = 4;
    final private int INVALIDPASSCODELENGTH_DIALOG = 5;
    final private int PAYMENTEXCEEDSLIMIT_DIALOG = 6;

    final private int ADDACCOUNT_DIALOG = 7;
    final private int ADD_MONEY = 8;
    final private int SUBMITREQUEST_ACTION = 1;
    final private int CAMERA = 20;

    private View requestMoneyView = null;
    private Response paymentResponse;

    private Dialog dialog = null;
    private Handler dialogHandler = new Handler() {
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case SUBMITREQUEST_ACTION:
                    removeDialog(SUBMITREQUEST_DIALOG);

                    if (paymentResponse != null
                        && paymentResponse.Success) {
                        showDialog(SUBMITREQUESTSUCCESS_DIALOG);

                    } else if (paymentResponse != null) {
                        errorMessage = paymentResponse.ReasonPhrase;
                        showDialog(SUBMITREQUESTFAILED_DIALOG);
                    } else {
                        showDialog(SUBMITREQUESTFAILED_DIALOG);
                    }
                    break;

                case ADDACCOUNT_DIALOG:
                    alertDialog.setTitle("No ACH Account Setup");
                    alertDialog.setMessage("This user account has no bank account attached, " +
                        "in order to send a payment, you must add a bank account. " +
                        "After adding a bank account, you will return to this screen " +
                        "with all the information filled in.");
                    alertDialog.setButton("Cancel", new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which)
                        {
                            // TODO Auto-generated method stub
                            dialog.dismiss();
                        }

                    });
                    alertDialog.setButton2("OK", new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which)
                        {
                            // TODO Auto-generated method stub
                            Intent intent = new Intent(RequestPaymentActivity.this, ACHAccountSetupActivity.class);
                            intent.putExtra("tab", 2);
                            dialog.dismiss();
                            addingACHAccount = true;
                            startActivity(intent);
                        }

                    });
                    alertDialog.dismiss();
                    break;
            }
        }
    };

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle("Request Money");

        locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
        locationListener = new LocationListener() {

            @Override
            public void onLocationChanged(Location arg0) {
                // TODO Auto-generated method stub
                if (isBetterLocation(arg0, location)) {
                    location = arg0;
                }
            }

            @Override
            public void onProviderDisabled(String arg0) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onProviderEnabled(String provider) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onStatusChanged(String provider, int status,
                Bundle extras) {
                // TODO Auto-generated method stub

            }

        };

        launchRequestMoneyView();
    }

    @Override
    public void onResume() {
        super.onResume();
        tracker.trackPageView("Request Money");
        locationManager.requestLocationUpdates(
            LocationManager.GPS_PROVIDER, 0, 0, locationListener);

        if (prefs.getBoolean("addingACHAccount", false))
        {
            addingContact(prefs.getString("friend", ""), prefs.getString("paypoint", ""));
            String prefsAmount = prefs.getString("amount", "0.00");
            txtAmount.setText("$" + prefsAmount);
            txtComments.setText(prefs.getString("comments", ""));
            Editor edit = prefs.edit();
            edit.remove("paypoint").remove("amount").remove("friend").remove("comments").remove("addingACHAccount");
        }


    }

    @Override
    public void onPause() {
        super.onPause();

        locationManager.removeUpdates(locationListener);

        if (addingACHAccount)
        {
            Editor edit = prefs.edit();
            edit.putBoolean("addingACHAccount", addingACHAccount);
            edit.putString("paypoint", recipientUri);
            edit.putString("amount", String.valueOf(amount));
            edit.putString("friend", friend.getId());
            edit.putString("comments", comments);
            edit.commit();
        }
    }

    protected android.app.Dialog onCreateDialog(int id) {

        Thread thread = null;
        switch (id) {
                progressDialog = new ProgressDialog(this);
                tracker.trackPageView("Request Money: Confirm");
                progressDialog.setMessage("Submitting Request...");
                progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);

                thread = new Thread(new Runnable() {

                    @Override
                    public void run() {
                        try {
                            SubmitRequest();

                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        dialogHandler.sendEmptyMessage(SUBMITREQUEST_ACTION);
                    }

                });
                dialog = progressDialog;
                thread.start();

                return dialog;
            case SUBMITREQUESTFAILED_DIALOG:
                alertDialog = new AlertDialog.Builder(this).create();
                alertDialog.setTitle("Failed");

                alertDialog
                .setMessage(errorMessage);
                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();

                    }
                });

                return alertDialog;
            case SUBMITREQUESTSUCCESS_DIALOG:
                tracker.trackPageView("Request Money: Completed");
                alertDialog = new AlertDialog.Builder(this).create();
                alertDialog.setTitle("Request Sumitted");
                NumberFormat nf = NumberFormat.getCurrencyInstance();

                alertDialog.setMessage(String.format(
                    "Your request for %s was sent to %s.", nf.format(amount),
                    recipientUri));

                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        removeDialog(4);
                        dialog.dismiss();

                        friend = null;
                        btnAddContacts.setText("Add recipient");
                        txtAmount.setText("$0.00");
                        txtComments.setText("");
                    }
                });
                return alertDialog;
            case NORECIPIENTSPECIFIED_DIALOG:
                alertDialog = new AlertDialog.Builder(RequestPaymentActivity.this)
                .create();
                alertDialog.setTitle("Invalid Recipient");
                alertDialog
                .setMessage("Your recipient does not have a valid paypoint.");

                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                });

                return alertDialog;
            case NOAMOUNTSPECIFIED_DIALOG:
                alertDialog = new AlertDialog.Builder(RequestPaymentActivity.this)
                .create();
                alertDialog.setTitle("Please Specify an Amount");
                alertDialog.setMessage("You must specify the amount to send.");

                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                });

                return alertDialog;

            case INVALIDPASSCODELENGTH_DIALOG:
                alertDialog = new AlertDialog.Builder(RequestPaymentActivity.this)
                .create();
                alertDialog.setTitle("Invalid Passcode");
                alertDialog
                .setMessage("Your passcode is atleast 4 buttons. Please try again.");
>>>>>>> a64803fcbbd4e9f4592ec783636e93a924f51f65

                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
Solution content
			return alertDialog;

            else {

public class RequestPaymentActivity extends BaseActivity {

	public static final String TAG = "RequestMoneyActivity";

	private String recipientUri;
	private double amount = 0;

	private String comments = "";
	private String errorMessage = "";

	private Location location;
	private LocationManager locationManager;
	private LocationListener locationListener;

	private Friend friend;
	
	private ImageButton btnCamera;
	private Button btnAddContacts;
	private Button txtAmount;
	private EditText txtComments;
	private Button btnRequestMoney;
	private String passcode = "";

	final private int ADDING_FRIEND = 6;
	final private int SUBMITREQUEST_DIALOG = 0;
	final private int NORECIPIENTSPECIFIED_DIALOG = 1;
	final private int NOAMOUNTSPECIFIED_DIALOG = 2;
	final private int SUBMITREQUESTFAILED_DIALOG = 3;
	final private int SUBMITREQUESTSUCCESS_DIALOG = 4;
	final private int INVALIDPASSCODELENGTH_DIALOG = 5;
	final private int PAYMENTEXCEEDSLIMIT_DIALOG = 6;
	final private int ADD_MONEY = 8;
	final private int SUBMITREQUEST_ACTION = 1;
	final private int CAMERA = 20;
	
	private View requestMoneyView = null;
	private Response paymentResponse;

	private Dialog dialog = null;
	private Handler dialogHandler = new Handler() {
		public void handleMessage(Message msg) {
			dialog.dismiss();
			switch (msg.what) {
			case SUBMITREQUEST_ACTION:
				removeDialog(SUBMITREQUEST_DIALOG);

				if (paymentResponse != null
						&& paymentResponse.Success) {
					showDialog(SUBMITREQUESTSUCCESS_DIALOG);

				} else if (paymentResponse != null) {
					errorMessage = paymentResponse.ReasonPhrase;
					showDialog(SUBMITREQUESTFAILED_DIALOG);
				} else {
					showDialog(SUBMITREQUESTFAILED_DIALOG);
				}
				break;
			}
		}
	};

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setTitle("Request Money");

	    locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
					friend = null;
		locationManager.removeUpdates(locationListener);
	}
		locationListener = new LocationListener() {

			@Override
			public void onLocationChanged(Location arg0) {
				// TODO Auto-generated method stub
				if (isBetterLocation(arg0, location)) {
					location = arg0;
				}
			}

			@Override
			public void onProviderDisabled(String arg0) {
				// TODO Auto-generated method stub

			}

			@Override
			public void onProviderEnabled(String provider) {
				// TODO Auto-generated method stub

			}

			@Override
			public void onStatusChanged(String provider, int status,
					Bundle extras) {
				// TODO Auto-generated method stub

			}

		};

		launchRequestMoneyView();
	}

	@Override
	public void onResume() {
		super.onResume();
		tracker.trackPageView("Request Money");
		locationManager.requestLocationUpdates(
				LocationManager.GPS_PROVIDER, 0, 0, locationListener);
//		locationManager.requestLocationUpdates(
//				LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);


	}

	@Override
	public void onPause() {
		super.onPause();
	protected android.app.Dialog onCreateDialog(int id) {
		
		AlertDialog alertDialog = null;
		ProgressDialog progressDialog = null;
		Thread thread = null;
		switch (id) {
		case SUBMITREQUEST_DIALOG:
			progressDialog = new ProgressDialog(this);
			tracker.trackPageView("Request Money: Confirm");
			progressDialog.setMessage("Submitting Request...");
			progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);

			thread = new Thread(new Runnable() {

				@Override
				public void run() {
					try {
						SubmitRequest();

					} catch (Exception e) {
						e.printStackTrace();
					}
					dialogHandler.sendEmptyMessage(SUBMITREQUEST_ACTION);
				}

			});
			dialog = progressDialog;
			thread.start();

			return dialog;
		case SUBMITREQUESTFAILED_DIALOG:
			alertDialog = new AlertDialog.Builder(this).create();
			alertDialog.setTitle("Failed");

			alertDialog
					.setMessage(errorMessage);
			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();

				}
			});

			return alertDialog;
		case SUBMITREQUESTSUCCESS_DIALOG:
			tracker.trackPageView("Request Money: Completed");
			alertDialog = new AlertDialog.Builder(this).create();
			alertDialog.setTitle("Request Sumitted");
			NumberFormat nf = NumberFormat.getCurrencyInstance();

			alertDialog.setMessage(String.format(
					"Your request for %s was sent to %s.", nf.format(amount),
					recipientUri));
			
			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					removeDialog(4);
					dialog.dismiss();

					btnAddContacts.setText("Add recipient");
					txtAmount.setText("$0.00");
					txtComments.setText("");
				}
			});
			return alertDialog;
		case NORECIPIENTSPECIFIED_DIALOG:
			alertDialog = new AlertDialog.Builder(RequestPaymentActivity.this)
					.create();
			alertDialog.setTitle("Invalid Recipient");
			alertDialog
					.setMessage("Your recipient does not have a valid paypoint.");

			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});

			return alertDialog;
		case NOAMOUNTSPECIFIED_DIALOG:
			alertDialog = new AlertDialog.Builder(RequestPaymentActivity.this)
					.create();
			alertDialog.setTitle("Please Specify an Amount");
			alertDialog.setMessage("You must specify the amount to send.");

			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});

			return alertDialog;

		case INVALIDPASSCODELENGTH_DIALOG:
			alertDialog = new AlertDialog.Builder(RequestPaymentActivity.this)
					.create();
			alertDialog.setTitle("Invalid Passcode");
			alertDialog
					.setMessage("Your passcode is atleast 4 buttons. Please try again.");

			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});

		case PAYMENTEXCEEDSLIMIT_DIALOG:
			alertDialog = new AlertDialog.Builder(RequestPaymentActivity.this)
			.create();
			alertDialog.setTitle("Exceeds Limit");
			alertDialog
			.setMessage("The payment exceeds your upper limit. Please try again.");

			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});

			return alertDialog;

		}

		return null;
	}

	protected void launchRequestMoneyView() {

		requestMoneyView = View.inflate(this, R.layout.requestmoney_controller, null);
		setContentView(requestMoneyView);


		txtComments = (EditText) findViewById(R.id.txtRequestMoneyComments);
		btnRequestMoney = (Button) findViewById(R.id.btnSubmit);
		Typeface type = Typeface.createFromAsset(getAssets(),"HelveticaWorld-Bold.ttf");
		btnRequestMoney.setTypeface(type);
		btnRequestMoney.setTextColor(Color.WHITE);

		txtAmount = (Button) findViewById(R.id.txtRequestMoneyAmount);
		txtAmount.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				startActivityForResult(new Intent(RequestPaymentActivity.this, AddMoneyActivity.class), ADD_MONEY);
			}
		});
		
		btnCamera = (ImageButton) findViewById(R.id.camera);
		btnCamera.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View v) {
				startActivityForResult(new Intent(RequestPaymentActivity.this, CameraActivity.class), CAMERA);
			}	
		});

		btnAddContacts = (Button) findViewById(R.id.addRecipient);
		btnAddContacts.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				startActivityForResult(new Intent(RequestPaymentActivity.this, FriendsListActivity.class), ADDING_FRIEND);
			}

		});

		btnRequestMoney.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				boolean isValid = true;

				amount = Double.parseDouble(txtAmount.getText().toString()
						.replaceAll("[$,]*", ""));
				comments = txtComments.getText().toString();

				if (isValid & recipientUri.length() == 0) {
					showDialog(NORECIPIENTSPECIFIED_DIALOG);
					isValid = false;
				}
				if (isValid & amount == 0) {
					showDialog(NOAMOUNTSPECIFIED_DIALOG);
					isValid = false;
				}
				if (isValid && amount > prefs.getInt("upperLimit", 0)) {
					showDialog(PAYMENTEXCEEDSLIMIT_DIALOG);
					isValid = false;
				}
				if (isValid) {

					Location lastKnownLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

					if (isBetterLocation(lastKnownLocation, location)) {
						location = lastKnownLocation;
					}

					if(prefs.getString("userId", "").length() == 0) {
						startActivityForResult(new Intent(RequestPaymentActivity.this, SignInActivity.class), 1);
					} else {
						showSecurityPinDialog();
					}
				}
			}
		});

		btnRequestMoney.setVisibility(View.VISIBLE);
	}

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_OK) {
            if (requestCode == ADDING_FRIEND) {
                Bundle bundle = data.getExtras();
                addingContact(bundle.getString("id"), bundle.getString("paypoint"));
            }
            else if(requestCode == ADD_MONEY){
                Bundle bundle = data.getExtras();
                String amount = bundle.getString("index");
                txtAmount.setText(amount);
            }
            else if(requestCode == CAMERA)
            {
                try{

                    String path = (String) data.getExtras().get("index");
                    FileInputStream in = new FileInputStream(path);
                    Bitmap thumbnail = BitmapFactory.decodeStream(in);
                    ImageView cameraImage = (ImageView) findViewById(R.id.cameraImage);
                    cameraImage.setImageBitmap(thumbnail);
                }
                catch (Exception e)
                {
                    e.printStackTrace();
                }
            }
            else {
                launchRequestMoneyView();
            }
        }
        else {
            if (requestCode != ADDING_FRIEND && requestCode != ADD_MONEY && requestCode != CAMERA) {
                finish();
            }
        }

    }

    protected void showSecurityPinDialog() {
        final Dialog d = new Dialog(RequestPaymentActivity.this, R.style.CustomDialogTheme);
        d.setContentView(R.layout.security_dialog);

        d.getWindow().setLayout(400, 600);
        d.show();

        TextView txtConfirmHeader = (TextView)d.findViewById(R.id.txtConfirmHeader);
        TextView txtConfirmBody = (TextView)d.findViewById(R.id.txtConfirmBody);

        txtConfirmHeader.setText("Confirm Your Request");
        txtConfirmBody.setText(
            String.format("To confirm your request for %s from %s, swipe you pin below.",
                txtAmount.getText(), friend.getName()));

        Button btnCancel = (Button) d.findViewById(R.id.btnCancelSendMoney);
        btnCancel.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                d.dismiss();
            }
        });

        final CustomLockView ctrlSecurityPin = (CustomLockView) d.findViewById(R.id.ctrlSecurityPin);
        ctrlSecurityPin.invalidate();
        ctrlSecurityPin.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                passcode = ctrlSecurityPin.getPasscode();

                if (passcode.length() > 3) {

                    amount = Double.parseDouble(txtAmount.getText().toString()
                        .replaceAll("[$,]*", ""));
                    comments = txtComments.getText().toString();
                    passcode = ctrlSecurityPin.getPasscode();

                    d.dismiss();

                    showDialog(SUBMITREQUEST_DIALOG);
                } else
                    showDialog(INVALIDPASSCODELENGTH_DIALOG);

                return false;
            }
        });
    }

    private void addingContact(String id, String paypoint) {
        Friend chosenContact = new Friend();
        if (id != null)
        {
            chosenContact.setId(id);
            friend = friendsList.get(friendsList.indexOf(chosenContact));

            if (friend.isFBContact()) {
                recipientUri = "fb_" + friend.getId();
                btnAddContacts.setText(friend.getName() + ": " + friend.getId());
            }
                recipientUri = "" + friend.getPaypoint();
                btnAddContacts.setText(friend.toString());
            }
        }
        else
        {
            chosenContact.setName("New Contact");
            chosenContact.setPaypoint(paypoint);
            friend = chosenContact;
            recipientUri = "" + paypoint;
            btnAddContacts.setText("New contact: " + paypoint);
        }
    }

    protected void SubmitRequest() {

        PaymentRequest paymentRequest = new PaymentRequest();
        paymentRequest.SenderAccountId = prefs.getString("paymentAccountId", "");
        paymentRequest.SenderUri = prefs.getString("login", "");
        paymentRequest.RecipientUri = recipientUri;
        paymentRequest.Amount = amount;
        paymentRequest.Comments = comments;
        paymentRequest.SecurityPin = passcode;

        if (location != null) {
            paymentRequest.Latitude = location.getLatitude();
            paymentRequest.Longitude = location.getLongitude();
        }

        paymentResponse = PaymentServices.requestMoney(paymentRequest);
    }

    /** Determines whether one Location reading is better than the current Location fix
     * @param location  The new Location that you want to evaluate
     * @param currentBestLocation  The current Location fix, to which you want to compare the new one
     */
    private boolean isBetterLocation(Location location, Location currentBestLocation) {
        final int TWO_MINUTES = 1000 * 60 * 2;

        if (location != null) {

            if (currentBestLocation == null) {
                // A new location is always better than no location
                return true;
            }

            // Check whether the new location fix is newer or older
            long timeDelta = location.getTime() - currentBestLocation.getTime();
            boolean isSignificantlyNewer = timeDelta > TWO_MINUTES;
            boolean isSignificantlyOlder = timeDelta < -TWO_MINUTES;
            boolean isNewer = timeDelta > 0;

            // If it's been more than two minutes since the current location, use the new location
            // because the user has likely moved
            if (isSignificantlyNewer) {
                return true;
                // If the new location is more than two minutes older, it must be worse
            } else if (isSignificantlyOlder) {
                return false;
            }

            // Check whether the new location fix is more or less accurate
            int accuracyDelta = (int) (location.getAccuracy() - currentBestLocation.getAccuracy());
            boolean isLessAccurate = accuracyDelta > 0;
            boolean isMoreAccurate = accuracyDelta < 0;
            boolean isSignificantlyLessAccurate = accuracyDelta > 200;

            // Check if the old and new location are from the same provider
            boolean isFromSameProvider = isSameProvider(location.getProvider(),
                currentBestLocation.getProvider());

            // Determine location quality using a combination of timeliness and accuracy
            if (isMoreAccurate) {
                return true;
            } else if (isNewer && !isLessAccurate) {
                return true;
            } else if (isNewer && !isSignificantlyLessAccurate && isFromSameProvider) {
                return true;
            }
        }
        return false;
    }

    /** Checks whether two providers are the same */
    private boolean isSameProvider(String provider1, String provider2) {
        if (provider1 == null) {
            return provider2 == null;
        }
        return provider1.equals(provider2);
    }
}
File
RequestPaymentActivity.java
Developer's decision
Manual
Kind of conflict
Annotation
Attribute
Case statement
If statement
Method declaration
Method invocation
Method signature
Return statement
Switch statement
Variable