| Chunk |
|---|
| Conflicting content |
|---|
import android.content.Intent; import android.content.res.Configuration; import android.database.Cursor; <<<<<<< HEAD import android.database.SQLException; ======= >>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15 import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; |
| Solution content |
|---|
import android.content.Intent; import android.content.res.Configuration; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
import android.os.Environment; import android.os.Handler; import android.os.Vibrator; <<<<<<< HEAD import android.preference.PreferenceManager; ======= >>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15 import android.provider.MediaStore; import android.provider.MediaStore.Images.Media; import android.util.Log; |
| Solution content |
|---|
import android.os.Environment; import android.os.Handler; import android.os.Vibrator; import android.provider.MediaStore; import android.provider.MediaStore.Images.Media; import android.util.Log; |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
// Instantiate the vibrator
vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
<<<<<<< HEAD
if (imageUri != null) {
=======
// Load the image if it isn't null
if (originalImageUri != null) {
// Load up smaller image
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
try {
// Load up the image's dimensions not the image itself
BitmapFactory.Options bmpFactoryOptions = new BitmapFactory.Options(); |
| Solution content |
|---|
try {
if (originalImageUri != null) {
// Instantiate the vibrator
vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
// Load the image if it isn't null
// Load up smaller image
// Load up the image's dimensions not the image itself
BitmapFactory.Options bmpFactoryOptions = new BitmapFactory.Options(); |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
int fudge = 42;
matrix.postScale(matrixScale, matrixScale);
// This doesn't completely center the image but it get's closer
if (imageBitmap == null) {
Log.v(LOGTAG,"bmp is null");
}
<<<<<<< HEAD
float matrixScale = 1;
matrix.setScale(matrixScale, matrixScale);
imageView.setImageBitmap(createObscuredBitmap());
imageView.setImageMatrix(matrix);
overlayImageView.setImageMatrix(matrix);
=======
float matrixWidthRatio = (float) currentDisplay.getWidth() / (float) imageBitmap.getWidth();
float matrixHeightRatio = (float) currentDisplay.getHeight() / (float) imageBitmap.getHeight();
// Setup the imageView and matrix for scaling
float matrixScale = matrixHeightRatio;
if (matrixWidthRatio < matrixHeightRatio) {
matrixScale = matrixWidthRatio;
}
imageView.setImageBitmap(imageBitmap);
PointF midpoint = new PointF((float)imageBitmap.getWidth()/2f, (float)imageBitmap.getHeight()/2f);
matrix.postTranslate((float)((float)currentDisplay.getWidth()-(float)imageBitmap.getWidth()*(float)matrixScale)/2f,(float)((float)currentDisplay.getHeight()-(float)imageBitmap.getHeight()*matrixScale)/2f-fudge);
imageView.setImageMatrix(matrix);
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
} catch (IOException e) {
e.printStackTrace();
} |
| Solution content |
|---|
// Setup the imageView and matrix for scaling
float matrixScale = matrixHeightRatio;
if (imageBitmap == null) {
Log.v(LOGTAG,"bmp is null");
}
float matrixWidthRatio = (float) currentDisplay.getWidth() / (float) imageBitmap.getWidth();
float matrixHeightRatio = (float) currentDisplay.getHeight() / (float) imageBitmap.getHeight();
if (matrixWidthRatio < matrixHeightRatio) {
matrixScale = matrixWidthRatio;
}
imageView.setImageBitmap(imageBitmap);
PointF midpoint = new PointF((float)imageBitmap.getWidth()/2f, (float)imageBitmap.getHeight()/2f);
matrix.postScale(matrixScale, matrixScale);
// This doesn't completely center the image but it get's closer
int fudge = 42;
matrix.postTranslate((float)((float)currentDisplay.getWidth()-(float)imageBitmap.getWidth()*(float)matrixScale)/2f,(float)((float)currentDisplay.getHeight()-(float)imageBitmap.getHeight()*matrixScale)/2f-fudge);
imageView.setImageMatrix(matrix);
} catch (IOException e) {
e.printStackTrace();
} |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Cast expression |
| Comment |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
e.printStackTrace();
}
<<<<<<< HEAD
// Call SSCMetadataHandler to make a new entry into the database
mdh = new SSCMetadataHandler(this);
try {
mdh.createDatabase();
} catch(IOException e) {}
try {
mdh.openDataBase();
} catch(SQLException e) {}
try {
// Need to make sure imageSource exists
if (imageSource.containsKey("imageSource")) {
mdh.initiateMedia(imageUri,1,imageSource.getInt("imageSource")); // which is 1 vs. 2
} else {
mdh.initiateMedia(imageUri,1,2); // which is 1 vs. 2
}
} catch (IOException e) {}
// Canvas for drawing
overlayBitmap = Bitmap.createBitmap(imageBitmap.getWidth(), imageBitmap.getHeight(), Config.ARGB_8888);
overlayCanvas = new Canvas(overlayBitmap);
overlayPaint = new Paint();
overlayImageView.setImageBitmap(overlayBitmap);
//redrawOverlay();
overlayImageView.setOnTouchListener(this);
overlayImageView.setOnLongClickListener(this); // What about normal onClick??\
// Long click doesn't give place.. :-(
=======
// Set the OnTouch and OnLongClick listeners to this (ImageEditor)
imageView.setOnTouchListener(this);
imageView.setOnLongClickListener(this);
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
// Layout for Image Regions
regionButtonsLayout = (RelativeLayout) this.findViewById(R.id.RegionButtonsLayout); |
| Solution content |
|---|
e.printStackTrace(); } // Set the OnTouch and OnLongClick listeners to this (ImageEditor) imageView.setOnTouchListener(this); imageView.setOnLongClickListener(this); // Layout for Image Regions regionButtonsLayout = (RelativeLayout) this.findViewById(R.id.RegionButtonsLayout); |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Method invocation |
| Try statement |
| Chunk |
|---|
| Conflicting content |
|---|
// Layout for Image Regions regionButtonsLayout = (RelativeLayout) this.findViewById(R.id.RegionButtonsLayout); <<<<<<< HEAD // Only want to do this if we are starting with a new image // Do popup showDialog(DIALOG_DO_AUTODETECTION); //how take care of the original! if (deleteOriginal) handleDelete(); ======= // Do auto detect popup Toast autodetectedToast = Toast.makeText(this, "Detecting faces...", Toast.LENGTH_SHORT); autodetectedToast.show(); mHandler.postDelayed(mUpdateTimeTask, 1000); >>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15 } } |
| Solution content |
|---|
// Layout for Image Regions regionButtonsLayout = (RelativeLayout) this.findViewById(R.id.RegionButtonsLayout); // Do auto detect popup Toast autodetectedToast = Toast.makeText(this, "Detecting faces...", Toast.LENGTH_SHORT); autodetectedToast.show(); mHandler.postDelayed(mUpdateTimeTask, 1000); } } |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
b.setMessage(getString(R.string.confirm_delete));
b.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
<<<<<<< HEAD
/* User clicked OK so do some stuff */
getContentResolver().delete(imageUri, null, null);
imageUri = null;
=======
// User clicked OK so go ahead and delete
deleteOriginal();
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
}
});
b.setNegativeButton(android.R.string.no, null); |
| Solution content |
|---|
b.setMessage(getString(R.string.confirm_delete));
b.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// User clicked OK so go ahead and delete
deleteOriginal();
}
});
b.setNegativeButton(android.R.string.no, null); |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
/*
b.show();
}
<<<<<<< HEAD
private void initPreferences ()
{
//OriginalImagePref
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
int defState = Integer.parseInt(prefs.getString("OriginalImagePref", "0"));
if (defState == 2)
deleteOriginal = true;
}
protected Dialog onCreateDialog(int id) {
Log.v(LOGTAG,"Within onCreateDialog" + id);
Dialog dialog = null;
switch(id) {
case DIALOG_DO_AUTODETECTION:
Log.v(LOGTAG,"Within onCreateDialog right case");
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Scan Image?");
builder.setMessage("Would you like to scan this image for faces?");
builder.setCancelable(false);
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
ImageEditor.this.doAutoDetection();
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
dialog = builder.create();
break;
default:
dialog = null;
}
return dialog;
}
=======
/*
* Actual deletion of original
*/
private void deleteOriginal() {
getContentResolver().delete(originalImageUri, null, null);
originalImageUri = null;
}
/*
* Ask user to approve auto detection
*/
private void askToDoAutoDetect() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Scan Image?");
builder.setMessage("Would you like to scan this image for faces?");
builder.setCancelable(false);
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
ImageEditor.this.doAutoDetection();
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
builder.show();
}
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
* Do actual auto detection and create regions
* |
| Solution content |
|---|
b.show();
}
/*
* Actual deletion of original
*/
private void deleteOriginal() {
getContentResolver().delete(originalImageUri, null, null);
originalImageUri = null;
}
/*
* Ask user to approve auto detection
*/
private void askToDoAutoDetect() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Scan Image?");
builder.setMessage("Would you like to scan this image for faces?");
builder.setCancelable(false);
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
ImageEditor.this.doAutoDetection();
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
builder.show();
}
/*
* Do actual auto detection and create regions
* |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
/*
* Do actual auto detection and create regions
*
<<<<<<< HEAD
* Also now included: callbacks from IdTagger and EncryptTagger classes.
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Apg.ENCRYPT_MESSAGE
|| requestCode == Apg.SELECT_PUBLIC_KEYS
|| requestCode == Apg.SELECT_SECRET_KEY) {
Apg apg = Apg.getInstance();
apg.onActivityResult(this, requestCode, resultCode, data);
String encryptedData = apg.getEncryptedData();
} else if(requestCode == RESULT_ID_TAGGER) {
if(resultCode == Activity.RESULT_OK) {
String ir = data.getStringExtra("imageRegion");
// loop through image regions to find the matching image region, and set its subject
// is this sloppy? i don't know!!! other suggestions welcome :)
for(ImageRegion m : imageRegions) {
if(ir.compareTo(m.toString()) == 0) {
m.addSubjectId(data.getStringExtra("addedSubject"), Integer.parseInt(data.getStringExtra("subjectConsent")));
}
}
mdh.registerSubject(data.getStringExtra("addedSubject"),
Integer.parseInt(data.getStringExtra("subjectConsent")),
null, mdh.getImageRegionResource(),ir);
}
} else if(requestCode == RESULT_ENCRYPT_TAGGER) {
if(resultCode == Activity.RESULT_OK) {
String ir = data.getStringExtra("imageRegion");
for(ImageRegion m : imageRegions) {
if(ir.compareTo(m.toString()) == 0) {
m.addEncryptedKey(data.getStringArrayListExtra("addedKeys"));
}
}
mdh.registerKeys(data.getStringArrayListExtra("addedKeys"),mdh.getImageRegionResource(),ir);
}
}
}
private void doAutoDetection() {
// This should be called via a pop-up/alert mechanism
Rect[] autodetectedRects = runFaceDetection();
=======
* public void createImageRegion(int _scaledStartX, int _scaledStartY,
int _scaledEndX, int _scaledEndY,
int _scaledImageWidth, int _scaledImageHeight,
int _imageWidth, int _imageHeight,
int _backgroundColor) {
*/
private void doAutoDetection() {
// This should be called via a pop-up/alert mechanism
RectF[] autodetectedRects = runFaceDetection();
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
for (int adr = 0; adr < autodetectedRects.length; adr++) {
Log.v(LOGTAG,"AUTODETECTED imageView Width, Height: " + imageView.getWidth() + " " + imageView.getHeight()); |
| Solution content |
|---|
*/
/*
* Do actual auto detection and create regions
*
* public void createImageRegion(int _scaledStartX, int _scaledStartY,
int _scaledEndX, int _scaledEndY,
int _scaledImageWidth, int _scaledImageHeight,
int _imageWidth, int _imageHeight,
int _backgroundColor) {
private void doAutoDetection() {
// This should be called via a pop-up/alert mechanism
RectF[] autodetectedRects = runFaceDetection();
for (int adr = 0; adr < autodetectedRects.length; adr++) {
Log.v(LOGTAG,"AUTODETECTED imageView Width, Height: " + imageView.getWidth() + " " + imageView.getHeight()); |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
originalImageHeight, DETECTED_COLOR); } <<<<<<< HEAD Toast autodetectedToast = Toast.makeText(this, "" + autodetectedRects.length + " faces deteceted", Toast.LENGTH_SHORT); autodetectedToast.show(); clearOverlay(); ======= */ Toast autodetectedToast = Toast.makeText(this, "" + autodetectedRects.length + " faces detected", Toast.LENGTH_SHORT); autodetectedToast.show(); >>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15 } /* |
| Solution content |
|---|
originalImageHeight, DETECTED_COLOR); } */ Toast autodetectedToast = Toast.makeText(this, "" + autodetectedRects.length + " faces detected", Toast.LENGTH_SHORT); autodetectedToast.show(); } /* |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
/*
<<<<<<< HEAD
private void createObscuredBmp(Rect[] obscureRects) {
// Canvas for drawing
Bitmap alteredBitmap = Bitmap.createBitmap(imageBitmap.getWidth(), imageBitmap.getHeight(), imageBitmap.getConfig());
Canvas canvas = new Canvas(alteredBitmap);
Paint paint = new Paint();
canvas.drawBitmap(imageBitmap, 0, 0, paint);
int OBSCURE_SQUARE = 0;
int OBSCURE_BLUR = 1;
int obscureMethod = OBSCURE_SQUARE;
// Using the interface
ObscureMethod om;
// Load the appropriate class/method based on obscureMethod variable/constants
if (obscureMethod == OBSCURE_BLUR) {
om = new BlurObscure(alteredBitmap);
} else {
om = new PaintSquareObscure();
}
for (int i = 0; i < obscureRects.length; i++) {
// Apply the obscure method
om.obscureRect(obscureRects[i], canvas);
}
}*/
private void sendSecureHashSMS ()
{
Date hashTime = new Date();
String hash = generateSecureHash ();
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setData(Uri.parse("sms:"));
sendIntent.putExtra("sms_body", "Obscura hash: " + hash + " (" + hashTime.toGMTString() + ")");
startActivity(sendIntent);
}
private String generateSecureHash()
{
String result = "";
// ProgressDialog progressDialog =ProgressDialog.show(this, "", "generating hash...");
try
{
InputStream is = getContentResolver().openInputStream(imageUri);
result = MediaHasher.hash(is, "SHA-1");
mdh.mediaHash(result);
} catch (Exception e) {
Log.e(LOGTAG, "error generating hash",e);
} finally {
// progressDialog.dismiss();
}
return result;
}
private Rect[] runFaceDetection() {
=======
* The actual face detection calling method
*/
private RectF[] runFaceDetection() {
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
GoogleFaceDetection gfd = new GoogleFaceDetection(imageBitmap);
int numFaces = gfd.findFaces();
Log.v(LOGTAG,"Num Faces Found: " + numFaces); |
| Solution content |
|---|
}
/*
* The actual face detection calling method
*/
private RectF[] runFaceDetection() {
GoogleFaceDetection gfd = new GoogleFaceDetection(imageBitmap);
int numFaces = gfd.findFaces();
Log.v(LOGTAG,"Num Faces Found: " + numFaces); |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method declaration |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
return possibleFaceRects;
}
<<<<<<< HEAD
public boolean onTouch(View v, MotionEvent event) {
=======
/*
* Handles touches on ImageView
*/
@Override
public boolean onTouch(View v, MotionEvent event)
{
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
boolean handled = false;
switch (event.getAction() & MotionEvent.ACTION_MASK) { |
| Solution content |
|---|
return possibleFaceRects;
}
/*
* Handles touches on ImageView
*/
@Override
public boolean onTouch(View v, MotionEvent event)
{
boolean handled = false;
switch (event.getAction() & MotionEvent.ACTION_MASK) { |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
case MotionEvent.ACTION_DOWN: // Single Finger down mode = TAP; <<<<<<< HEAD // Save the Start point. startPoint.set(event.getX(), event.getY()); break; case MotionEvent.ACTION_POINTER_DOWN: // Two Fingers ======= // Don't do realtime preview while touching screen //doRealtimePreview = false; //updateDisplayImage(); // Save the Start point. startPoint.set(event.getX(), event.getY()); clearImageRegionsEditMode(); break; case MotionEvent.ACTION_POINTER_DOWN: // Two Fingers down // Don't do realtime preview while touching screen //doRealtimePreview = false; //updateDisplayImage(); >>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15 // Get the spacing of the fingers, 2 fingers float sx = event.getX(0) - event.getX(1); float sy = event.getY(0) - event.getY(1); |
| Solution content |
|---|
case MotionEvent.ACTION_DOWN: // Single Finger down mode = TAP; // Don't do realtime preview while touching screen //doRealtimePreview = false; //updateDisplayImage(); // Save the Start point. startPoint.set(event.getX(), event.getY()); clearImageRegionsEditMode(); break; case MotionEvent.ACTION_POINTER_DOWN: // Two Fingers down // Don't do realtime preview while touching screen //doRealtimePreview = false; //updateDisplayImage(); // Get the spacing of the fingers, 2 fingers float sx = event.getX(0) - event.getX(1); float sy = event.getY(0) - event.getY(1); |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Break statement |
| Case statement |
| Comment |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
float ysum = event.getY(0) + event.getY(1);
//Log.d(LOGTAG, "Start Finger Spacing=" + startFingerSpacing);
<<<<<<< HEAD
if (startFingerSpacing > 10f) {
float xsum = event.getX(0) + event.getX(1);
startFingerSpacingMidPoint.set(xsum / 2, ysum / 2);
mode = ZOOM;
Log.d(LOGTAG, "mode=ZOOM");
}
=======
// Get the midpoint
float xsum = event.getX(0) + event.getX(1);
float ysum = event.getY(0) + event.getY(1);
startFingerSpacingMidPoint.set(xsum / 2, ysum / 2);
mode = ZOOM;
//Log.d(LOGTAG, "mode=ZOOM");
clearImageRegionsEditMode();
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
break;
case MotionEvent.ACTION_UP: |
| Solution content |
|---|
//Log.d(LOGTAG, "Start Finger Spacing=" + startFingerSpacing); // Get the midpoint float xsum = event.getX(0) + event.getX(1); float ysum = event.getY(0) + event.getY(1); startFingerSpacingMidPoint.set(xsum / 2, ysum / 2); mode = ZOOM; //Log.d(LOGTAG, "mode=ZOOM"); clearImageRegionsEditMode(); break; case MotionEvent.ACTION_UP: |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
case MotionEvent.ACTION_UP: // Single Finger Up <<<<<<< HEAD mode = NONE; Log.v(LOGTAG,"mode=NONE"); ======= // Re-enable realtime preview doRealtimePreview = true; updateDisplayImage(); mode = NONE; //Log.v(LOGTAG,"mode=NONE"); >>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15 break; case MotionEvent.ACTION_POINTER_UP: |
| Solution content |
|---|
case MotionEvent.ACTION_UP: // Single Finger Up // Re-enable realtime preview doRealtimePreview = true; updateDisplayImage(); mode = NONE; //Log.v(LOGTAG,"mode=NONE"); break; case MotionEvent.ACTION_POINTER_UP: |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
case MotionEvent.ACTION_POINTER_UP: // Multiple Finger Up <<<<<<< HEAD ======= // Re-enable realtime preview doRealtimePreview = true; updateDisplayImage(); >>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15 mode = NONE; //Log.d(LOGTAG, "mode=NONE"); break; |
| Solution content |
|---|
case MotionEvent.ACTION_POINTER_UP: // Multiple Finger Up // Re-enable realtime preview doRealtimePreview = true; updateDisplayImage(); mode = NONE; //Log.d(LOGTAG, "mode=NONE"); break; |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
break; case MotionEvent.ACTION_MOVE: <<<<<<< HEAD ======= // Calculate distance moved >>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15 float distance = (float) (Math.sqrt(Math.abs(startPoint.x - event.getX()) + Math.abs(startPoint.y - event.getY()))); //Log.v(LOGTAG,"Move Distance: " + distance); //Log.v(LOGTAG,"Min Distance: " + minMoveDistance); |
| Solution content |
|---|
break; case MotionEvent.ACTION_MOVE: // Calculate distance moved float distance = (float) (Math.sqrt(Math.abs(startPoint.x - event.getX()) + Math.abs(startPoint.y - event.getY()))); //Log.v(LOGTAG,"Move Distance: " + distance); //Log.v(LOGTAG,"Min Distance: " + minMoveDistance); |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
startFingerSpacing = (float) Math.sqrt(esx * esx + esy * esy); //Log.d(LOGTAG, "New Start Finger Spacing=" + startFingerSpacing); <<<<<<< HEAD float xsum = event.getX(0) + event.getX(1); float ysum = event.getY(0) + event.getY(1); startFingerSpacingMidPoint.set(xsum / 2, ysum / 2); ======= // Reset the midpoint float x_sum = event.getX(0) + event.getX(1); float y_sum = event.getY(0) + event.getY(1); startFingerSpacingMidPoint.set(x_sum / 2, y_sum / 2); >>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15 handled = true; } } |
| Solution content |
|---|
//Log.d(LOGTAG, "New Start Finger Spacing=" + startFingerSpacing); startFingerSpacing = (float) Math.sqrt(esx * esx + esy * esy); // Reset the midpoint float x_sum = event.getX(0) + event.getX(1); float y_sum = event.getY(0) + event.getY(1); startFingerSpacingMidPoint.set(x_sum / 2, y_sum / 2); handled = true; } } |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
return handled; // indicate event was handled
}
<<<<<<< HEAD
public void updateDisplayImage () {
imageView.setImageBitmap(createObscuredBitmap());
=======
/*
* For live previews
*/
public void updateDisplayImage()
{
if (doRealtimePreview) {
imageView.setImageBitmap(createObscuredBitmap(imageBitmap.getWidth(),imageBitmap.getHeight()));
} else {
imageView.setImageBitmap(imageBitmap);
}
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
}
/* |
| Solution content |
|---|
/*
* For live previews
*/
return handled; // indicate event was handled
}
public void updateDisplayImage()
{
if (doRealtimePreview) {
imageView.setImageBitmap(createObscuredBitmap(imageBitmap.getWidth(),imageBitmap.getHeight()));
} else {
imageView.setImageBitmap(imageBitmap);
}
}
/* |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Method invocation |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
overlayPaint.setColor(DRAW_COLOR);
}
/*
<<<<<<< HEAD
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
// Single Finger
float ysum = event.getY(0) + event.getY(1);
float xsum = event.getX(0) + event.getX(1);
// Stop current timer if running
if (touchTimerRunnable != null) {
touchTimerHandler.removeCallbacks(touchTimerRunnable);
}
// Save the Start point.
startPoint.set(event.getX(), event.getY());
// Start out as a drag unless they keep their finger down
mode = DRAG;
Log.d(LOGTAG, "mode=DRAG");
// Start timer to determine if this should be drawing mode
touchTimerRunnable = new Runnable() {
public void run() {
mode = DRAW;
// Tell the user somehow
Log.v(LOGTAG,"DRAWING DRAWING DRAWING");
}
};
touchTimerHandler = new Handler();
touchTimerHandler.postDelayed(touchTimerRunnable,1000); // Hold down for one second
break;
case MotionEvent.ACTION_POINTER_DOWN:
// Two Fingers
// Stop current timer if running
if (touchTimerRunnable != null) {
touchTimerHandler.removeCallbacks(touchTimerRunnable);
}
// Get the spacing of the fingers, 2 fingers
float sx = event.getX(0) - event.getX(1);
float sy = event.getY(0) - event.getY(1);
startFingerSpacing = (float) Math.sqrt(sx * sx + sy * sy);
Log.d(LOGTAG, "Start Finger Spacing=" + startFingerSpacing);
if (startFingerSpacing > 10f) {
startFingerSpacingMidPoint.set(xsum / 2, ysum / 2);
mode = ZOOM;
Log.d(LOGTAG, "mode=ZOOM");
}
break;
case MotionEvent.ACTION_UP:
// Single Finger Up
if (touchTimerRunnable != null) {
touchTimerHandler.removeCallbacks(touchTimerRunnable);
}
if (mode == DRAW) {
// Create Region
vibe.vibrate(50);
createImageRegion((int)startPoint.x, (int)startPoint.y, (int)event.getX(), (int)event.getY(), overlayCanvas.getWidth(), overlayCanvas.getHeight(), originalImageWidth, originalImageHeight, DRAW_COLOR);
}
mode = NONE;
Log.v(LOGTAG,"mode=NONE");
break;
case MotionEvent.ACTION_POINTER_UP:
// Multiple Finger Up
if (touchTimerRunnable != null) {
touchTimerHandler.removeCallbacks(touchTimerRunnable);
}
mode = NONE;
Log.d(LOGTAG, "mode=NONE");
break;
case MotionEvent.ACTION_MOVE:
float distance = (float) (Math.sqrt(Math.abs(startPoint.x - event.getX()) + Math.abs(startPoint.y - event.getY())));
Log.v(LOGTAG,"Move Distance: " + distance);
Log.v(LOGTAG,"Min Distance: " + minMoveDistance);
if (distance > minMoveDistance) {
if (touchTimerRunnable != null) {
touchTimerHandler.removeCallbacks(touchTimerRunnable);
}
if (mode == DRAG) {
matrix.postTranslate(event.getX() - startPoint.x, event.getY() - startPoint.y);
imageView.setImageMatrix(matrix);
overlayImageView.setImageMatrix(matrix);
// Reset the start point
startPoint.set(event.getX(), event.getY());
putOnScreen();
redrawRegions();
} else if (mode == DRAW) {
clearOverlay();
putOnScreen();
redrawRegions();
overlayPaint.setStyle(Paint.Style.STROKE);
overlayCanvas.drawRect(startPoint.x, startPoint.y, event.getX(), event.getY(), overlayPaint);
overlayImageView.invalidate();
} else if (mode == ZOOM) {
// Save the current matrix so that if zoom goes to big, we can revert
savedMatrix.set(matrix);
// Get the spacing of the fingers, 2 fingers
float ex = event.getX(0) - event.getX(1);
float ey = event.getY(0) - event.getY(1);
endFingerSpacing = (float) Math.sqrt(ex * ex + ey * ey);
Log.d(LOGTAG, "End Finger Spacing=" + endFingerSpacing);
if (endFingerSpacing > 10f) {
// Ratio of spacing.. If it was 5 and goes to 10 the image is 2x as big
float scale = endFingerSpacing / startFingerSpacing;
// Scale from the midpoint
matrix.postScale(scale, scale, startFingerSpacingMidPoint.x, startFingerSpacingMidPoint.y);
float[] matrixValues = new float[9];
matrix.getValues(matrixValues);
Log.v(LOGTAG, "Total Scale: " + matrixValues[0]);
Log.v(LOGTAG, "" + matrixValues[0] + " " + matrixValues[1]
+ " " + matrixValues[2] + " " + matrixValues[3]
+ " " + matrixValues[4] + " " + matrixValues[5]
+ " " + matrixValues[6] + " " + matrixValues[7]
+ " " + matrixValues[8]);
if (matrixValues[0] > MAX_SCALE) {
matrix.set(savedMatrix);
}
imageView.setImageMatrix(matrix);
overlayImageView.setImageMatrix(matrix);
// Reset Start Finger Spacing
float esx = event.getX(0) - event.getX(1);
float esy = event.getY(0) - event.getY(1);
startFingerSpacing = (float) Math.sqrt(esx * esx + esy * esy);
Log.d(LOGTAG, "New Start Finger Spacing=" + startFingerSpacing);
float xsum = event.getX(0) + event.getX(1);
float ysum = event.getY(0) + event.getY(1);
startFingerSpacingMidPoint.set(xsum / 2, ysum / 2);
}
}
}
break;
}
return true; // indicate event was handled
}*/
public void putOnScreen() {
=======
* Move the image onto the screen if it has been moved off
*/
public void putOnScreen()
{
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
// Get Rectangle of Tranformed Image
RectF theRect = getScaleOfImage();
|
| Solution content |
|---|
}
/*
* Move the image onto the screen if it has been moved off
*/
public void putOnScreen()
{
// Get Rectangle of Tranformed Image
RectF theRect = getScaleOfImage();
|
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
matrix.postTranslate(deltaX,deltaY);
updateDisplayImage();
imageView.setImageMatrix(matrix);
<<<<<<< HEAD
overlayImageView.setImageMatrix(matrix);
}
public void clearOverlay() {
Paint clearPaint = new Paint();
clearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
overlayCanvas.drawRect(0, 0, overlayCanvas.getWidth(), overlayCanvas.getHeight(), clearPaint);
overlayImageView.invalidate();
=======
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
}
/* |
| Solution content |
|---|
matrix.postTranslate(deltaX,deltaY); updateDisplayImage(); imageView.setImageMatrix(matrix); } /* |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
_backgroundColor); imageRegions.add(imageRegion); <<<<<<< HEAD addImageRegionToLayout(imageRegion); mdh.registerImageRegion(imageRegion); clearOverlay(); ======= addImageRegionToLayout(imageRegion,showPopup); >>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15 } /* |
| Solution content |
|---|
_backgroundColor); imageRegions.add(imageRegion); addImageRegionToLayout(imageRegion,showPopup); } /* |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
<<<<<<< HEAD
public void addImageRegionToLayout(ImageRegion imageRegion) {
return theRect;
}
=======
/*
* Add an ImageRegion to the layout
*/
public void addImageRegionToLayout(ImageRegion imageRegion, boolean showPopup)
{
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
// Get Rectangle of Current Transformed Image
RectF theRect = getScaleOfImage();
Log.v(LOGTAG,"New Width:" + theRect.width()); |
| Solution content |
|---|
return theRect;
}
/*
* Add an ImageRegion to the layout
*/
public void addImageRegionToLayout(ImageRegion imageRegion, boolean showPopup)
{
// Get Rectangle of Current Transformed Image
RectF theRect = getScaleOfImage();
Log.v(LOGTAG,"New Width:" + theRect.width()); |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
<<<<<<< HEAD
=======
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
case R.id.menu_new_region:
// Set the Start point.
startPoint.set(imageView.getWidth()/2, imageView.getHeight()/2); |
| Solution content |
|---|
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_new_region:
// Set the Start point.
startPoint.set(imageView.getWidth()/2, imageView.getHeight()/2); |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
return false;
}
}
<<<<<<< HEAD
private void shareImage() {
//how take care of the original!
if (deleteOriginal && imageUri != null)
handleDelete();
=======
>>>>>>> 88da26e70d5bbab5d880081d1496a8c5f4ed5a15
/*
* Display the about screen |
| Solution content |
|---|
return false;
}
}
/*
* Display the about screen |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
case ImageRegion.PIXELIZE:
{
ImageRegion currentRegion = i.next();
<<<<<<< HEAD
//REWORK THIS CODE
// If the currentRegion is to be obscured:
// Using the interface
ObscureMethod om;
int obscureMethod = 1;
// Load the appropriate class/method based on obscureMethod variable/constants
if (obscureMethod == 1) {
//om = new BlurObscure(obscuredBmp);
om = new PixelizeObscure(obscuredBmp);
//om = new AnonObscure(this, obscuredBmp, obscuredPaint);
}
else if (obscureMethod == 2)
{
long signKey = 1;
long encryptKeys[] = {1};
om = new EncryptObscureMethod(this, obscuredBmp, signKey, encryptKeys);
}
else {
om = new PaintSquareObscure();
}
// WORKS
//obscuredCanvas.drawRect(currentRegion.getScaledRect(imageBitmap.getWidth(), imageBitmap.getHeight()), obscuredPaint);
// This should be determined by the currentRegion.whatever
//new PaintSquareObscure();
Rect rect = currentRegion.getScaledRect(imageBitmap.getWidth(), imageBitmap.getHeight());
om.obscureRect(rect, obscuredCanvas);
}
return obscuredBmp;
}
// Queries the contentResolver to pull out the path for the actual file.
public String pullPathFromUri(Uri originalImageUri) {
String originalImageFilePath = null;
String[] columnsToSelect = { MediaStore.Images.Media.DATA };
Cursor imageCursor = getContentResolver().query( originalImageUri, columnsToSelect, null, null, null );
if ( imageCursor != null && imageCursor.getCount() == 1 ) {
imageCursor.moveToFirst();
originalImageFilePath = imageCursor.getString(imageCursor.getColumnIndex(MediaStore.Images.Media.DATA));
}
return originalImageFilePath;
}
private void saveImage() {
String src_filename = pullPathFromUri(imageUri);
// Uri is savedImageUri which is global
if (savedImageUri == null) {
ContentValues cv = new ContentValues();
savedImageUri = getContentResolver().insert(
Media.EXTERNAL_CONTENT_URI, cv);
}
String dest_filename = pullPathFromUri(savedImageUri);//mdh.getFileNameFromUri(savedImageUri);
Log.v(LOGTAG,"src_filename : " + src_filename );
Log.v(LOGTAG,"dest_filename: " + dest_filename );
try {
// Build up a string of semi-colon separated regions l,r,t,b in image coords.
String regions = "";//"10,400,500,1000;400,800,300,700";
Log.v(LOGTAG,"obscureType: PIXELIZE");
// Create the Uri - This can't be "private"
Iterator |
| Solution content |
|---|
{
ImageRegion currentRegion = i.next();
// Would like this to not be dependent on knowing the relationship between
// the classes and the constants in ImageRegion. Would like there to be a
// method within ImageRegion that creates the ObscureMethod object and passes
// it back. Right now though, all of the ObscureMethods take in different
// arguments which makes it painful.
// Select the ObscureMethod as contained in the ImageRegion
ObscureMethod om;
switch (currentRegion.obscureType) {
case ImageRegion.BLUR:
Log.v(LOGTAG,"obscureType: BLUR");
om = new CrowdBlurObscure(obscuredBmp);
break;
case ImageRegion.ANON:
Log.v(LOGTAG,"obscureType: ANON");
om = new AnonObscure(this.getApplicationContext(), obscuredBmp, obscuredPaint);
break;
case ImageRegion.SOLID:
Log.v(LOGTAG,"obscureType: SOLID");
om = new PaintSquareObscure();
break;
case ImageRegion.PIXELIZE:
Log.v(LOGTAG,"obscureType: PIXELIZE");
om = new PixelizeObscure(obscuredBmp);
break;
default:
Log.v(LOGTAG,"obscureType: NONE/BLUR");
om = new BlurObscure(obscuredBmp);
break;
}
// Get the Rect for the region and do the obscure
Rect rect = currentRegion.getAScaledRect(obscuredBmp.getWidth(),obscuredBmp.getHeight());
private boolean saveTmpImage() {
Log.v(LOGTAG,"unscaled rect: left:" + rect.left + " right:" + rect.right
+ " top:" + rect.top + " bottom:" + rect.bottom);
om.obscureRect(rect, obscuredCanvas);
}
return obscuredBmp;
}
/*
* Save a temporary image for sharing only
*/
String storageState = Environment.getExternalStorageState();
if (!Environment.MEDIA_MOUNTED.equals(storageState)) {
Toast t = Toast.makeText(this,"External storage not available", Toast.LENGTH_SHORT);
t.show();
return false;
}
//Why does this not show?
ProgressDialog progressDialog = ProgressDialog.show(this, "", "Exporting for share...", true, true);
// Create the bitmap that will be saved
// Perhaps this should be smaller than screen size??
int w = imageBitmap.getWidth();
int h = imageBitmap.getHeight();
/* This isn't necessary
if (imageBitmap.getWidth() > SHARE_SIZE_MAX_WIDTH_HEIGHT || imageBitmap.getHeight() > SHARE_SIZE_MAX_WIDTH_HEIGHT) {
// Size it down proportionally
float ratio = 1;
if (imageBitmap.getWidth() > imageBitmap.getHeight()) {
ratio = (float)SHARE_SIZE_MAX_WIDTH_HEIGHT/(float)imageBitmap.getWidth();
} else {
ratio = (float)SHARE_SIZE_MAX_WIDTH_HEIGHT/(float)imageBitmap.getHeight();
}
w = (int) (ratio * imageBitmap.getWidth());
h = (int) (ratio * imageBitmap.getHeight());
}
*/
Bitmap obscuredBmp = createObscuredBitmap(w,h);
// Create the Uri - This can't be "private"
File tmpFileDirectory = new File(Environment.getExternalStorageDirectory().getPath() + TMP_FILE_DIRECTORY);
File tmpFile = new File(tmpFileDirectory,TMP_FILE_NAME);
Log.v(LOGTAG, tmpFile.getPath());
try {
if (!tmpFileDirectory.exists()) {
tmpFileDirectory.mkdirs();
}
tmpImageUri = Uri.fromFile(tmpFile);
OutputStream imageFileOS;
int quality = 75;
imageFileOS = getContentResolver().openOutputStream(tmpImageUri);
obscuredBmp.compress(CompressFormat.JPEG, quality, imageFileOS);
progressDialog.cancel();
return true;
} catch (FileNotFoundException e) {
progressDialog.cancel();
e.printStackTrace();
return false;
} |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Catch clause |
| Comment |
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Return statement |
| Switch statement |
| Try statement |
| Variable |
| While statement |
| Chunk |
|---|
| Conflicting content |
|---|
e.printStackTrace();
return false;
}
<<<<<<< HEAD
if (deleteOriginal && imageUri != null)
handleDelete();
// Encrypt Regions
Iterator |
| Solution content |
|---|
e.printStackTrace();
return false;
}
}
/*
* The method that actually saves the altered image.
* This in combination with createObscuredBitmap could/should be done in another, more memory efficient manner.
*/
private void saveImage()
{
//Why does this not show?
ProgressDialog progressDialog = ProgressDialog.show(this, "", "Saving...", true, true);
// Create the bitmap that will be saved
// Screen size
Bitmap obscuredBmp = createObscuredBitmap(imageBitmap.getWidth(),imageBitmap.getHeight());
ContentValues cv = new ContentValues();
/*
// Add a date so it shows up in a reasonable place in the gallery - Should we do this??
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
// Which one?
cv.put(Media.DATE_ADDED, dateFormat.format(date));
cv.put(Media.DATE_TAKEN, dateFormat.format(date));
cv.put(Media.DATE_MODIFIED, dateFormat.format(date));
*/
// Uri is savedImageUri which is global
// Create the Uri, this should put it in the gallery
// New Each time
savedImageUri = getContentResolver().insert(
Media.EXTERNAL_CONTENT_URI, cv);
OutputStream imageFileOS;
try {
int quality = 100; //lossless? good question - still a smaller version
imageFileOS = getContentResolver().openOutputStream(savedImageUri);
obscuredBmp.compress(CompressFormat.JPEG, quality, imageFileOS);
Toast t = Toast.makeText(this,"Saved JPEG!", Toast.LENGTH_SHORT);
t.show();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
progressDialog.cancel();
}
// Queries the contentResolver to pull out the path for the actual file. |
| File |
|---|
| ImageEditor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Try statement |
| Variable |
| While statement |