| 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 |
| 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 |
| 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 |
| 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 |
| 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 |