| Chunk |
|---|
| Conflicting content |
|---|
private static final int TIME_DIALOG_ID = 4;
private static final int DATE_DIALOG_ID = 5;
private final static Handler mHandler = new Handler();
private boolean mError = false;
private EditText mIncidentTitle;
<<<<<<< HEAD
private EditText mIncidentLocation;
private EditText mIncidentDesc;
private TextView mIncidentDate;
private ImageView mSelectedPhoto;
private TextView mSelectedCategories;
private Button mBtnSend;
private Button mBtnCancel;
private Button mBtnAddCategory;
private Button mPickTime;
private Button mPickDate;
private Button mBtnPicture;
private Button mAddLocation;
private HashMap |
| Solution content |
|---|
private boolean mError = false;
private EditText mIncidentTitle;
private EditText mIncidentLocation;
private EditText mIncidentDesc;
private TextView mIncidentDate;
private ImageView mSelectedPhoto;
private TextView mSelectedCategories;
private Button mBtnSend;
private Button mBtnCancel;
private Button mBtnAddCategory;
private Button mPickTime;
private Button mPickDate;
private Button mBtnPicture;
private Button mAddLocation;
private HashMap |
| File |
|---|
| AddIncident.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.add_incident);
mFoundAddresses = new ArrayList();
<<<<<<< HEAD
mGc = new Geocoder(this);
//load settings
UshahidiPref.loadSettings(AddIncident.this);
=======
mGc = new Geocoder(this);
// load settings
UshahidiService.loadSettings(AddIncident.this);
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
initComponents();
} |
| Solution content |
|---|
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.add_incident);
mFoundAddresses = new ArrayList();
mGc = new Geocoder(this);
// load settings
UshahidiPref.loadSettings(AddIncident.this);
initComponents();
} |
| File |
|---|
| AddIncident.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
if( !hasFocus ) {
}
return false;
}
<<<<<<< HEAD
//menu stuff
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenu.ContextMenuInfo menuInfo) {
populateMenu(menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
populateMenu(menu);
return(super.onCreateOptionsMenu(menu));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return(applyMenuChoice(item) ||
super.onOptionsItemSelected(item));
}
@Override
public boolean onContextItemSelected(MenuItem item) {
return(applyMenuChoice(item) ||
super.onContextItemSelected(item));
}
private void populateMenu(Menu menu) {
MenuItem i;
i = menu.add( Menu.NONE, HOME, Menu.NONE, R.string.menu_home );
i.setIcon(R.drawable.ushahidi_home);
i = menu.add( Menu.NONE, LIST_INCIDENT, Menu.NONE, R.string.incident_list );
i.setIcon(R.drawable.ushahidi_list);
i = menu.add( Menu.NONE, INCIDENT_MAP, Menu.NONE, R.string.incident_menu_map );
i.setIcon(R.drawable.ushahidi_map);
i = menu.add( Menu.NONE, INCIDENT_REFRESH, Menu.NONE, R.string.incident_menu_refresh );
i.setIcon(R.drawable.ushahidi_refresh);
i = menu.add( Menu.NONE, SETTINGS, Menu.NONE, R.string.menu_settings );
i.setIcon(R.drawable.ushahidi_settings);
i = menu.add( Menu.NONE, ABOUT, Menu.NONE, R.string.menu_about );
i.setIcon(R.drawable.ushahidi_about);
}
private boolean applyMenuChoice(MenuItem item) {
Intent launchPreferencesIntent;
switch (item.getItemId()) {
case LIST_INCIDENT:
launchPreferencesIntent = new Intent( AddIncident.this,ListIncidents.class);
startActivityForResult(launchPreferencesIntent, LIST_INCIDENTS);
setResult(RESULT_OK);
return true;
mIncidentTitle.setOnFocusChangeListener(new View.OnFocusChangeListener() {
if(TextUtils.isEmpty(mIncidentTitle.getText())) {
addReportsTask.execute();
case INCIDENT_MAP:
public void onFocusChange(View v, boolean hasFocus) {
launchPreferencesIntent = new Intent( AddIncident.this, ViewIncidents.class);
startActivityForResult(launchPreferencesIntent,MAP_INCIDENTS);
return true;
case HOME:
launchPreferencesIntent = new Intent( AddIncident.this,Ushahidi.class);
startActivityForResult(launchPreferencesIntent, GOTOHOME);
setResult(RESULT_OK);
return true;
case ABOUT:
launchPreferencesIntent = new Intent( AddIncident.this,About.class);
startActivityForResult(launchPreferencesIntent, REQUEST_CODE_ABOUT);
setResult(RESULT_OK);
return true;
case SETTINGS:
launchPreferencesIntent = new Intent().setClass(AddIncident.this, Settings.class);
// Make it a subactivity so we know when it returns
startActivityForResult(launchPreferencesIntent, REQUEST_CODE_SETTINGS);
return true;
}
return false;
}
/**
* Initialize UI components
*/
private void initComponents(){
mBtnPicture = (Button) findViewById(R.id.btnPicture);
mBtnAddCategory = (Button) findViewById(R.id.add_category);
mBtnSend = (Button) findViewById(R.id.incident_add_btn);
mBtnCancel = (Button) findViewById(R.id.incident_add_cancel);
mIncidentDate = (TextView) findViewById(R.id.lbl_date);
mPickDate = (Button) findViewById(R.id.pick_date);
mPickTime = (Button) findViewById(R.id.pick_time);
mAddLocation = (Button) findViewById(R.id.location);
mSelectedPhoto = (ImageView) findViewById(R.id.sel_photo_prev);
mSelectedCategories = (TextView) findViewById(R.id.lbl_category);
mIncidentTitle = (EditText) findViewById(R.id.incident_title);
mIncidentLocation = (EditText) findViewById(R.id.incident_location);
mIncidentTitle.setError(getString(R.string.empty_report_title));
}
}
}
});
mIncidentLocation.setOnFocusChangeListener( new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if( !hasFocus ) {
if( TextUtils.isEmpty(mIncidentLocation.getText())) {
mIncidentLocation.setError(getString(R.string.empty_report_location));
}
}
}
});
mIncidentDesc = (EditText) findViewById(R.id.incident_desc);
mIncidentDesc.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if( !hasFocus ) {
if(TextUtils.isEmpty(mIncidentDesc.getText())) {
mIncidentDesc.setError(getString(R.string.empty_report_description));
}
}
}
});
//open location map window
mAddLocation.setOnClickListener( new View.OnClickListener(){
public void onClick( View v ) {
Intent intent = new Intent( AddIncident.this,LocationMap.class);
startActivityForResult(intent,VIEW_MAP);
setResult( RESULT_OK, intent );
}
});
mBtnSend.setOnClickListener(new View.OnClickListener() {
public void onClick(View v){
//Dipo Fix
mError = false;
if( TextUtils.isEmpty(mIncidentTitle.getText())) {
mErrorMessage = getString(R.string.empty_report_title);
mError = true;
}
if( TextUtils.isEmpty(mIncidentDesc.getText())) {
mErrorMessage += getString(R.string.empty_report_description);
mError = true;
}
if( TextUtils.isEmpty(mIncidentLocation.getText())) {
mErrorMessage += getString(R.string.empty_report_location);
mError = true;
}
//Dipo Fix
if(mVectorCategories.size() == 0) {
mErrorMessage += getString(R.string.empty_report_categories);
mError = true;
}
if( !mError ) {
AddReportsTask addReportsTask = new AddReportsTask();
addReportsTask.appContext = AddIncident.this;
addReportsTask.execute();
}else{
final Toast t = Toast.makeText(AddIncident.this,
"Error!\n\n"+ mErrorMessage,
Toast.LENGTH_LONG);
t.show();
mErrorMessage = "";
}
}
});
mBtnPicture.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showDialog(DIALOG_CHOOSE_IMAGE_METHOD);
}
});
mBtnCancel.setOnClickListener( new View.OnClickListener() {
public void onClick(View v) {
clearFields();
Intent intent = new Intent( AddIncident.this,Ushahidi.class);
startActivityForResult( intent, GOTOHOME );
setResult(RESULT_OK);
finish();
}
});
mBtnAddCategory.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showDialog(DIALOG_MULTIPLE_CATEGORY);
mCounter++;
}
});
mPickDate.setOnClickListener(new View.OnClickListener() {
=======
/**
* Initialize UI components
*/
private void initComponents() {
mBtnPicture = (Button)findViewById(R.id.btnPicture);
mBtnAddCategory = (Button)findViewById(R.id.add_category);
mBtnSend = (Button)findViewById(R.id.incident_add_btn);
mBtnCancel = (Button)findViewById(R.id.incident_add_cancel);
mIncidentDate = (TextView)findViewById(R.id.lbl_date);
mPickDate = (Button)findViewById(R.id.pick_date);
mPickTime = (Button)findViewById(R.id.pick_time);
mAddLocation = (Button)findViewById(R.id.location);
mSelectedPhoto = (TextView)findViewById(R.id.lbl_photo);
mSelectedCategories = (TextView)findViewById(R.id.lbl_category);
mIncidentTitle = (EditText)findViewById(R.id.incident_title);
mIncidentLocation = (EditText)findViewById(R.id.incident_location);
mIncidentTitle.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
if (TextUtils.isEmpty(mIncidentTitle.getText())) {
mIncidentTitle.setError(getString(R.string.empty_report_title));
}
}
}
});
mIncidentLocation.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
if (TextUtils.isEmpty(mIncidentLocation.getText())) {
mIncidentLocation.setError(getString(R.string.empty_report_location));
}
}
}
});
mIncidentDesc = (EditText)findViewById(R.id.incident_desc);
mIncidentDesc.setOnFocusChangeListener(new View.OnFocusChangeListener() {
addReportsTask.appContext = AddIncident.this;
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
if (TextUtils.isEmpty(mIncidentDesc.getText())) {
mIncidentDesc.setError(getString(R.string.empty_report_description));
}
}
}
});
// open location map window
mAddLocation.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(AddIncident.this, LocationMap.class);
startActivityForResult(intent, VIEW_MAP);
setResult(RESULT_OK, intent);
}
});
mBtnSend.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Dipo Fix
mError = false;
if (TextUtils.isEmpty(mIncidentTitle.getText())) {
mErrorMessage = getString(R.string.empty_report_title);
mError = true;
}
if (TextUtils.isEmpty(mIncidentDesc.getText())) {
mErrorMessage += getString(R.string.empty_report_description);
mError = true;
}
if (TextUtils.isEmpty(mIncidentLocation.getText())) {
mErrorMessage += getString(R.string.empty_report_location);
mError = true;
}
// Dipo Fix
if (mVectorCategories.size() == 0) {
mErrorMessage += getString(R.string.empty_report_categories);
mError = true;
}
if (!mError) {
AddReportsTask addReportsTask = new AddReportsTask();
} else {
final Toast t = Toast.makeText(AddIncident.this, "Error!\n\n" + mErrorMessage,
Toast.LENGTH_LONG);
t.show();
mErrorMessage = "";
}
}
});
mBtnPicture.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showDialog(DIALOG_CHOOSE_IMAGE_METHOD);
}
});
mBtnCancel.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
clearFields();
Intent intent = new Intent(AddIncident.this, Ushahidi.class);
startActivityForResult(intent, GOTOHOME);
setResult(RESULT_OK);
finish();
}
});
mBtnAddCategory.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showDialog(DIALOG_MULTIPLE_CATEGORY);
mCounter++;
}
});
mPickDate.setOnClickListener(new View.OnClickListener() {
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
public void onClick(View v) {
showDialog(DATE_DIALOG_ID); |
| Solution content |
|---|
}
return false;
}
/**
* Initialize UI components
*/
private void initComponents() {
mBtnPicture = (Button)findViewById(R.id.btnPicture);
mBtnAddCategory = (Button)findViewById(R.id.add_category);
mBtnSend = (Button)findViewById(R.id.incident_add_btn);
mBtnCancel = (Button)findViewById(R.id.incident_add_cancel);
mIncidentDate = (TextView)findViewById(R.id.lbl_date);
mPickDate = (Button)findViewById(R.id.pick_date);
mPickTime = (Button)findViewById(R.id.pick_time);
mAddLocation = (Button)findViewById(R.id.location);
mSelectedPhoto = (ImageView)findViewById(R.id.sel_photo_prev);
mSelectedCategories = (TextView)findViewById(R.id.lbl_category);
mIncidentTitle = (EditText)findViewById(R.id.incident_title);
mIncidentLocation = (EditText)findViewById(R.id.incident_location);
mIncidentTitle.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
if (TextUtils.isEmpty(mIncidentTitle.getText())) {
mIncidentTitle.setError(getString(R.string.empty_report_title));
}
}
}
});
mIncidentLocation.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
if (TextUtils.isEmpty(mIncidentLocation.getText())) {
mIncidentLocation.setError(getString(R.string.empty_report_location));
}
}
}
});
mIncidentDesc = (EditText)findViewById(R.id.incident_desc);
mIncidentDesc.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
if (TextUtils.isEmpty(mIncidentDesc.getText())) {
mIncidentDesc.setError(getString(R.string.empty_report_description));
}
}
}
});
// open location map window
mAddLocation.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(AddIncident.this, LocationMap.class);
startActivityForResult(intent, VIEW_MAP);
setResult(RESULT_OK, intent);
}
});
mBtnSend.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Dipo Fix
mError = false;
if (TextUtils.isEmpty(mIncidentTitle.getText())) {
mErrorMessage = getString(R.string.empty_report_title);
mError = true;
}
if (TextUtils.isEmpty(mIncidentDesc.getText())) {
mErrorMessage += getString(R.string.empty_report_description);
mError = true;
}
if (TextUtils.isEmpty(mIncidentLocation.getText())) {
mErrorMessage += getString(R.string.empty_report_location);
mError = true;
}
// Dipo Fix
if (mVectorCategories.size() == 0) {
mErrorMessage += getString(R.string.empty_report_categories);
mError = true;
}
if (!mError) {
AddReportsTask addReportsTask = new AddReportsTask();
addReportsTask.appContext = AddIncident.this;
addReportsTask.execute();
} else {
final Toast t = Toast.makeText(AddIncident.this, "Error!\n\n" + mErrorMessage,
Toast.LENGTH_LONG);
t.show();
mErrorMessage = "";
}
}
});
mBtnPicture.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showDialog(DIALOG_CHOOSE_IMAGE_METHOD);
}
});
mBtnCancel.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
clearFields();
Intent intent = new Intent(AddIncident.this, Ushahidi.class);
startActivityForResult(intent, GOTOHOME);
setResult(RESULT_OK);
finish();
}
});
mBtnAddCategory.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showDialog(DIALOG_MULTIPLE_CATEGORY);
mCounter++;
}
});
mPickDate.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showDialog(DATE_DIALOG_ID); |
| File |
|---|
| AddIncident.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Cast expression |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
mBundle = null;
}
}
mMinute = c.get(Calendar.MINUTE);
c.get(Calendar.AM_PM);
updateDisplay();
<<<<<<< HEAD
}
//fetch categories
public String[] showCategories() {
mExtras = data.getExtras();
super.onActivityResult(requestCode, resultCode, data);
mBundle = null;
// The preferences returned if the request code is what we had given
// earlier in startSubActivity
switch(requestCode) {
case REQUEST_CODE_CAMERA:
if(resultCode != RESULT_OK){
return;
}
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); //pull it out of landscape mode
mVectorCategories.clear();
Cursor cursor = UshahidiApplication.mDb.fetchAllCategories();
String categories[] = new String[cursor.getCount()];
int i = 0;
if (cursor.moveToFirst()) {
int titleIndex = cursor.getColumnIndexOrThrow(UshahidiDatabase.CATEGORY_TITLE);
int idIndex = cursor.getColumnIndexOrThrow(UshahidiDatabase.CATEGORY_ID);
do {
categories[i] = cursor.getString(titleIndex);
mCategoriesTitle.put(String.valueOf(cursor.getInt(idIndex)),
cursor.getString(titleIndex));
mCategoriesId.add(String.valueOf(cursor.getInt(idIndex)));
i++;
}while( cursor.moveToNext() );
}
cursor.close();
return categories;
}
//reset records in the field
private void clearFields() {
mBtnPicture = (Button) findViewById(R.id.btnPicture);
mBtnAddCategory = (Button) findViewById(R.id.add_category);
mIncidentTitle.setText("");
mIncidentLocation.setText("");
mIncidentDesc.setText("");
mVectorCategories.clear();
mSelectedCategories.setText("");
mCounter = 0;
updateDisplay();
//clear persistent data
SharedPreferences.Editor editor = getPreferences(0).edit();
editor.putString("title", "");
editor.putString("desc", "");
editor.putString("date", "");
editor.commit();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
mExtras = data.getExtras();
if ( mExtras != null ) mBundle = mExtras.getBundle("filename");
if ( mBundle != null && !mBundle.isEmpty() ) {
UshahidiPref.fileName = mBundle.getString("name");
mSelectedPhoto.setImageDrawable(ImageManager.getImages(UshahidiPref.fileName));
}
break;
case REQUEST_CODE_IMAGE:
if(resultCode != RESULT_OK){
return;
}
Uri uri = data.getData();
Bitmap b = null;
try {
b = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
} catch (FileNotFoundException e) {
break;
} catch (IOException e) {
break;
}
ByteArrayOutputStream byteArrayos = new ByteArrayOutputStream();
try {
b.compress(CompressFormat.JPEG, 75, byteArrayos);
byteArrayos.flush();
} catch (OutOfMemoryError e){
break;
} catch (IOException e) {
break;
}
mFilename = "android_pic_upload" + randomString() + ".jpg";
ImageManager.writeImage(byteArrayos.toByteArray(), mFilename);
UshahidiPref.fileName = mFilename;
mSelectedPhoto.setImageBitmap(ImageManager.getBitmap(UshahidiPref.fileName));
break;
case VIEW_MAP:
if(resultCode != RESULT_OK){
return;
}
if( mExtras != null ) mBundle = mExtras.getBundle("locations");
if( mBundle != null && !mBundle.isEmpty() ) {
mIncidentLocation.setText( mBundle.getString("location"));
AddIncident.sLatitude = mBundle.getDouble("latitude");
AddIncident.sLongitude = mBundle.getDouble("longitude");
}
break;
}
}
private static Random random = new Random();
protected static String randomString() {
return Long.toString(random.nextLong(), 10);
}
//
final Runnable mSentIncidentOffline = new Runnable() {
public void run() {
if( addToDb() == -1 ) {
mHandler.post(mSentIncidentFail);
}else {
mHandler.post(mSentIncidentOfflineSuccess);
//clearFields();
}
}
};
final Runnable mSentIncidentFail = new Runnable() {
public void run() {
Util.showToast(AddIncident.this, R.string.failed_to_add_report_online);
}
};
final Runnable mSentIncidentOfflineFail = new Runnable() {
public void run() {
Util.showToast(AddIncident.this, R.string.failed_to_add_report_offline);
}
};
final Runnable mSentIncidentOfflineSuccess = new Runnable() {
public void run() {
Util.showToast(AddIncident.this, R.string.report_successfully_added_offline);
}
};
//
final Runnable mSendIncidentOnline = new Runnable() {
public void run() {
if( !postToOnline() ) {
mHandler.post(mSentIncidentFail);
}else {
mHandler.post(mSentIncidentSuccess);
}
}
};
//
final Runnable mSentIncidentSuccess = new Runnable() {
public void run() {
Util.showToast(AddIncident.this, R.string.report_successfully_added_online);
}
};
/**
* Create various dialog
*/
@Override
=======
}
// fetch categories
public String[] showCategories() {
Cursor cursor = UshahidiApplication.mDb.fetchAllCategories();
String categories[] = new String[cursor.getCount()];
int i = 0;
if (cursor.moveToFirst()) {
int titleIndex = cursor.getColumnIndexOrThrow(UshahidiDatabase.CATEGORY_TITLE);
int idIndex = cursor.getColumnIndexOrThrow(UshahidiDatabase.CATEGORY_ID);
do {
categories[i] = cursor.getString(titleIndex);
mCategoriesTitle.put(String.valueOf(cursor.getInt(idIndex)),
cursor.getString(titleIndex));
mCategoriesId.add(String.valueOf(cursor.getInt(idIndex)));
i++;
} while (cursor.moveToNext());
}
cursor.close();
return categories;
}
// reset records in the field
private void clearFields() {
mBtnPicture = (Button)findViewById(R.id.btnPicture);
mBtnAddCategory = (Button)findViewById(R.id.add_category);
mIncidentTitle.setText("");
mIncidentLocation.setText("");
mIncidentDesc.setText("");
if (resultCode != RESULT_OK) {
return;
}
Uri uri = data.getData();
Bitmap b = null;
try {
mSelectedPhoto.setText("");
mSelectedCategories.setText("");
mCounter = 0;
updateDisplay();
// clear persistent data
SharedPreferences.Editor editor = getPreferences(0).edit();
editor.putString("title", "");
editor.putString("desc", "");
editor.putString("date", "");
editor.commit();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// The preferences returned if the request code is what we had given
// earlier in startSubActivity
switch (requestCode) {
case REQUEST_CODE_CAMERA:
if (resultCode != RESULT_OK) {
return;
}
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); // pull
// it
// out
// of
// landscape
// mode
mBundle = null;
mExtras = data.getExtras();
if (mExtras != null)
mBundle = mExtras.getBundle("filename");
if (mBundle != null && !mBundle.isEmpty()) {
UshahidiService.fileName = mBundle.getString("name");
mSelectedPhoto.setText(UshahidiService.fileName);
}
break;
case REQUEST_CODE_IMAGE:
b = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
} catch (FileNotFoundException e) {
break;
} catch (IOException e) {
break;
}
ByteArrayOutputStream byteArrayos = new ByteArrayOutputStream();
try {
b.compress(CompressFormat.JPEG, 75, byteArrayos);
byteArrayos.flush();
} catch (OutOfMemoryError e) {
break;
} catch (IOException e) {
break;
}
mFilename = "android_pic_upload" + randomString() + ".jpg";
ImageManager.writeImage(byteArrayos.toByteArray(), mFilename);
UshahidiService.fileName = mFilename;
mSelectedPhoto.setText(UshahidiService.fileName);
break;
case VIEW_MAP:
if (resultCode != RESULT_OK) {
return;
}
mBundle = null;
mExtras = data.getExtras();
if (mExtras != null)
mBundle = mExtras.getBundle("locations");
if (mBundle != null && !mBundle.isEmpty()) {
mIncidentLocation.setText(mBundle.getString("location"));
AddIncident.sLatitude = mBundle.getDouble("latitude");
AddIncident.sLongitude = mBundle.getDouble("longitude");
}
break;
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
private static Random random = new Random();
protected static String randomString() {
return Long.toString(random.nextLong(), 10);
}
//
final Runnable mSentIncidentOffline = new Runnable() {
public void run() {
if (addToDb() == -1) {
mHandler.post(mSentIncidentFail);
} else {
mHandler.post(mSentIncidentOfflineSuccess);
// clearFields();
}
}
};
final Runnable mSentIncidentFail = new Runnable() {
public void run() {
Util.showToast(AddIncident.this, R.string.failed_to_add_report_online);
}
};
final Runnable mSentIncidentOfflineFail = new Runnable() {
public void run() {
Util.showToast(AddIncident.this, R.string.failed_to_add_report_offline);
}
};
final Runnable mSentIncidentOfflineSuccess = new Runnable() {
public void run() {
Util.showToast(AddIncident.this, R.string.report_successfully_added_offline);
}
};
//
final Runnable mSendIncidentOnline = new Runnable() {
public void run() {
if (!postToOnline()) {
mHandler.post(mSentIncidentFail);
} else {
mHandler.post(mSentIncidentSuccess);
}
}
};
//
final Runnable mSentIncidentSuccess = new Runnable() {
public void run() {
Util.showToast(AddIncident.this, R.string.report_successfully_added_online);
}
};
/**
* Create various dialog
*/
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_ERROR_NETWORK: { |
| Solution content |
|---|
mMinute = c.get(Calendar.MINUTE);
c.get(Calendar.AM_PM);
updateDisplay();
}
// fetch categories
public String[] showCategories() {
Cursor cursor = UshahidiApplication.mDb.fetchAllCategories();
String categories[] = new String[cursor.getCount()];
int i = 0;
if (cursor.moveToFirst()) {
int titleIndex = cursor.getColumnIndexOrThrow(UshahidiDatabase.CATEGORY_TITLE);
int idIndex = cursor.getColumnIndexOrThrow(UshahidiDatabase.CATEGORY_ID);
do {
categories[i] = cursor.getString(titleIndex);
mCategoriesTitle.put(String.valueOf(cursor.getInt(idIndex)),
cursor.getString(titleIndex));
mCategoriesId.add(String.valueOf(cursor.getInt(idIndex)));
i++;
} while (cursor.moveToNext());
}
cursor.close();
return categories;
}
// reset records in the field
private void clearFields() {
mBtnPicture = (Button)findViewById(R.id.btnPicture);
mBtnAddCategory = (Button)findViewById(R.id.add_category);
mIncidentTitle.setText("");
mIncidentLocation.setText("");
mIncidentDesc.setText("");
mVectorCategories.clear();
mSelectedCategories.setText("");
mCounter = 0;
updateDisplay();
// clear persistent data
SharedPreferences.Editor editor = getPreferences(0).edit();
editor.putString("title", "");
editor.putString("desc", "");
editor.putString("date", "");
editor.commit();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// The preferences returned if the request code is what we had given
// earlier in startSubActivity
switch (requestCode) {
case REQUEST_CODE_CAMERA:
if (resultCode != RESULT_OK) {
return;
}
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); // pull
// it
// out
// of
// landscape
// mode
mBundle = null;
mExtras = data.getExtras();
if (mExtras != null)
mBundle = mExtras.getBundle("filename");
if (mBundle != null && !mBundle.isEmpty()) {
UshahidiPref.fileName = mBundle.getString("name");
mSelectedPhoto.setImageDrawable(ImageManager.getImages(UshahidiPref.fileName));
}
break;
case REQUEST_CODE_IMAGE:
if (resultCode != RESULT_OK) {
return;
}
Uri uri = data.getData();
Util.showToast(AddIncident.this, R.string.failed_to_add_report_offline);
}
final Runnable mSentIncidentOfflineFail = new Runnable() {
public void run() {
Bitmap b = null;
try {
b = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
} catch (FileNotFoundException e) {
break;
} catch (IOException e) {
break;
}
ByteArrayOutputStream byteArrayos = new ByteArrayOutputStream();
try {
b.compress(CompressFormat.JPEG, 75, byteArrayos);
byteArrayos.flush();
} catch (OutOfMemoryError e) {
break;
} catch (IOException e) {
break;
}
mFilename = "android_pic_upload" + randomString() + ".jpg";
ImageManager.writeImage(byteArrayos.toByteArray(), mFilename);
UshahidiPref.fileName = mFilename;
mSelectedPhoto.setImageBitmap(ImageManager.getBitmap(UshahidiPref.fileName));
break;
case VIEW_MAP:
if (resultCode != RESULT_OK) {
return;
}
mBundle = null;
mExtras = data.getExtras();
if (mExtras != null)
mBundle = mExtras.getBundle("locations");
if (mBundle != null && !mBundle.isEmpty()) {
mIncidentLocation.setText(mBundle.getString("location"));
AddIncident.sLatitude = mBundle.getDouble("latitude");
AddIncident.sLongitude = mBundle.getDouble("longitude");
}
break;
}
}
private static Random random = new Random();
protected static String randomString() {
return Long.toString(random.nextLong(), 10);
}
//
final Runnable mSentIncidentOffline = new Runnable() {
public void run() {
if (addToDb() == -1) {
mHandler.post(mSentIncidentFail);
} else {
mHandler.post(mSentIncidentOfflineSuccess);
// clearFields();
}
}
};
final Runnable mSentIncidentFail = new Runnable() {
public void run() {
Util.showToast(AddIncident.this, R.string.failed_to_add_report_online);
}
};
};
final Runnable mSentIncidentOfflineSuccess = new Runnable() {
public void run() {
Util.showToast(AddIncident.this, R.string.report_successfully_added_offline);
}
};
//
final Runnable mSendIncidentOnline = new Runnable() {
public void run() {
if (!postToOnline()) {
mHandler.post(mSentIncidentFail);
} else {
mHandler.post(mSentIncidentSuccess);
}
}
};
//
final Runnable mSentIncidentSuccess = new Runnable() {
public void run() {
Util.showToast(AddIncident.this, R.string.report_successfully_added_online);
}
};
/**
* Create various dialog
*/
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_ERROR_NETWORK: { |
| File |
|---|
| AddIncident.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Comment |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
* @author henryaddo
*/
public long addToDb() {
<<<<<<< HEAD
String dates[] = mDateToSubmit.split(" ");
String time[] = dates[1].split(":");
List |
| Solution content |
|---|
* @author henryaddo
*/
public long addToDb() {
String dates[] = mDateToSubmit.split(" ");
String time[] = dates[1].split(":");
List |
| File |
|---|
| AddIncident.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| Method invocation |
| Return statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
* @author henryaddo
*/
public boolean postToOnline() {
<<<<<<< HEAD
String dates[] = mDateToSubmit.split(" ");
String time[] = dates[1].split(":");
String categories = Util.implode(mVectorCategories);
final SharedPreferences settings = getSharedPreferences(
PREFS_NAME, 0);
StringBuilder urlBuilder = new StringBuilder(settings.getString("Domain", ""));
urlBuilder.append("/api");
mParams.put("task","report");
mParams.put("incident_title", mIncidentTitle.getText().toString());
mParams.put("incident_description", mIncidentDesc.getText().toString());
mParams.put("incident_date", dates[0]);
mParams.put("incident_hour", time[0]);
mParams.put("incident_minute", time[1]);
mParams.put("incident_ampm", dates[2].toLowerCase());
mParams.put("incident_category", categories);
mParams.put("latitude", String.valueOf(sLatitude));
mParams.put("longitude", String.valueOf(sLongitude));
mParams.put("location_name", mIncidentLocation.getText().toString());
mParams.put("person_first", UshahidiPref.firstname);
mParams.put("person_last", UshahidiPref.lastname);
mParams.put("person_email", UshahidiPref.email);
mParams.put("filename", UshahidiPref.fileName);
try {
return UshahidiHttpClient.PostFileUpload(urlBuilder.toString(), mParams);
} catch (IOException e) {
e.printStackTrace();
return false;
}
=======
String dates[] = mDateToSubmit.split(" ");
String time[] = dates[1].split(":");
String categories = Util.implode(mVectorCategories);
final SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
StringBuilder urlBuilder = new StringBuilder(settings.getString("Domain", ""));
urlBuilder.append("/api");
mParams.put("task", "report");
mParams.put("incident_title", mIncidentTitle.getText().toString());
mParams.put("incident_description", mIncidentDesc.getText().toString());
mParams.put("incident_date", dates[0]);
mParams.put("incident_hour", time[0]);
mParams.put("incident_minute", time[1]);
mParams.put("incident_ampm", dates[2].toLowerCase());
mParams.put("incident_category", categories);
mParams.put("latitude", String.valueOf(sLatitude));
mParams.put("longitude", String.valueOf(sLongitude));
mParams.put("location_name", mIncidentLocation.getText().toString());
mParams.put("person_first", UshahidiService.firstname);
mParams.put("person_last", UshahidiService.lastname);
mParams.put("person_email", UshahidiService.email);
mParams.put("filename", UshahidiService.fileName);
try {
return UshahidiHttpClient.PostFileUpload(urlBuilder.toString(), mParams);
} catch (IOException e) {
e.printStackTrace();
return false;
}
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
}
/** |
| Solution content |
|---|
* @author henryaddo
*/
public boolean postToOnline() {
String dates[] = mDateToSubmit.split(" ");
String time[] = dates[1].split(":");
String categories = Util.implode(mVectorCategories);
final SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
StringBuilder urlBuilder = new StringBuilder(settings.getString("Domain", ""));
urlBuilder.append("/api");
mParams.put("task", "report");
mParams.put("incident_title", mIncidentTitle.getText().toString());
mParams.put("incident_description", mIncidentDesc.getText().toString());
mParams.put("incident_date", dates[0]);
mParams.put("incident_hour", time[0]);
mParams.put("incident_minute", time[1]);
mParams.put("incident_ampm", dates[2].toLowerCase());
mParams.put("incident_category", categories);
mParams.put("latitude", String.valueOf(sLatitude));
mParams.put("longitude", String.valueOf(sLongitude));
mParams.put("location_name", mIncidentLocation.getText().toString());
mParams.put("person_first", UshahidiPref.firstname);
mParams.put("person_last", UshahidiPref.lastname);
mParams.put("person_email", UshahidiPref.email);
mParams.put("filename", UshahidiPref.fileName);
try {
return UshahidiHttpClient.PostFileUpload(urlBuilder.toString(), mParams);
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
/** |
| File |
|---|
| AddIncident.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method invocation |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
}
return 1;
}
<<<<<<< HEAD
//thread class
private class AddReportsTask extends AsyncTask |
| Solution content |
|---|
}
return 1;
}
// thread class
private class AddReportsTask extends AsyncTask |
| File |
|---|
| AddIncident.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Class declaration |
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
}
public class ImageCaptureCallback implements PictureCallback {
<<<<<<< HEAD
private static Random random = new Random();
protected static String randomString() {
return Long.toString(random.nextLong(), 10);
}
public ImageCaptureCallback() {
}
public void onPictureTaken(byte[] data, Camera camera) {
try {
String filename = "ushandroid_" + randomString() + ".jpg";
ImageManager.writeImage(data, filename);
UshahidiPref.fileName = filename;
} catch (final Exception ex) {
ex.printStackTrace();
}
}
=======
private static Random random = new Random();
protected static String randomString() {
return Long.toString(random.nextLong(), 10);
}
public ImageCaptureCallback() {
}
public void onPictureTaken(byte[] data, Camera camera) {
try {
String filename = "ushandroid_" + randomString() + ".jpg";
ImageManager.writeImage(data, filename);
UshahidiService.fileName = filename;
} catch (final Exception ex) {
ex.printStackTrace();
}
}
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
|
| Solution content |
|---|
public class ImageCaptureCallback implements PictureCallback {
private static Random random = new Random();
protected static String randomString() {
return Long.toString(random.nextLong(), 10);
}
public ImageCaptureCallback() {
}
public void onPictureTaken(byte[] data, Camera camera) {
try {
String filename = "ushandroid_" + randomString() + ".jpg";
ImageManager.writeImage(data, filename);
UshahidiPref.fileName = filename;
} catch (final Exception ex) {
ex.printStackTrace();
}
}
} |
| File |
|---|
| ImageCaptureCallback.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Attribute |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
import android.graphics.drawable.BitmapDrawable;
public class ImageManager {
<<<<<<< HEAD
//Images
public static Drawable getImages(String fileName) {
Drawable d = null;
BitmapDrawable bD = new BitmapDrawable(UshahidiPref.savePath + fileName);
d = bD.mutate();
/*FileInputStream fIn;
if( !TextUtils.isEmpty( fileName) ) {
try {
fIn = new FileInputStream(UshahidiPref.savePath + fileName);
d = Drawable.createFromStream(fIn, "src");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}*/
return d;
}
public static void saveImage() {
byte[] is;
for (String image : UshahidiService.mNewIncidentsImages) {
if (!TextUtils.isEmpty(image)) {
File f = new File(UshahidiPref.savePath + image);
if (!f.exists()) {
try {
is = UshahidiHttpClient.fetchImage(UshahidiPref.domain+"/media/uploads/"+image);
if( is != null ) {
writeImage( is, image );
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
public static void saveThumbnail() {
byte[] is;
public static Drawable getImages(String fileName) {
for (String image : UshahidiService.mNewIncidentsThumbnails) {
if(!TextUtils.isEmpty(image )) {
File f = new File(UshahidiPref.savePath + image);
if(!f.exists()) {
try {
is = UshahidiHttpClient.fetchImage(UshahidiPref.domain+"/media/uploads/"+image);
if( is != null ) {
writeImage(is, image);
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
public static void writeImage(byte[] data, String filename) {
deleteImage(filename);
if( data != null ) {
FileOutputStream fOut;
try {
fOut = new FileOutputStream(UshahidiPref.savePath + filename);
fOut.write(data);
fOut.flush();
fOut.close();
} catch (final FileNotFoundException e) {
e.printStackTrace();
} catch (final IOException e) {
e.printStackTrace();
}
}
}
public static void deleteImage(String filename) {
File f = new File(UshahidiPref.savePath + filename);
if (f.exists()){
f.delete();
}
}
public static Bitmap getBitmap(String fileName) {
Bitmap bitMap = BitmapFactory.decodeFile(UshahidiPref.savePath + fileName);
return bitMap;
}
=======
// Images
Drawable d = null;
FileInputStream fIn;
if (!TextUtils.isEmpty(fileName)) {
try {
fIn = new FileInputStream(UshahidiService.savePath + fileName);
d = Drawable.createFromStream(fIn, "src");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
return d;
}
public static void saveImage() {
byte[] is;
for (String image : UshahidiService.mNewIncidentsImages) {
if (!TextUtils.isEmpty(image)) {
File f = new File(UshahidiService.savePath + image);
if (!f.exists()) {
try {
is = UshahidiHttpClient.fetchImage(UshahidiService.domain
+ "/media/uploads/" + image);
if (is != null) {
writeImage(is, image);
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
public static void saveThumbnail() {
byte[] is;
for (String image : UshahidiService.mNewIncidentsThumbnails) {
if (!TextUtils.isEmpty(image)) {
File f = new File(UshahidiService.savePath + image);
if (!f.exists()) {
try {
is = UshahidiHttpClient.fetchImage(UshahidiService.domain
+ "/media/uploads/" + image);
if (is != null) {
writeImage(is, image);
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
public static void writeImage(byte[] data, String filename) {
deleteImage(filename);
if (data != null) {
FileOutputStream fOut;
try {
fOut = new FileOutputStream(UshahidiService.savePath + filename);
fOut.write(data);
fOut.flush();
fOut.close();
} catch (final FileNotFoundException e) {
e.printStackTrace();
} catch (final IOException e) {
e.printStackTrace();
}
}
}
public static void deleteImage(String filename) {
File f = new File(UshahidiService.savePath + filename);
if (f.exists()) {
f.delete();
}
}
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
} |
| Solution content |
|---|
public class ImageManager {
// Images
public static Drawable getImages(String fileName) {
Drawable d = null;
BitmapDrawable bD = new BitmapDrawable(UshahidiPref.savePath + fileName);
d = bD.mutate();
/*
* FileInputStream fIn; if( !TextUtils.isEmpty( fileName) ) { try { fIn
* = new FileInputStream(UshahidiPref.savePath + fileName); d =
* Drawable.createFromStream(fIn, "src"); } catch (FileNotFoundException
* e) { e.printStackTrace(); } }
*/
return d;
}
public static void saveImage() {
byte[] is;
for (String image : UshahidiService.mNewIncidentsImages) {
if (!TextUtils.isEmpty(image)) {
File f = new File(UshahidiPref.savePath + image);
if (!f.exists()) {
try {
is = UshahidiHttpClient.fetchImage(UshahidiPref.domain + "/media/uploads/"
+ image);
if (is != null) {
writeImage(is, image);
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
public static void saveThumbnail() {
byte[] is;
for (String image : UshahidiService.mNewIncidentsThumbnails) {
if (!TextUtils.isEmpty(image)) {
File f = new File(UshahidiPref.savePath + image);
if (!f.exists()) {
try {
is = UshahidiHttpClient.fetchImage(UshahidiPref.domain + "/media/uploads/"
+ image);
if (is != null) {
writeImage(is, image);
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
public static void writeImage(byte[] data, String filename) {
deleteImage(filename);
if (data != null) {
FileOutputStream fOut;
try {
fOut = new FileOutputStream(UshahidiPref.savePath + filename);
fOut.write(data);
fOut.flush();
fOut.close();
} catch (final FileNotFoundException e) {
e.printStackTrace();
} catch (final IOException e) {
e.printStackTrace();
}
}
}
public static void deleteImage(String filename) {
File f = new File(UshahidiPref.savePath + filename);
if (f.exists()) {
f.delete();
}
}
public static Bitmap getBitmap(String fileName) {
Bitmap bitMap = BitmapFactory.decodeFile(UshahidiPref.savePath + fileName);
return bitMap;
}
} |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
}
}
private static Random random = new Random();
import android.util.Log;
public class SaveIncidentsImage extends Thread {
<<<<<<< HEAD
private byte[] mData;
public String filename;
protected static String randomString() {
return Long.toString(random.nextLong(), 36);
}
public SaveIncidentsImage(byte[] data){
this.mData = data;
}
@Override
public void run() {
filename = "pictureupload" + randomString() + ".jpg";
Log.i("Capture Me", "What: "+ filename);
ImageManager.writeImage(mData, filename);
UshahidiPref.fileName = filename;
File f = new File(UshahidiPref.savePath + filename);
if(f.exists()){
f.delete();
}
}
}
=======
private byte[] mData;
private static Random random = new Random();
public String filename;
protected static String randomString() {
return Long.toString(random.nextLong(), 36);
}
public SaveIncidentsImage(byte[] data) {
this.mData = data;
}
@Override
public void run() {
filename = "pictureupload" + randomString() + ".jpg";
Log.i("Capture Me", "What: " + filename);
ImageManager.writeImage(mData, filename);
UshahidiService.fileName = filename;
File f = new File(UshahidiService.savePath + filename);
if (f.exists()) {
f.delete();
}
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146 |
| Solution content |
|---|
return Long.toString(random.nextLong(), 36);
}
import android.util.Log;
public class SaveIncidentsImage extends Thread {
private byte[] mData;
private static Random random = new Random();
public String filename;
protected static String randomString() {
public SaveIncidentsImage(byte[] data) {
this.mData = data;
}
@Override
public void run() {
filename = "pictureupload" + randomString() + ".jpg";
Log.i("Capture Me", "What: " + filename);
ImageManager.writeImage(mData, filename);
UshahidiPref.fileName = filename;
File f = new File(UshahidiPref.savePath + filename);
if (f.exists()) {
f.delete();
}
}
} |
| File |
|---|
| SaveIncidentsImage.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
private String fromAddress = "";
private String messageBody = "";
<<<<<<< HEAD
private static final Object mStartingServiceSync = new Object();
private static final String TAG = "Ushahidi";
private static PowerManager.WakeLock mStartingService;
private HashMap |
| Solution content |
|---|
params.put("task", "sms");
private String fromAddress = "";
private String messageBody = "";
private static final Object mStartingServiceSync = new Object();
private static final String TAG = "Ushahidi";
private static PowerManager.WakeLock mStartingService;
urlBuilder.append("/api");
* Show a notification
body = sms.getDisplayMessageBody();
} else {
private HashMap |
| File |
|---|
| SmsReceiverService.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Class declaration |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
// return;
}
setContentView(R.layout.main);
mHandler = new Handler();
bundle = new Bundle();
<<<<<<< HEAD
//load settings
if( UshahidiPref.domain.length() == 0 ) {
UshahidiPref.loadSettings(this);
}
//check if domain has been set
if(UshahidiPref.domain.length() == 0 ) {
//means this is a new install or the settings have been corrupted, prompt them!
mHandler.post(mDisplayPrompt);
//This return statement had to be commented out bcos it will not
//allow the initialisation of the buttons below.
//return;
=======
// load settings
if (UshahidiService.domain.length() == 0) {
UshahidiService.loadSettings(this);
}
// check if domain has been set
if (UshahidiService.domain.length() == 0) {
// means this is a new install or the settings have been corrupted,
// prompt them!
mHandler.post(mDisplayPrompt);
// This return statement had to be commented out bcos it will not
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
// allow the initialisation of the buttons below.
listBtn = (Button)findViewById(R.id.incident_list); |
| Solution content |
|---|
setContentView(R.layout.main);
mHandler = new Handler();
bundle = new Bundle();
// load settings
if (UshahidiPref.domain.length() == 0) {
UshahidiPref.loadSettings(this);
}
// check if domain has been set
if (UshahidiPref.domain.length() == 0) {
// means this is a new install or the settings have been corrupted,
// prompt them!
mHandler.post(mDisplayPrompt);
// This return statement had to be commented out bcos it will not
// allow the initialisation of the buttons below.
// return;
}
listBtn = (Button)findViewById(R.id.incident_list); |
| File |
|---|
| Ushahidi.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
public static String username = "";
public static String password = "";
import android.util.Log;
public class UshahidiService extends Service {
<<<<<<< HEAD
private static final String TAG = "Ushahidi - New Updates";
=======
public static boolean httpRunning = false;
public static boolean AutoFetch = false;
public static boolean smsUpdate = false;
public static boolean vibrate = false;
public static boolean ringtone = false;
public static boolean flashLed = false;
public static int countries = 0;
public static int AutoUpdateDelay = 0;
public static final int NOTIFICATION_ID = 1;
public static final String PREFS_NAME = "UshahidiService";
public static String incidentsResponse = "";
public static String categoriesResponse = "";
public static String savePath = "";
public static String domain = "";
public static String firstname = "";
public static String lastname = "";
public static String email = "";
public static String totalReports = "";
public static String fileName = "";
public static String total_reports = "";
private static final String TAG = "Ushahidi - New Updates";
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
public static final String NEW_USHAHIDI_REPORT_FOUND = "New_Ushahidi_Report_Found";
public static Vector |
| Solution content |
|---|
import android.util.Log;
public class UshahidiService extends Service {
private static final String TAG = "Ushahidi - New Updates";
public static boolean httpRunning = false;
public static boolean AutoFetch = false;
public static boolean smsUpdate = false;
public static boolean vibrate = false;
public static boolean ringtone = false;
public static boolean flashLed = false;
public static int countries = 0;
public static int AutoUpdateDelay = 0;
public static final int NOTIFICATION_ID = 1;
public static final String PREFS_NAME = "UshahidiService";
public static String incidentsResponse = "";
public static String categoriesResponse = "";
public static String savePath = "";
public static String domain = "";
public static String firstname = "";
public static String lastname = "";
public static String email = "";
public static String totalReports = "";
public static String fileName = "";
public static String total_reports = "";
public static String username = "";
public static String password = "";
public static final String NEW_USHAHIDI_REPORT_FOUND = "New_Ushahidi_Report_Found";
public static Vector |
| File |
|---|
| UshahidiService.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Attribute |
| Chunk |
|---|
| Conflicting content |
|---|
@Override
}
}
<<<<<<< HEAD
private Runnable mUpdateTimeTask = new Runnable() {
public void run() {
UshahidiPref.saveSettings(getApplicationContext());
Util.fetchReports(UshahidiService.this);
showNotification(UshahidiPref.total_reports);
mHandler.postAtTime(mUpdateTimeTask, SystemClock.uptimeMillis() + (
1000 * 60 * UshahidiPref.AutoUpdateDelay));
}
};
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
private final IBinder mBinder = new LocalBinder();
@Override
public void onCreate() {
super.onCreate();
queue = new QueueThread("ushahidi");
mHandler = new Handler();
UshahidiPref.loadSettings(UshahidiService.this);
if(UshahidiPref.AutoFetch){
Log.i("Service ","Service is checked to start.");
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mHandler.postDelayed(mUpdateTimeTask, (1000 * 60 * UshahidiPref.AutoUpdateDelay));
} else {
Log.i("Service ","Service is unchecked.");
}
final Thread tr = new Thread() {
@Override
public void run() {
while(true){
queue.GetQueueItem().start();
}
}
};
tr.start();
}
public void onDestroy() {
super.onDestroy();
mNotificationManager.cancel(UshahidiPref.NOTIFICATION_ID);
// Tell the user we stopped.
stopService(new Intent(UshahidiService.this, UshahidiService.class));
}
public static void AddThreadToQueue(Thread tr){
// if( tr != null)
//queue.AddQueueItem(tr);
}
private void showNotification(String tickerText) {
=======
private Runnable mUpdateTimeTask = new Runnable() {
public void run() {
UshahidiService.saveSettings(getApplicationContext());
Util.fetchReports(UshahidiService.this);
showNotification(total_reports);
mHandler.postAtTime(mUpdateTimeTask, SystemClock.uptimeMillis()
+ (1000 * 60 * AutoUpdateDelay));
}
};
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
private final IBinder mBinder = new LocalBinder();
@Override
public void onCreate() {
super.onCreate();
queue = new QueueThread("ushahidi");
mHandler = new Handler();
loadSettings(UshahidiService.this);
if (AutoFetch) {
Log.i("Service ", "Service is checked to start.");
mNotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
mHandler.postDelayed(mUpdateTimeTask, (1000 * 60 * AutoUpdateDelay));
} else {
Log.i("Service ", "Service is unchecked.");
}
final Thread tr = new Thread() {
@Override
public void run() {
while (true) {
queue.GetQueueItem().start();
}
}
};
tr.start();
}
@Override
public void onDestroy() {
super.onDestroy();
mNotificationManager.cancel(NOTIFICATION_ID);
// Tell the user we stopped.
stopService(new Intent(UshahidiService.this, UshahidiService.class));
}
public static void AddThreadToQueue(Thread tr) {
// if( tr != null)
// queue.AddQueueItem(tr);
}
private void showNotification(String tickerText) {
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
// This is what should be launched if the user selects our notification.
Intent baseIntent = new Intent(this, IncidentsTab.class);
baseIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| Solution content |
|---|
@Override
@Override
}
}
private Runnable mUpdateTimeTask = new Runnable() {
public void run() {
UshahidiPref.saveSettings(getApplicationContext());
Util.fetchReports(UshahidiService.this);
showNotification(UshahidiPref.total_reports);
mHandler.postAtTime(mUpdateTimeTask, SystemClock.uptimeMillis()
+ (1000 * 60 * UshahidiPref.AutoUpdateDelay));
}
};
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
private final IBinder mBinder = new LocalBinder();
public void onCreate() {
super.onCreate();
queue = new QueueThread("ushahidi");
mHandler = new Handler();
UshahidiPref.loadSettings(UshahidiService.this);
if (UshahidiPref.AutoFetch) {
Log.i("Service ", "Service is checked to start.");
mNotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
mHandler.postDelayed(mUpdateTimeTask, (1000 * 60 * UshahidiPref.AutoUpdateDelay));
} else {
Log.i("Service ", "Service is unchecked.");
}
final Thread tr = new Thread() {
@Override
public void run() {
while (true) {
queue.GetQueueItem().start();
}
}
};
tr.start();
}
public void onDestroy() {
super.onDestroy();
mNotificationManager.cancel(UshahidiPref.NOTIFICATION_ID);
// Tell the user we stopped.
stopService(new Intent(UshahidiService.this, UshahidiService.class));
}
public static void AddThreadToQueue(Thread tr) {
// if( tr != null)
// queue.AddQueueItem(tr);
}
private void showNotification(String tickerText) {
// This is what should be launched if the user selects our notification.
Intent baseIntent = new Intent(this, IncidentsTab.class);
baseIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| File |
|---|
| UshahidiService.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Method declaration |
| Method invocation |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
}
itemcount--;
newUshahidiReportNotification.flags = Notification.FLAG_AUTO_CANCEL;
newUshahidiReportNotification.defaults = Notification.DEFAULT_ALL;
newUshahidiReportNotification.setLatestEventInfo(this, TAG, tickerText, contentIntent);
<<<<<<< HEAD
if( UshahidiPref.ringtone ){
//set the ringer
Uri ringURI = Uri.fromFile(new File("/system/media/audio/ringtones/ringer.mp3"));
newUshahidiReportNotification.sound = ringURI;
}
if( UshahidiPref.vibrate ){
double vibrateLength = 100*Math.exp(0.53*20);
long[] vibrate = new long[] {100, 100, (long)vibrateLength };
newUshahidiReportNotification.vibrate = vibrate;
if( UshahidiPref.flashLed ){
int color = Color.BLUE;
// Send it back
return item;
newUshahidiReportNotification.ledARGB = color;
}
newUshahidiReportNotification.ledOffMS = (int)vibrateLength;
newUshahidiReportNotification.ledOnMS = (int)vibrateLength;
newUshahidiReportNotification.flags = newUshahidiReportNotification.flags | Notification.FLAG_SHOW_LIGHTS;
}
mNotificationManager.notify(UshahidiPref.NOTIFICATION_ID, newUshahidiReportNotification);
}
/**
* Clear stored data
*/
public boolean clearCache() {
return getDb().clearData();
}
public class QueueThread {
protected Vector |
| Solution content |
|---|
// Get an item from the vector. Wait if no items available
public synchronized Thread GetQueueItem() {
Thread item = null;
newUshahidiReportNotification.flags = Notification.FLAG_AUTO_CANCEL;
newUshahidiReportNotification.defaults = Notification.DEFAULT_ALL;
newUshahidiReportNotification.setLatestEventInfo(this, TAG, tickerText, contentIntent);
if (UshahidiPref.ringtone) {
// set the ringer
Uri ringURI = Uri.fromFile(new File("/system/media/audio/ringtones/ringer.mp3"));
newUshahidiReportNotification.sound = ringURI;
}
if (UshahidiPref.vibrate) {
double vibrateLength = 100 * Math.exp(0.53 * 20);
long[] vibrate = new long[] {
100, 100, (long)vibrateLength
};
newUshahidiReportNotification.vibrate = vibrate;
if (UshahidiPref.flashLed) {
int color = Color.BLUE;
newUshahidiReportNotification.ledARGB = color;
}
newUshahidiReportNotification.ledOffMS = (int)vibrateLength;
newUshahidiReportNotification.ledOnMS = (int)vibrateLength;
newUshahidiReportNotification.flags = newUshahidiReportNotification.flags
| Notification.FLAG_SHOW_LIGHTS;
}
mNotificationManager.notify(UshahidiPref.NOTIFICATION_ID, newUshahidiReportNotification);
}
/**
* Clear stored data
*/
public boolean clearCache() {
return getDb().clearData();
}
public class QueueThread {
protected Vector |
| File |
|---|
| UshahidiService.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Class declaration |
| Comment |
| If statement |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
/**
} else {
* @param second
return "";
}
* @return
*/
/**
* @param value
* @return
*/
}
return formatted;
public class Util {
<<<<<<< HEAD
public class Util{
private static NetworkInfo networkInfo;
private static List |
| Solution content |
|---|
}
/**
if (networkInfo == null || !networkInfo.isConnected()) {
return false;
}
return true;
if (Categories.getAllCategoriesFromWeb()) {
public class Util {
private static NetworkInfo networkInfo;
private static List |
| File |
|---|
| Util.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Attribute |
| Class signature |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
private Button uploadPhotoButton;
private EditText checkinMessageText;
<<<<<<< HEAD
private ImageView mCheckImgPrev;
private TextView mSelectedPhotoText;
=======
private EditText mSelectedPhoto;
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
// Photo functionality
private String mFilename = "";
|
| Solution content |
|---|
private String mFilename = "";
private Button uploadPhotoButton;
private EditText checkinMessageText;
private ImageView mCheckImgPrev;
private TextView mSelectedPhotoText;
// Photo functionality |
| File |
|---|
| CheckinActivity.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Attribute |
| Chunk |
|---|
| Conflicting content |
|---|
super.onCreate(savedInstanceState);
setContentView(R.layout.checkin);
<<<<<<< HEAD
checkinButton = (Button) findViewById(R.id.perform_checkin_button);
uploadPhotoButton = (Button) findViewById(R.id.upload_checkin_photo_button);
checkinMessageText = (EditText) findViewById(R.id.checkin_message_text);
mCheckImgPrev = (ImageView) findViewById(R.id.checkin_img_prev);
mSelectedPhotoText = (TextView) findViewById(R.id.checkin_selected_photo_label);
mSelectedPhotoText.setVisibility(View.GONE);
=======
checkinButton = (Button)findViewById(R.id.perform_checkin_button);
uploadPhotoButton = (Button)findViewById(R.id.upload_checkin_photo_button);
checkinMessageText = (EditText)findViewById(R.id.checkin_message_text);
mSelectedPhoto = (EditText)findViewById(R.id.checkin_selected_photo_text);
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
// Perform the checkin
checkinButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) { |
| Solution content |
|---|
super.onCreate(savedInstanceState);
setContentView(R.layout.checkin);
checkinButton = (Button)findViewById(R.id.perform_checkin_button);
uploadPhotoButton = (Button)findViewById(R.id.upload_checkin_photo_button);
checkinMessageText = (EditText)findViewById(R.id.checkin_message_text);
mCheckImgPrev = (ImageView)findViewById(R.id.checkin_img_prev);
mSelectedPhotoText = (TextView)findViewById(R.id.checkin_selected_photo_label);
mSelectedPhotoText.setVisibility(View.GONE);
// Perform the checkin
checkinButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) { |
| File |
|---|
| CheckinActivity.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Attribute |
| Cast expression |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
@Override
<<<<<<< HEAD
=======
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
populateMenu(menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
populateMenu(menu);
return (super.onCreateOptionsMenu(menu));
}
@Override
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// The preferences returned if the request code is what we had given |
| Solution content |
|---|
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// The preferences returned if the request code is what we had given |
| File |
|---|
| CheckinActivity.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
if (mBundle != null && !mBundle.isEmpty()) {
selectedPhoto = mBundle.getString("name");
<<<<<<< HEAD
NetworkServices.fileName = mBundle.getString("name");
mSelectedPhotoText.setVisibility(View.VISIBLE);
mCheckImgPrev.setImageDrawable(ImageManager.getImages(NetworkServices.fileName));
}
break;
case REQUEST_CODE_IMAGE:
if(resultCode != RESULT_OK){
return;
}
Uri uri = data.getData();
Bitmap b = null;
try {
b = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
} catch (FileNotFoundException e) {
break;
} catch (IOException e) {
break;
}
ByteArrayOutputStream byteArrayos = new ByteArrayOutputStream();
try {
b.compress(Bitmap.CompressFormat.JPEG, 75, byteArrayos);
byteArrayos.flush();
} catch (OutOfMemoryError e){
break;
} catch (IOException e) {
break;
}
mFilename = "android_pic_upload" + randomString() + ".jpg";
ImageManager.writeImage(byteArrayos.toByteArray(), mFilename);
UshahidiPref.fileName = mFilename;
selectedPhoto = mFilename;
break;
}
=======
NetworkServices.fileName = mBundle.getString("name");
mSelectedPhoto.setText(NetworkServices.fileName);
}
break;
case REQUEST_CODE_IMAGE:
if (resultCode != RESULT_OK) {
return;
}
Uri uri = data.getData();
Bitmap b = null;
try {
b = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
} catch (FileNotFoundException e) {
break;
} catch (IOException e) {
break;
}
ByteArrayOutputStream byteArrayos = new ByteArrayOutputStream();
try {
b.compress(Bitmap.CompressFormat.JPEG, 75, byteArrayos);
byteArrayos.flush();
} catch (OutOfMemoryError e) {
break;
} catch (IOException e) {
break;
}
mFilename = "android_pic_upload" + randomString() + ".jpg";
ImageManager.writeImage(byteArrayos.toByteArray(), mFilename);
UshahidiService.fileName = mFilename;
selectedPhoto = mFilename;
mSelectedPhoto.setText(UshahidiService.fileName);
break;
}
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
}
private static Random random = new Random(); |
| Solution content |
|---|
if (mBundle != null && !mBundle.isEmpty()) {
selectedPhoto = mBundle.getString("name");
NetworkServices.fileName = mBundle.getString("name");
mSelectedPhotoText.setVisibility(View.VISIBLE);
mCheckImgPrev
.setImageDrawable(ImageManager.getImages(NetworkServices.fileName));
}
break;
case REQUEST_CODE_IMAGE:
if (resultCode != RESULT_OK) {
return;
}
Uri uri = data.getData();
Bitmap b = null;
try {
b = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
} catch (FileNotFoundException e) {
break;
} catch (IOException e) {
break;
}
ByteArrayOutputStream byteArrayos = new ByteArrayOutputStream();
try {
b.compress(Bitmap.CompressFormat.JPEG, 75, byteArrayos);
byteArrayos.flush();
} catch (OutOfMemoryError e) {
break;
} catch (IOException e) {
break;
}
mFilename = "android_pic_upload" + randomString() + ".jpg";
ImageManager.writeImage(byteArrayos.toByteArray(), mFilename);
UshahidiPref.fileName = mFilename;
selectedPhoto = mFilename;
break;
}
}
private static Random random = new Random(); |
| File |
|---|
| CheckinActivity.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Attribute |
| Break statement |
| Case statement |
| If statement |
| Method invocation |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
// Post data online and close the progress dialog
// Initialize the settings
<<<<<<< HEAD
UshahidiPref.loadSettings(CheckinActivity.this);
String ushahidiDomain = UshahidiPref.domain;
String firstname = UshahidiPref.firstname;
String lastname = UshahidiPref.lastname;
String email = UshahidiPref.email;
NetworkServices.postToOnline(Util.IMEI(CheckinActivity.this), ushahidiDomain, checkinDetails,
LocationServices.location, selectedPhoto,firstname,lastname,email);
=======
UshahidiService.loadSettings(CheckinActivity.this);
String ushahidiDomain = UshahidiService.domain;
String firstname = UshahidiService.firstname;
String lastname = UshahidiService.lastname;
String email = UshahidiService.email;
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
NetworkServices.postToOnline(Util.IMEI(CheckinActivity.this), ushahidiDomain,
checkinDetails, LocationServices.location, selectedPhoto, firstname, lastname, |
| Solution content |
|---|
// Post data online and close the progress dialog
// Initialize the settings
UshahidiPref.loadSettings(CheckinActivity.this);
String ushahidiDomain = UshahidiPref.domain;
String firstname = UshahidiPref.firstname;
String lastname = UshahidiPref.lastname;
String email = UshahidiPref.email;
NetworkServices.postToOnline(Util.IMEI(CheckinActivity.this), ushahidiDomain,
checkinDetails, LocationServices.location, selectedPhoto, firstname, lastname,
email);
NetworkServices.postToOnline(Util.IMEI(CheckinActivity.this), ushahidiDomain,
checkinDetails, LocationServices.location, selectedPhoto, firstname, lastname, |
| File |
|---|
| CheckinActivity.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
LocationServices.getLocation(this);
}
<<<<<<< HEAD
}
=======
private void populateMenu(Menu menu) {
MenuItem i;
// Create the menu here
}
}
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146 |
| Solution content |
|---|
LocationServices.getLocation(this);
}
} |
| File |
|---|
| CheckinActivity.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
CheckinItemizedOverlay itemizedOverlay;
protected void onCreate(Bundle savedInstance) {
<<<<<<< HEAD
=======
boolean firstPoint = true;
GeoPoint centerGeoPoint = new GeoPoint(0, 0);
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
super.onCreate(savedInstance);
UshahidiPref.loadSettings(CheckinMap.this); |
| Solution content |
|---|
CheckinItemizedOverlay itemizedOverlay;
protected void onCreate(Bundle savedInstance) {
super.onCreate(savedInstance);
UshahidiPref.loadSettings(CheckinMap.this); |
| File |
|---|
| CheckinMap.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
req.setParameter("photo", new File(UshahidiPref.savePath + params.get("filename")));
=======
req.setParameter("lastname", params.get("lastname"));
req.setParameter("email", params.get("email"));
<<<<<<< HEAD
Log.i("HTTP Client:", "filename:" + UshahidiPref.savePath + params.get("filename"));
if( !TextUtils.isEmpty(params.get("filename")) || !(params.get("filename").equals("")))
Log.i("HTTP Client:", "filename:" + UshahidiService.savePath + params.get("filename"));
if (!TextUtils.isEmpty(params.get("filename")) || !(params.get("filename").equals("")))
req.setParameter("photo",
new File(UshahidiService.savePath + params.get("filename")));
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
InputStream serverInput = req.post();
|
| Solution content |
|---|
req.setParameter("lastname", params.get("lastname"));
req.setParameter("email", params.get("email"));
Log.i("HTTP Client:", "filename:" + UshahidiPref.savePath + params.get("filename"));
if( !TextUtils.isEmpty(params.get("filename")) || !(params.get("filename").equals("")))
req.setParameter("photo", new File(UshahidiPref.savePath + params.get("filename")));
InputStream serverInput = req.post();
|
| File |
|---|
| NetworkServices.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
public static String getCheckins(String URL, String mobileId, String checkinId) {
StringBuilder fullUrl = new StringBuilder(URL);
<<<<<<< HEAD
fullUrl.append("/api");
Log.i("Domain URL: ", "URL: "+fullUrl);
=======
fullUrl.append("/api");
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
try {
URL url = new URL(fullUrl.toString());
ClientHttpRequest req = new ClientHttpRequest(url); |
| Solution content |
|---|
public static String getCheckins(String URL, String mobileId, String checkinId) {
StringBuilder fullUrl = new StringBuilder(URL);
fullUrl.append("/api");
Log.i("Domain URL: ", "URL: "+fullUrl);
try {
URL url = new URL(fullUrl.toString());
ClientHttpRequest req = new ClientHttpRequest(url); |
| File |
|---|
| NetworkServices.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
import android.util.Log;
public class UshahidiDatabase {
<<<<<<< HEAD
private static final String TAG = "UshahidiDatabase";
public static final String INCIDENT_ID = "_id";
public static final String INCIDENT_TITLE = "incident_title";
public static final String INCIDENT_DESC = "incident_desc";
public static final String INCIDENT_DATE = "incident_date";
public static final String INCIDENT_MODE = "incident_mode";
public static final String INCIDENT_VERIFIED = "incident_verified";
public static final String INCIDENT_LOC_NAME = "incident_loc_name";
public static final String INCIDENT_LOC_LATITUDE = "incident_loc_latitude";
public static final String INCIDENT_LOC_LONGITUDE = "incident_loc_longitude";
public static final String INCIDENT_CATEGORIES = "incident_categories";
public static final String INCIDENT_MEDIA = "incident_media";
public static final String INCIDENT_IMAGE = "incident_image";
public static final String INCIDENT_IS_UNREAD = "is_unread";
public static final String CATEGORY_ID = "_id";
public static final String CATEGORY_TITLE = "category_title";
public static final String CATEGORY_DESC = "category_desc";
public static final String CATEGORY_COLOR = "category_color";
public static final String CATEGORY_IS_UNREAD = "is_unread";
/**
public static final String ADD_INCIDENT_ID = "_id";
public static final String ADD_INCIDENT_TITLE = "incident_title";
@Override
+ CATEGORY_DESC + " TEXT, "
public static final String ADD_INCIDENT_DESC = "incident_desc";
public static final String ADD_INCIDENT_DATE = "incident_date";
public static final String ADD_INCIDENT_HOUR = "incident_hour";
public static final String ADD_INCIDENT_MINUTE = "incident_minute";
public static final String ADD_INCIDENT_AMPM = "incident_ampm";
public static final String ADD_INCIDENT_CATEGORIES = "incident_categories";
public static final String ADD_INCIDENT_LOC_NAME = "incident_loc_name";
public static final String ADD_INCIDENT_LOC_LATITUDE = "incident_loc_latitude";
public static final String ADD_INCIDENT_LOC_LONGITUDE = "incident_loc_longitude";
public static final String ADD_INCIDENT_PHOTO = "incident_photo";
public static final String ADD_INCIDENT_VIDEO = "incident_video";
public static final String ADD_INCIDENT_NEWS = "incident_news";
public static final String ADD_PERSON_FIRST = "person_first";
public static final String ADD_PERSON_LAST = "person_last";
public static final String ADD_PERSON_EMAIL = "person_email";
public static final String[] INCIDENTS_COLUMNS = new String[] { INCIDENT_ID,
INCIDENT_TITLE, INCIDENT_DESC, INCIDENT_DATE, INCIDENT_MODE, INCIDENT_VERIFIED,
INCIDENT_LOC_NAME,INCIDENT_LOC_LATITUDE,INCIDENT_LOC_LONGITUDE,INCIDENT_CATEGORIES,
INCIDENT_MEDIA,INCIDENT_IMAGE, INCIDENT_IS_UNREAD
};
public static final String[] CATEGORIES_COLUMNS = new String[] { CATEGORY_ID,
CATEGORY_TITLE,CATEGORY_DESC,CATEGORY_COLOR, CATEGORY_IS_UNREAD
};
public static final String[] ADD_INCIDENTS_COLUMNS = new String[] {
ADD_INCIDENT_ID,
ADD_INCIDENT_TITLE, ADD_INCIDENT_DESC, ADD_INCIDENT_DATE, ADD_INCIDENT_HOUR, ADD_INCIDENT_MINUTE,
ADD_INCIDENT_AMPM,ADD_INCIDENT_CATEGORIES,INCIDENT_LOC_NAME,INCIDENT_LOC_LATITUDE,INCIDENT_LOC_LONGITUDE,
ADD_INCIDENT_PHOTO,ADD_INCIDENT_VIDEO,ADD_INCIDENT_NEWS,ADD_PERSON_FIRST,ADD_PERSON_LAST,ADD_PERSON_EMAIL
};
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_NAME = "ushahidi_db";
private static final String INCIDENTS_TABLE = "incidents";
private static final String ADD_INCIDENTS_TABLE = "add_incidents";
private static final String CATEGORIES_TABLE = "categories";
private static final int DATABASE_VERSION = 10;
// NOTE: the incident ID is used as the row ID.
// Furthermore, if a row already exists, an insert will replace
// the old row upon conflict.
private static final String INCIDENTS_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS " + INCIDENTS_TABLE + " ("
+ INCIDENT_ID + " INTEGER PRIMARY KEY ON CONFLICT REPLACE, "
+ INCIDENT_TITLE + " TEXT NOT NULL, "
+ INCIDENT_DESC + " TEXT, "
+ INCIDENT_DATE + " DATE NOT NULL, "
+ INCIDENT_MODE + " INTEGER, "
+ INCIDENT_VERIFIED + " INTEGER, "
+ INCIDENT_LOC_NAME + " TEXT NOT NULL, "
+ INCIDENT_LOC_LATITUDE + " TEXT NOT NULL, "
+ INCIDENT_LOC_LONGITUDE + " TEXT NOT NULL, "
+ INCIDENT_CATEGORIES + " TEXT NOT NULL, "
+ INCIDENT_MEDIA + " TEXT, "
+ INCIDENT_IMAGE + " TEXT, "
+ INCIDENT_IS_UNREAD + " BOOLEAN NOT NULL "
+ ")";
private static final String ADD_INCIDENTS_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS " + ADD_INCIDENTS_TABLE + " ("
+ ADD_INCIDENT_ID + " INTEGER PRIMARY KEY , "
+ ADD_INCIDENT_TITLE + " TEXT NOT NULL, "
+ ADD_INCIDENT_DESC + " TEXT, "
+ INCIDENT_DATE + " DATE NOT NULL, "
+ ADD_INCIDENT_HOUR + " INTEGER, "
+ ADD_INCIDENT_MINUTE + " INTEGER, "
+ ADD_INCIDENT_AMPM + " TEXT NOT NULL, "
+ ADD_INCIDENT_CATEGORIES + " TEXT NOT NULL, "
+ ADD_INCIDENT_LOC_NAME + " TEXT NOT NULL, "
+ ADD_INCIDENT_LOC_LATITUDE + " TEXT NOT NULL, "
+ ADD_INCIDENT_LOC_LONGITUDE + " TEXT NOT NULL, "
+ ADD_INCIDENT_PHOTO + " TEXT, "
+ ADD_INCIDENT_VIDEO + " TEXT, "
+ ADD_INCIDENT_NEWS + " TEXT, "
+ ADD_PERSON_FIRST + " TEXT, "
+ ADD_PERSON_LAST + " TEXT, "
+ ADD_PERSON_EMAIL + " TEXT "
+ ")";
private static final String CATEGORIES_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS " + CATEGORIES_TABLE + " ("
+ CATEGORY_ID + " INTEGER PRIMARY KEY ON CONFLICT REPLACE, "
+ CATEGORY_TITLE + " TEXT NOT NULL, "
db.execSQL(String.format( "INSERT INTO %s (%s) SELECT %s FROM temp_%s", CATEGORIES_TABLE, catsCols, catsCols, CATEGORIES_TABLE));
+ CATEGORY_COLOR + " TEXT, "
+ CATEGORY_IS_UNREAD + " BOOLEAN NOT NULL "
+ ")";
private final Context mContext;
private static class DatabaseHelper extends SQLiteOpenHelper {
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(INCIDENTS_TABLE_CREATE);
db.execSQL(CATEGORIES_TABLE_CREATE);
db.execSQL(ADD_INCIDENTS_TABLE_CREATE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
+ newVersion + " which destroys all old data");
List |
| Solution content |
|---|
/*
import android.util.Log;
public class UshahidiDatabase {
private static final String TAG = "UshahidiDatabase";
public static final String INCIDENT_ID = "_id";
public static final String INCIDENT_TITLE = "incident_title";
public static final String INCIDENT_DESC = "incident_desc";
public static final String INCIDENT_DATE = "incident_date";
public static final String INCIDENT_MODE = "incident_mode";
public static final String INCIDENT_VERIFIED = "incident_verified";
public static final String INCIDENT_LOC_NAME = "incident_loc_name";
public static final String INCIDENT_LOC_LATITUDE = "incident_loc_latitude";
public static final String INCIDENT_LOC_LONGITUDE = "incident_loc_longitude";
public static final String INCIDENT_CATEGORIES = "incident_categories";
public static final String INCIDENT_MEDIA = "incident_media";
public static final String INCIDENT_IMAGE = "incident_image";
public static final String INCIDENT_IS_UNREAD = "is_unread";
public static final String CATEGORY_ID = "_id";
public static final String CATEGORY_TITLE = "category_title";
public static final String CATEGORY_DESC = "category_desc";
public static final String CATEGORY_COLOR = "category_color";
public static final String CATEGORY_IS_UNREAD = "is_unread";
public static final String ADD_INCIDENT_ID = "_id";
public static final String ADD_INCIDENT_TITLE = "incident_title";
public static final String ADD_INCIDENT_DESC = "incident_desc";
public static final String ADD_INCIDENT_DATE = "incident_date";
public static final String ADD_INCIDENT_HOUR = "incident_hour";
public static final String ADD_INCIDENT_MINUTE = "incident_minute";
public static final String ADD_INCIDENT_AMPM = "incident_ampm";
public static final String ADD_INCIDENT_CATEGORIES = "incident_categories";
public static final String ADD_INCIDENT_LOC_NAME = "incident_loc_name";
public static final String ADD_INCIDENT_LOC_LATITUDE = "incident_loc_latitude";
public static final String ADD_INCIDENT_LOC_LONGITUDE = "incident_loc_longitude";
public static final String ADD_INCIDENT_PHOTO = "incident_photo";
public static final String ADD_INCIDENT_VIDEO = "incident_video";
public static final String ADD_INCIDENT_NEWS = "incident_news";
public static final String ADD_PERSON_FIRST = "person_first";
public static final String ADD_PERSON_LAST = "person_last";
public static final String ADD_PERSON_EMAIL = "person_email";
public static final String[] INCIDENTS_COLUMNS = new String[] {
INCIDENT_ID, INCIDENT_TITLE, INCIDENT_DESC, INCIDENT_DATE, INCIDENT_MODE,
INCIDENT_VERIFIED, INCIDENT_LOC_NAME, INCIDENT_LOC_LATITUDE, INCIDENT_LOC_LONGITUDE,
INCIDENT_CATEGORIES, INCIDENT_MEDIA, INCIDENT_IMAGE, INCIDENT_IS_UNREAD
};
db.execSQL(INCIDENTS_TABLE_CREATE);
return result;
}
public static final String[] CATEGORIES_COLUMNS = new String[] {
CATEGORY_ID, CATEGORY_TITLE, CATEGORY_DESC, CATEGORY_COLOR, CATEGORY_IS_UNREAD
};
public static final String[] ADD_INCIDENTS_COLUMNS = new String[] {
ADD_INCIDENT_ID, ADD_INCIDENT_TITLE, ADD_INCIDENT_DESC, ADD_INCIDENT_DATE,
ADD_INCIDENT_HOUR, ADD_INCIDENT_MINUTE, ADD_INCIDENT_AMPM, ADD_INCIDENT_CATEGORIES,
INCIDENT_LOC_NAME, INCIDENT_LOC_LATITUDE, INCIDENT_LOC_LONGITUDE, ADD_INCIDENT_PHOTO,
ADD_INCIDENT_VIDEO, ADD_INCIDENT_NEWS, ADD_PERSON_FIRST, ADD_PERSON_LAST,
ADD_PERSON_EMAIL
};
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_NAME = "ushahidi_db";
private static final String INCIDENTS_TABLE = "incidents";
private static final String ADD_INCIDENTS_TABLE = "add_incidents";
private static final String CATEGORIES_TABLE = "categories";
private static final int DATABASE_VERSION = 10;
// NOTE: the incident ID is used as the row ID.
// Furthermore, if a row already exists, an insert will replace
// the old row upon conflict.
private static final String INCIDENTS_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS "
+ INCIDENTS_TABLE + " (" + INCIDENT_ID + " INTEGER PRIMARY KEY ON CONFLICT REPLACE, "
+ INCIDENT_TITLE + " TEXT NOT NULL, " + INCIDENT_DESC + " TEXT, " + INCIDENT_DATE
+ " DATE NOT NULL, " + INCIDENT_MODE + " INTEGER, " + INCIDENT_VERIFIED + " INTEGER, "
+ INCIDENT_LOC_NAME + " TEXT NOT NULL, " + INCIDENT_LOC_LATITUDE + " TEXT NOT NULL, "
+ INCIDENT_LOC_LONGITUDE + " TEXT NOT NULL, " + INCIDENT_CATEGORIES
+ " TEXT NOT NULL, " + INCIDENT_MEDIA + " TEXT, " + INCIDENT_IMAGE + " TEXT, "
+ INCIDENT_IS_UNREAD + " BOOLEAN NOT NULL " + ")";
private static final String ADD_INCIDENTS_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS "
+ ADD_INCIDENTS_TABLE + " (" + ADD_INCIDENT_ID + " INTEGER PRIMARY KEY , "
+ ADD_INCIDENT_TITLE + " TEXT NOT NULL, " + ADD_INCIDENT_DESC + " TEXT, "
+ INCIDENT_DATE + " DATE NOT NULL, " + ADD_INCIDENT_HOUR + " INTEGER, "
+ ADD_INCIDENT_MINUTE + " INTEGER, " + ADD_INCIDENT_AMPM + " TEXT NOT NULL, "
+ ADD_INCIDENT_CATEGORIES + " TEXT NOT NULL, " + ADD_INCIDENT_LOC_NAME
+ " TEXT NOT NULL, " + ADD_INCIDENT_LOC_LATITUDE + " TEXT NOT NULL, "
+ ADD_INCIDENT_LOC_LONGITUDE + " TEXT NOT NULL, " + ADD_INCIDENT_PHOTO + " TEXT, "
+ ADD_INCIDENT_VIDEO + " TEXT, " + ADD_INCIDENT_NEWS + " TEXT, " + ADD_PERSON_FIRST
+ " TEXT, " + ADD_PERSON_LAST + " TEXT, " + ADD_PERSON_EMAIL + " TEXT " + ")";
private static final String CATEGORIES_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS "
+ CATEGORIES_TABLE + " (" + CATEGORY_ID + " INTEGER PRIMARY KEY ON CONFLICT REPLACE, "
+ CATEGORY_TITLE + " TEXT NOT NULL, " + CATEGORY_DESC + " TEXT, " + CATEGORY_COLOR
+ " TEXT, " + CATEGORY_IS_UNREAD + " BOOLEAN NOT NULL " + ")";
private final Context mContext;
private static class DatabaseHelper extends SQLiteOpenHelper {
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(INCIDENTS_TABLE_CREATE);
db.execSQL(CATEGORIES_TABLE_CREATE);
db.execSQL(ADD_INCIDENTS_TABLE_CREATE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion
+ " which destroys all old data");
List |
| File |
|---|
| UshahidiDatabase.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Attribute |
| Class declaration |
| Comment |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
return true;
} else {
import com.ushahidi.android.app.UshahidiPref;
public class Categories {
<<<<<<< HEAD
public static boolean getAllCategoriesFromWeb() throws IOException {
HttpResponse response;
String categories = "";
StringBuilder uriBuilder = new StringBuilder( UshahidiPref.domain);
uriBuilder.append("/api?task=categories");
uriBuilder.append("&resp=xml");
response = UshahidiHttpClient.GetURL( uriBuilder.toString() );
if( response == null ) {
return false;
}
final int statusCode = response.getStatusLine().getStatusCode();
if( statusCode == 200 ) {
categories = UshahidiHttpClient.GetText(response);
UshahidiPref.categoriesResponse = categories;
return true;
} else {
return false;
}
}
=======
public static boolean getAllCategoriesFromWeb() throws IOException {
HttpResponse response;
String categories = "";
StringBuilder uriBuilder = new StringBuilder(UshahidiService.domain);
uriBuilder.append("/api?task=categories");
uriBuilder.append("&resp=xml");
response = UshahidiHttpClient.GetURL(uriBuilder.toString());
if (response == null) {
return false;
}
final int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == 200) {
categories = UshahidiHttpClient.GetText(response);
UshahidiService.categoriesResponse = categories;
return false;
}
}
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
} |
| Solution content |
|---|
import com.ushahidi.android.app.UshahidiPref;
public class Categories {
public static boolean getAllCategoriesFromWeb() throws IOException {
HttpResponse response;
String categories = "";
StringBuilder uriBuilder = new StringBuilder( UshahidiPref.domain);
uriBuilder.append("/api?task=categories");
uriBuilder.append("&resp=xml");
response = UshahidiHttpClient.GetURL( uriBuilder.toString() );
if( response == null ) {
return false;
}
final int statusCode = response.getStatusLine().getStatusCode();
if( statusCode == 200 ) {
categories = UshahidiHttpClient.GetText(response);
UshahidiPref.categoriesResponse = categories;
return true;
} else {
return false;
}
}
} |
| File |
|---|
| Categories.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
uriBuilder.append("&limit=" + UshahidiService.totalReports);
import com.ushahidi.android.app.UshahidiPref;
public class Incidents {
<<<<<<< HEAD
public static boolean getAllIncidentsFromWeb() throws IOException {
HttpResponse response;
String incidents = "";
StringBuilder uriBuilder = new StringBuilder( UshahidiPref.domain );
uriBuilder.append("/api?task=incidents");
uriBuilder.append("&by=all");
uriBuilder.append("&limit="+UshahidiPref.totalReports);
uriBuilder.append("&resp=xml");
response = UshahidiHttpClient.GetURL( uriBuilder.toString());
if( response == null ) {
return false;
}
final int statusCode = response.getStatusLine().getStatusCode();
if( statusCode == 200 ) {
incidents = UshahidiHttpClient.GetText(response);
UshahidiPref.incidentsResponse = incidents;
return true;
} else {
return false;
}
}
=======
public static boolean getAllIncidentsFromWeb() throws IOException {
HttpResponse response;
String incidents = "";
StringBuilder uriBuilder = new StringBuilder(UshahidiService.domain);
uriBuilder.append("/api?task=incidents");
uriBuilder.append("&by=all");
uriBuilder.append("&resp=xml");
response = UshahidiHttpClient.GetURL(uriBuilder.toString());
if (response == null) {
return false;
}
final int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == 200) {
incidents = UshahidiHttpClient.GetText(response);
UshahidiService.incidentsResponse = incidents;
return true;
} else {
return false;
}
}
>>>>>>> 03d4f8b9be578340f7b439172bec824e9e111146
} |
| Solution content |
|---|
import com.ushahidi.android.app.UshahidiPref;
public class Incidents {
public static boolean getAllIncidentsFromWeb() throws IOException {
HttpResponse response;
String incidents = "";
StringBuilder uriBuilder = new StringBuilder(UshahidiPref.domain);
uriBuilder.append("/api?task=incidents");
uriBuilder.append("&by=all");
uriBuilder.append("&limit=" + UshahidiPref.totalReports);
uriBuilder.append("&resp=xml");
response = UshahidiHttpClient.GetURL(uriBuilder.toString());
if (response == null) {
return false;
}
final int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == 200) {
incidents = UshahidiHttpClient.GetText(response);
UshahidiPref.incidentsResponse = incidents;
return true;
} else {
return false;
}
}
} |
| File |
|---|
| Incidents.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
httpost.addHeader("Referer", Referer);
final public static List |
| Solution content |
|---|
}
throws IOException {
final public static List |
| File |
|---|
| UshahidiHttpClient.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Return statement |
| Try statement |
| Variable |