| Chunk |
|---|
| Conflicting content |
|---|
private void init() {
setFocusable(true);
// We need extra padding below to prevent the bubble being cut.
<<<<<<< HEAD
setPadding(0, 0, 0, PADDING_V);
=======
setPadding(PADDING_H, 0, PADDING_H, PADDING_V);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setColor(getContext().getResources() |
| Solution content |
|---|
private void init() {
setFocusable(true);
// We need extra padding below to prevent the bubble being cut.
setPadding(PADDING_H, 0, PADDING_H, PADDING_V);
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setColor(getContext().getResources() |
| File |
|---|
| ActionMenuButton.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
mTidSet = true;
BitmapThread.this.notifyAll();
}
<<<<<<< HEAD:src/com/android/camera/BitmapThread.java
private synchronized void setFinished() {
mFinished = true;
}
=======
private synchronized void setFinished() {
mFinished = true;
}
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f:src/com/android/camera/BitmapThread.java
public BitmapThread(final Runnable r) {
Runnable wrapper = new Runnable() {
public void run() { |
| Solution content |
|---|
mTidSet = true;
BitmapThread.this.notifyAll();
}
private synchronized void setFinished() {
mFinished = true;
}
public BitmapThread(final Runnable r) {
Runnable wrapper = new Runnable() {
public void run() { |
| File |
|---|
| BitmapThread.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
mThread = new Thread(wrapper);
}
<<<<<<< HEAD:src/com/android/camera/BitmapThread.java
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f:src/com/android/camera/BitmapThread.java
public synchronized void start() {
BitmapManager.instance().allowThreadDecoding(mThread);
mThread.start(); |
| Solution content |
|---|
mThread = new Thread(wrapper);
}
public synchronized void start() {
BitmapManager.instance().allowThreadDecoding(mThread);
mThread.start(); |
| File |
|---|
| BitmapThread.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
BitmapManager.instance().allowThreadDecoding(mThread);
mThread.start();
}
<<<<<<< HEAD:src/com/android/camera/BitmapThread.java
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f:src/com/android/camera/BitmapThread.java
public synchronized void setName(String name) {
mThread.setName(name);
} |
| Solution content |
|---|
BitmapManager.instance().allowThreadDecoding(mThread);
mThread.start();
}
public synchronized void setName(String name) {
mThread.setName(name);
} |
| File |
|---|
| BitmapThread.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
public Thread realThread() {
return mThread;
}
<<<<<<< HEAD:src/com/android/camera/BitmapThread.java
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f:src/com/android/camera/BitmapThread.java
public synchronized void setPriority(int androidOsPriority) {
while (!mTidSet) {
try { |
| Solution content |
|---|
public Thread realThread() {
return mThread;
}
public synchronized void setPriority(int androidOsPriority) {
while (!mTidSet) {
try { |
| File |
|---|
| BitmapThread.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
Process.setThreadPriority(mTid, androidOsPriority);
}
}
<<<<<<< HEAD:src/com/android/camera/BitmapThread.java
public synchronized void toBackground() {
setPriority(Process.THREAD_PRIORITY_BACKGROUND);
}
=======
public synchronized void toBackground() {
setPriority(Process.THREAD_PRIORITY_BACKGROUND);
}
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f:src/com/android/camera/BitmapThread.java
public synchronized void toForeground() {
setPriority(Process.THREAD_PRIORITY_FOREGROUND);
} |
| Solution content |
|---|
Process.setThreadPriority(mTid, androidOsPriority);
}
}
public synchronized void toBackground() {
setPriority(Process.THREAD_PRIORITY_BACKGROUND);
}
public synchronized void toForeground() {
setPriority(Process.THREAD_PRIORITY_FOREGROUND);
} |
| File |
|---|
| BitmapThread.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; <<<<<<< HEAD import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; ======= import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.graphics.drawable.BitmapDrawable; >>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f import android.graphics.drawable.Drawable; import android.hardware.Camera.PictureCallback; import android.hardware.Camera.Size; |
| Solution content |
|---|
import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.hardware.Camera.PictureCallback; import android.hardware.Camera.Size; |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
// The parameter strings to communicate with camera driver.
public static final String PARM_WHITE_BALANCE = "whitebalance";
public static final String PARM_EFFECT = "effect";
<<<<<<< HEAD
=======
public static final String PARM_BRIGHTNESS = "exposure-offset";
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
public static final String PARM_PICTURE_SIZE = "picture-size";
public static final String PARM_JPEG_QUALITY = "jpeg-quality";
public static final String PARM_ROTATION = "rotation"; |
| Solution content |
|---|
// The parameter strings to communicate with camera driver.
public static final String PARM_WHITE_BALANCE = "whitebalance";
public static final String PARM_EFFECT = "effect";
public static final String PARM_BRIGHTNESS = "exposure-offset";
public static final String PARM_PICTURE_SIZE = "picture-size";
public static final String PARM_JPEG_QUALITY = "jpeg-quality";
public static final String PARM_ROTATION = "rotation"; |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Chunk |
|---|
| Conflicting content |
|---|
public static final String PARM_GPS_TIMESTAMP = "gps-timestamp";
public static final String SUPPORTED_WHITE_BALANCE = "whitebalance-values";
public static final String SUPPORTED_EFFECT = "effect-values";
<<<<<<< HEAD
=======
public static final String SUPPORTED_BRIGHTNESS = "exposure-offset-values";
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
public static final String SUPPORTED_PICTURE_SIZE = "picture-size-values";
private OrientationEventListener mOrientationListener; |
| Solution content |
|---|
public static final String PARM_GPS_TIMESTAMP = "gps-timestamp";
public static final String SUPPORTED_WHITE_BALANCE = "whitebalance-values";
public static final String SUPPORTED_EFFECT = "effect-values";
public static final String SUPPORTED_BRIGHTNESS = "exposure-offset-values";
public static final String SUPPORTED_PICTURE_SIZE = "picture-size-values";
private OrientationEventListener mOrientationListener; |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Chunk |
|---|
| Conflicting content |
|---|
private int mViewFinderWidth, mViewFinderHeight;
private boolean mPreviewing = false;
<<<<<<< HEAD
=======
// TODO: Decide whether we should read these values from drivers,
// and update the preference screen if needed.
private static final int BRIGHTNESS_DEFAULT = 5;
private static final int BRIGHTNESS_MAX = 10;
private static final int BRIGHTNESS_MIN = 0;
private int mCurrentBrightness;
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
private Capturer mCaptureObject;
private ImageCapture mImageCapture = null;
|
| Solution content |
|---|
private int mViewFinderWidth, mViewFinderHeight;
private boolean mPreviewing = false;
// TODO: Decide whether we should read these values from drivers,
// and update the preference screen if needed.
private static final int BRIGHTNESS_DEFAULT = 5;
private static final int BRIGHTNESS_MAX = 10;
private static final int BRIGHTNESS_MIN = 0;
private int mCurrentBrightness;
private Capturer mCaptureObject;
private ImageCapture mImageCapture = null; |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
new OneShotPreviewCallback();
private Animation mFocusBlinkAnimation;
private View mFocusIndicator;
<<<<<<< HEAD
private ImageView mGpsIndicator;
private ToneGenerator mFocusToneGenerator;
private ShutterCallback mShutterCallback = new ShutterCallback();
private RawPictureCallback mRawPictureCallback = new RawPictureCallback();
private AutoFocusCallback mAutoFocusCallback = new AutoFocusCallback();
=======
private FocusRectangle mFocusRectangle;
private ImageView mGpsIndicator;
private ToneGenerator mFocusToneGenerator;
// Use OneShotPreviewCallback to measure the time between
// JpegPictureCallback and preview.
private final OneShotPreviewCallback mOneShotPreviewCallback =
private final ShutterCallback mShutterCallback = new ShutterCallback();
private final RawPictureCallback mRawPictureCallback =
new RawPictureCallback();
private final AutoFocusCallback mAutoFocusCallback =
new AutoFocusCallback();
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
private long mFocusStartTime;
private long mFocusCallbackTime;
private long mCaptureStartTime; |
| Solution content |
|---|
private Animation mFocusBlinkAnimation;
private View mFocusIndicator;
private FocusRectangle mFocusRectangle;
private ImageView mGpsIndicator;
private ToneGenerator mFocusToneGenerator;
// Use OneShotPreviewCallback to measure the time between
// JpegPictureCallback and preview.
private final OneShotPreviewCallback mOneShotPreviewCallback =
new OneShotPreviewCallback();
private final ShutterCallback mShutterCallback = new ShutterCallback();
private final RawPictureCallback mRawPictureCallback =
new RawPictureCallback();
private final AutoFocusCallback mAutoFocusCallback =
new AutoFocusCallback();
private long mFocusStartTime;
private long mFocusCallbackTime;
private long mCaptureStartTime; |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
private long mJpegPictureCallbackTime;
private int mPicturesRemaining;
private boolean mRecordLocation;
<<<<<<< HEAD
=======
// Focus mode. Options are pref_camera_focusmode_entryvalues.
private String mFocusMode;
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
private boolean mKeepAndRestartPreview;
|
| Solution content |
|---|
private long mJpegPictureCallbackTime;
private int mPicturesRemaining;
private boolean mRecordLocation;
// Focus mode. Options are pref_camera_focusmode_entryvalues.
private String mFocusMode;
private boolean mKeepAndRestartPreview;
|
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
private boolean mImageSavingItem = false;
<<<<<<< HEAD
private final class ShutterCallback
implements android.hardware.Camera.ShutterCallback {
public void onShutter() {
if (DEBUG_TIME_OPERATIONS) {
mShutterCallbackTime = System.currentTimeMillis();
Log.v(TAG, "Shutter lag was "
+ (mShutterCallbackTime - mCaptureStartTime) + " ms.");
=======
private final class OneShotPreviewCallback
implements android.hardware.Camera.PreviewCallback {
public void onPreviewFrame(byte[] data,
android.hardware.Camera camera) {
long now = System.currentTimeMillis();
if (mJpegPictureCallbackTime != 0) {
Log.v(TAG, (now - mJpegPictureCallbackTime)
+ "ms elapsed between JpegPictureCallback and preview "
+ "restarted.");
mJpegPictureCallbackTime = 0;
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
}
} |
| Solution content |
|---|
private boolean mImageSavingItem = false;
private final class OneShotPreviewCallback
implements android.hardware.Camera.PreviewCallback {
public void onPreviewFrame(byte[] data,
android.hardware.Camera camera) {
long now = System.currentTimeMillis();
if (mJpegPictureCallbackTime != 0) {
Log.v(TAG, (now - mJpegPictureCallbackTime)
+ "ms elapsed between JpegPictureCallback and preview "
+ "restarted.");
mJpegPictureCallbackTime = 0;
}
}
} |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Class signature |
| If statement |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
private final class RawPictureCallback implements PictureCallback {
public void onPictureTaken(
byte [] rawData, android.hardware.Camera camera) {
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "got RawPictureCallback...");
}
mRawPictureCallbackTime = System.currentTimeMillis();
if (DEBUG_TIME_OPERATIONS) {
Log.v(TAG, (mRawPictureCallbackTime - mShutterCallbackTime)
+ "ms elapsed between"
+ " ShutterCallback and RawPictureCallback.");
}
=======
mRawPictureCallbackTime = System.currentTimeMillis();
Log.v(TAG, (mRawPictureCallbackTime - mShutterCallbackTime)
+ "ms elapsed between"
+ " ShutterCallback and RawPictureCallback.");
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
}
|
| Solution content |
|---|
private final class RawPictureCallback implements PictureCallback {
public void onPictureTaken(
byte [] rawData, android.hardware.Camera camera) {
mRawPictureCallbackTime = System.currentTimeMillis();
Log.v(TAG, (mRawPictureCallbackTime - mShutterCallbackTime)
+ "ms elapsed between"
+ " ShutterCallback and RawPictureCallback.");
}
}
|
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| If statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
if (mPausing) {
return;
}
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "got JpegPictureCallback...");
}
if (DEBUG_TIME_OPERATIONS) {
long mJpegPictureCallback = System.currentTimeMillis();
Log.v(TAG, (mJpegPictureCallback - mRawPictureCallbackTime)
+ "ms elapsed between"
+ " RawPictureCallback and JpegPictureCallback.");
}
=======
mJpegPictureCallbackTime = System.currentTimeMillis();
Log.v(TAG, (mJpegPictureCallbackTime - mRawPictureCallbackTime)
+ "ms elapsed between"
+ " RawPictureCallback and JpegPictureCallback.");
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
if (jpegData != null) {
mImageCapture.storeImage(jpegData, camera, mLocation); |
| Solution content |
|---|
if (mPausing) {
return;
}
mJpegPictureCallbackTime = System.currentTimeMillis();
Log.v(TAG, (mJpegPictureCallbackTime - mRawPictureCallbackTime)
+ "ms elapsed between"
+ " RawPictureCallback and JpegPictureCallback.");
if (jpegData != null) {
mImageCapture.storeImage(jpegData, camera, mLocation); |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| If statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
}
}
<<<<<<< HEAD
private final class AutoFocusCallback
implements android.hardware.Camera.AutoFocusCallback {
public void onAutoFocus(
boolean focused, android.hardware.Camera camera) {
if (DEBUG_TIME_OPERATIONS) {
mFocusCallbackTime = System.currentTimeMillis();
Log.v(TAG, "Auto focus took "
+ (mFocusCallbackTime - mFocusStartTime) + " ms.");
}
=======
private final class AutoFocusCallback
implements android.hardware.Camera.AutoFocusCallback {
public void onAutoFocus(
boolean focused, android.hardware.Camera camera) {
mFocusCallbackTime = System.currentTimeMillis();
Log.v(TAG, "Auto focus took "
+ (mFocusCallbackTime - mFocusStartTime) + " ms.");
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
if (mFocusState == FOCUSING_SNAP_ON_FINISH
&& mCaptureObject != null) {
// Take the picture no matter focus succeeds or fails. No need |
| Solution content |
|---|
}
}
}
private final class AutoFocusCallback
implements android.hardware.Camera.AutoFocusCallback {
public void onAutoFocus(
boolean focused, android.hardware.Camera camera) {
mFocusCallbackTime = System.currentTimeMillis();
Log.v(TAG, "Auto focus took "
+ (mFocusCallbackTime - mFocusStartTime) + " ms.");
if (mFocusState == FOCUSING_SNAP_ON_FINISH
&& mCaptureObject != null) {
// Take the picture no matter focus succeeds or fails. No need |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Class signature |
| If statement |
| Method invocation |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
mCancel = true;
}
if (!mCancel) {
<<<<<<< HEAD
mAddImageCancelable =
ImageManager.instance().storeImage(mLastContentUri,
Camera.this, mContentResolver, 0, null, data);
=======
mAddImageCancelable = ImageManager.storeImage(
mLastContentUri, mContentResolver,
0, null, data);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mAddImageCancelable.get();
mAddImageCancelable = null;
ImageManager.setImageSize(mContentResolver, mLastContentUri, |
| Solution content |
|---|
mCancel = true;
}
if (!mCancel) {
mAddImageCancelable = ImageManager.storeImage(
mLastContentUri, mContentResolver,
0, null, data);
mAddImageCancelable.get();
mAddImageCancelable = null;
ImageManager.setImageSize(mContentResolver, mLastContentUri, |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
if (mPausing) {
return;
}
<<<<<<< HEAD
if (DEBUG_TIME_OPERATIONS) {
mCaptureStartTime = System.currentTimeMillis();
}
=======
mCaptureStartTime = System.currentTimeMillis();
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
// If we are already in the middle of taking a snapshot then we
// should just save |
| Solution content |
|---|
if (mPausing) {
return;
}
mCaptureStartTime = System.currentTimeMillis();
// If we are already in the middle of taking a snapshot then we
// should just save |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| If statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
mOrientationListener.enable();
mRecordLocation = mPreferences.getBoolean(
"pref_camera_recordlocation_key", false);
<<<<<<< HEAD
mGpsIndicator.setVisibility(View.INVISIBLE);
=======
mFocusMode = mPreferences.getString(
CameraSettings.KEY_FOCUS_MODE,
getString(R.string.pref_camera_focusmode_default));
mGpsIndicator.setVisibility(View.INVISIBLE);
mJpegPictureCallbackTime = 0;
readBrightnessPreference();
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
// install an intent filter to receive SD card related events.
IntentFilter intentFilter = |
| Solution content |
|---|
mOrientationListener.enable();
mRecordLocation = mPreferences.getBoolean(
"pref_camera_recordlocation_key", false);
mFocusMode = mPreferences.getString(
CameraSettings.KEY_FOCUS_MODE,
getString(R.string.pref_camera_focusmode_default));
mGpsIndicator.setVisibility(View.INVISIBLE);
mJpegPictureCallbackTime = 0;
readBrightnessPreference();
// install an intent filter to receive SD card related events.
IntentFilter intentFilter = |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
private void doSnap() {
<<<<<<< HEAD
/*
* If the user has half-pressed the shutter and focus is completed, we
* can take the photo right away.
*/
if ((mFocusState == FOCUS_SUCCESS || mFocusState == FOCUS_FAIL)
=======
// If the user has half-pressed the shutter and focus is completed, we
// can take the photo right away. If the focus mode is infinity, we can
// also take the photo.
if (mFocusMode.equals(getString(
R.string.pref_camera_focusmode_value_infinity))
|| (mFocusState == FOCUS_SUCCESS || mFocusState == FOCUS_FAIL)
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
|| !mPreviewing) {
// doesn't get set until the idler runs
if (mCaptureObject != null) { |
| Solution content |
|---|
}
private void doSnap() {
// If the user has half-pressed the shutter and focus is completed, we
// can take the photo right away. If the focus mode is infinity, we can
// also take the photo.
if (mFocusMode.equals(getString(
R.string.pref_camera_focusmode_value_infinity))
|| (mFocusState == FOCUS_SUCCESS || mFocusState == FOCUS_FAIL)
|| !mPreviewing) {
// doesn't get set until the idler runs
if (mCaptureObject != null) { |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
}
private void updateLastImage() {
<<<<<<< HEAD
IImageList list = ImageManager.instance().allImages(
this,
=======
IImageList list = ImageManager.allImages(
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mContentResolver,
dataLocation(),
ImageManager.INCLUDE_IMAGES, |
| Solution content |
|---|
}
private void updateLastImage() {
IImageList list = ImageManager.allImages(
mContentResolver,
dataLocation(),
ImageManager.INCLUDE_IMAGES, |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
// latency. It's true that someone else could write to the SD card in
// the mean time and fill it, but that could have happened between the
// shutter press and saving the JPEG too.
<<<<<<< HEAD
// TODO: The best longterm solution is to write a reserve file of
// maximum JPEG size, always let the user take a picture, and
// delete that file if needed to save the new photo.
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
calculatePicturesRemaining();
if (!mIsImageCaptureIntent && !mThumbController.isUriValid()) { |
| Solution content |
|---|
// latency. It's true that someone else could write to the SD card in
// the mean time and fill it, but that could have happened between the
// shutter press and saving the JPEG too.
calculatePicturesRemaining();
if (!mIsImageCaptureIntent && !mThumbController.isUriValid()) { |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
int delay = (int) (SystemClock.elapsedRealtime()
- wallTimeStart) / 1000;
if (delay >= nextWarning) {
<<<<<<< HEAD
if (delay < 120) {
Log.e(TAG, "preview hasn't started yet in "
+ delay + " seconds");
} else {
Log.e(TAG, "preview hasn't started yet in "
+ (delay / 60) + " minutes");
}
=======
Log.e(TAG, "preview hasn't started yet in "
+ delay + " seconds");
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
if (nextWarning < 60) {
nextWarning <<= 1;
if (nextWarning == 16) { |
| Solution content |
|---|
int delay = (int) (SystemClock.elapsedRealtime()
- wallTimeStart) / 1000;
if (delay >= nextWarning) {
Log.e(TAG, "preview hasn't started yet in "
+ delay + " seconds");
if (nextWarning < 60) {
nextWarning <<= 1;
if (nextWarning == 16) { |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
watchDog.start();
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "calling mCameraDevice.startPreview");
}
=======
// Set one shot preview callback for latency measurement.
mCameraDevice.setOneShotPreviewCallback(mOneShotPreviewCallback);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
try {
mCameraDevice.startPreview();
} catch (Throwable e) { |
| Solution content |
|---|
watchDog.start();
// Set one shot preview callback for latency measurement.
mCameraDevice.setOneShotPreviewCallback(mOneShotPreviewCallback);
try {
mCameraDevice.startPreview();
} catch (Throwable e) { |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
private IImage getImageForURI(Uri uri) {
<<<<<<< HEAD
IImageList list = ImageManager.instance().allImages(
this,
=======
IImageList list = ImageManager.allImages(
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mContentResolver,
dataLocation(),
ImageManager.INCLUDE_IMAGES, |
| Solution content |
|---|
}
private IImage getImageForURI(Uri uri) {
IImageList list = ImageManager.allImages(
mContentResolver,
dataLocation(),
ImageManager.INCLUDE_IMAGES, |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
return true;
}
<<<<<<< HEAD
SelectedImageGetter mSelectedImageGetter =
new SelectedImageGetter() {
public IImage getCurrentImage() {
return getImageForURI(getCurrentImageUri());
}
public Uri getCurrentImageUri() {
keep();
return mCaptureObject.getLastCaptureUri();
}
};
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
private int calculatePicturesRemaining() {
mPicturesRemaining = MenuHelper.calculatePicturesRemaining();
return mPicturesRemaining; |
| Solution content |
|---|
return true;
}
private int calculatePicturesRemaining() {
mPicturesRemaining = MenuHelper.calculatePicturesRemaining();
return mPicturesRemaining; |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
item.setIcon(android.R.drawable.ic_menu_preferences);
}
}
<<<<<<< HEAD
=======
class FocusRectangle extends View {
private static final String TAG = "FocusRectangle";
public FocusRectangle(Context context, AttributeSet attrs) {
super(context, attrs);
}
private void setDrawable(int resid) {
BitmapDrawable d = (BitmapDrawable) getResources().getDrawable(resid);
// We do this because we don't want the bitmap to be scaled.
d.setGravity(Gravity.CENTER);
setBackgroundDrawable(d);
}
public void showStart() {
setDrawable(R.drawable.frame_autofocus_rectangle);
}
public void showSuccess() {
setDrawable(R.drawable.frame_focused_rectangle);
}
public void showFail() {
setDrawable(R.drawable.frame_nofocus_rectangle);
}
public void clear() {
setBackgroundDrawable(null);
}
}
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f |
| Solution content |
|---|
item.setIcon(android.R.drawable.ic_menu_preferences);
}
}
class FocusRectangle extends View {
private static final String TAG = "FocusRectangle";
public FocusRectangle(Context context, AttributeSet attrs) {
super(context, attrs);
}
private void setDrawable(int resid) {
BitmapDrawable d = (BitmapDrawable) getResources().getDrawable(resid);
// We do this because we don't want the bitmap to be scaled.
d.setGravity(Gravity.CENTER);
setBackgroundDrawable(d);
}
public void showStart() {
setDrawable(R.drawable.frame_autofocus_rectangle);
}
public void showSuccess() {
setDrawable(R.drawable.frame_focused_rectangle);
}
public void showFail() {
setDrawable(R.drawable.frame_nofocus_rectangle);
}
public void clear() {
setBackgroundDrawable(null);
}
} |
| File |
|---|
| Camera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Class declaration |
| Chunk |
|---|
| Conflicting content |
|---|
*/
public class CameraSettings extends PreferenceActivity implements
OnSharedPreferenceChangeListener {
<<<<<<< HEAD
public static final String KEY_VIDEO_QUALITY =
"pref_camera_videoquality_key";
public static final String KEY_WHITE_BALANCE =
"pref_camera_whitebalance_key";
public static final String KEY_EFFECT = "pref_camera_effect_key";
public static final String KEY_PICTURE_SIZE = "pref_camera_picturesize_key";
public static final String KEY_JPEG_QUALITY = "pref_camera_jpegquality_key";
=======
public static final String KEY_VIDEO_QUALITY =
"pref_camera_videoquality_key";
public static final String KEY_WHITE_BALANCE =
"pref_camera_whitebalance_key";
public static final String KEY_EFFECT = "pref_camera_effect_key";
public static final String KEY_BRIGHTNESS = "pref_camera_brightness_key";
public static final String KEY_PICTURE_SIZE = "pref_camera_picturesize_key";
public static final String KEY_JPEG_QUALITY = "pref_camera_jpegquality_key";
public static final String KEY_FOCUS_MODE = "pref_camera_focusmode_key";
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
public static final boolean DEFAULT_VIDEO_QUALITY_VALUE = true;
private ListPreference mVideoQuality; |
| Solution content |
|---|
*/
public class CameraSettings extends PreferenceActivity implements
OnSharedPreferenceChangeListener {
public static final String KEY_VIDEO_QUALITY =
"pref_camera_videoquality_key";
public static final String KEY_WHITE_BALANCE =
"pref_camera_whitebalance_key";
public static final String KEY_EFFECT = "pref_camera_effect_key";
public static final String KEY_BRIGHTNESS = "pref_camera_brightness_key";
public static final String KEY_PICTURE_SIZE = "pref_camera_picturesize_key";
public static final String KEY_JPEG_QUALITY = "pref_camera_jpegquality_key";
public static final String KEY_FOCUS_MODE = "pref_camera_focusmode_key";
public static final boolean DEFAULT_VIDEO_QUALITY_VALUE = true;
private ListPreference mVideoQuality; |
| File |
|---|
| CameraSettings.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Chunk |
|---|
| Conflicting content |
|---|
private ListPreference mVideoQuality;
private ListPreference mWhiteBalance;
private ListPreference mEffect;
<<<<<<< HEAD
private ListPreference mPictureSize;
private ListPreference mJpegQuality;
=======
private ListPreference mBrightness;
private ListPreference mPictureSize;
private ListPreference mJpegQuality;
private ListPreference mFocusMode;
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
private Parameters mParameters;
@Override |
| Solution content |
|---|
private ListPreference mVideoQuality;
private ListPreference mWhiteBalance;
private ListPreference mEffect;
private ListPreference mBrightness;
private ListPreference mPictureSize;
private ListPreference mJpegQuality;
private ListPreference mFocusMode;
private Parameters mParameters;
@Override |
| File |
|---|
| CameraSettings.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Chunk |
|---|
| Conflicting content |
|---|
updateVideoQualitySummary();
updateWhiteBalanceSummary();
updateEffectSummary();
<<<<<<< HEAD
updatePictureSizeSummary();
updateJpegQualitySummary();
=======
updateBrightnessSummary();
updatePictureSizeSummary();
updateJpegQualitySummary();
updateFocusModeSummary();
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
private void initUI() { |
| Solution content |
|---|
updateVideoQualitySummary();
updateWhiteBalanceSummary();
updateEffectSummary();
updateBrightnessSummary();
updatePictureSizeSummary();
updateJpegQualitySummary();
updateFocusModeSummary();
}
private void initUI() { |
| File |
|---|
| CameraSettings.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
mVideoQuality = (ListPreference) findPreference(KEY_VIDEO_QUALITY);
mWhiteBalance = (ListPreference) findPreference(KEY_WHITE_BALANCE);
mEffect = (ListPreference) findPreference(KEY_EFFECT);
<<<<<<< HEAD
mPictureSize = (ListPreference) findPreference(KEY_PICTURE_SIZE);
mJpegQuality = (ListPreference) findPreference(KEY_JPEG_QUALITY);
=======
mBrightness = (ListPreference) findPreference(KEY_BRIGHTNESS);
mPictureSize = (ListPreference) findPreference(KEY_PICTURE_SIZE);
mJpegQuality = (ListPreference) findPreference(KEY_JPEG_QUALITY);
mFocusMode = (ListPreference) findPreference(KEY_FOCUS_MODE);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
getPreferenceScreen().getSharedPreferences().
registerOnSharedPreferenceChangeListener(this);
|
| Solution content |
|---|
mVideoQuality = (ListPreference) findPreference(KEY_VIDEO_QUALITY);
mWhiteBalance = (ListPreference) findPreference(KEY_WHITE_BALANCE);
mEffect = (ListPreference) findPreference(KEY_EFFECT);
mBrightness = (ListPreference) findPreference(KEY_BRIGHTNESS);
mPictureSize = (ListPreference) findPreference(KEY_PICTURE_SIZE);
mJpegQuality = (ListPreference) findPreference(KEY_JPEG_QUALITY);
mFocusMode = (ListPreference) findPreference(KEY_FOCUS_MODE);
getPreferenceScreen().getSharedPreferences().
registerOnSharedPreferenceChangeListener(this);
|
| File |
|---|
| CameraSettings.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Cast expression |
| Chunk |
|---|
| Conflicting content |
|---|
createSettings(mWhiteBalance, Camera.SUPPORTED_WHITE_BALANCE,
R.array.pref_camera_whitebalance_entries,
R.array.pref_camera_whitebalance_entryvalues);
<<<<<<< HEAD
// Create effect settings.
createSettings(mEffect, Camera.SUPPORTED_EFFECT,
R.array.pref_camera_effect_entries,
R.array.pref_camera_effect_entryvalues);
=======
// Create effect settings.
createSettings(mEffect, Camera.SUPPORTED_EFFECT,
R.array.pref_camera_effect_entries,
R.array.pref_camera_effect_entryvalues);
// Create brightness settings.
createSettings(mBrightness, Camera.SUPPORTED_BRIGHTNESS,
R.array.pref_camera_brightness_entries,
R.array.pref_camera_brightness_entryvalues);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
// Create picture size settings.
createSettings(mPictureSize, Camera.SUPPORTED_PICTURE_SIZE, |
| Solution content |
|---|
createSettings(mWhiteBalance, Camera.SUPPORTED_WHITE_BALANCE,
R.array.pref_camera_whitebalance_entries,
R.array.pref_camera_whitebalance_entryvalues);
// Create effect settings.
createSettings(mEffect, Camera.SUPPORTED_EFFECT,
R.array.pref_camera_effect_entries,
R.array.pref_camera_effect_entryvalues);
// Create brightness settings.
createSettings(mBrightness, Camera.SUPPORTED_BRIGHTNESS,
R.array.pref_camera_brightness_entries,
R.array.pref_camera_brightness_entryvalues);
// Create picture size settings.
createSettings(mPictureSize, Camera.SUPPORTED_PICTURE_SIZE, |
| File |
|---|
| CameraSettings.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
createSettings(mPictureSize, Camera.SUPPORTED_PICTURE_SIZE,
R.array.pref_camera_picturesize_entries,
R.array.pref_camera_picturesize_entryvalues);
<<<<<<< HEAD
=======
// Set default JPEG quality value if it is empty.
if (mJpegQuality.getValue() == null) {
mJpegQuality.setValue(getString(
R.string.pref_camera_jpegquality_default));
}
// Set default focus mode value if it is empty.
if (mFocusMode.getValue() == null) {
mFocusMode.setValue(getString(
R.string.pref_camera_focusmode_default));
}
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
private void createSettings( |
| Solution content |
|---|
createSettings(mPictureSize, Camera.SUPPORTED_PICTURE_SIZE,
R.array.pref_camera_picturesize_entries,
R.array.pref_camera_picturesize_entryvalues);
// Set default JPEG quality value if it is empty.
if (mJpegQuality.getValue() == null) {
mJpegQuality.setValue(getString(
R.string.pref_camera_jpegquality_default));
}
// Set default focus mode value if it is empty.
if (mFocusMode.getValue() == null) {
mFocusMode.setValue(getString(
R.string.pref_camera_focusmode_default));
}
}
private void createSettings( |
| File |
|---|
| CameraSettings.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
int prefEntryValuesResId) {
// Disable the preference if the parameter is not supported.
String supportedParamStr = mParameters.get(paramName);
<<<<<<< HEAD
if (supportedParamStr == null) {
=======
if (supportedParamStr == null) {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
pref.setEnabled(false);
return;
} |
| Solution content |
|---|
int prefEntryValuesResId) {
// Disable the preference if the parameter is not supported.
String supportedParamStr = mParameters.get(paramName);
if (supportedParamStr == null) {
pref.setEnabled(false);
return;
} |
| File |
|---|
| CameraSettings.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
entries.add(allEntries[i]);
entryValues.add(allEntryValues[i]);
}
<<<<<<< HEAD
}
// Set entries and entry values to list preference.
pref.setEntries(entries.toArray(new CharSequence[entries.size()]));
pref.setEntryValues(entryValues.toArray(
new CharSequence[entryValues.size()]));
// Set the value to the first entry if it is invalid.
String value = pref.getValue();
int index = pref.findIndexOfValue(value);
if (index == -1) {
pref.setValueIndex(0);
}
}
private void updateVideoQualitySummary() {
mVideoQuality.setSummary(mVideoQuality.getEntry());
}
private void updateWhiteBalanceSummary() {
mWhiteBalance.setSummary(mWhiteBalance.getEntry());
}
private void updateEffectSummary() {
mEffect.setSummary(mEffect.getEntry());
=======
}
// Set entries and entry values to list preference.
pref.setEntries(entries.toArray(new CharSequence[entries.size()]));
pref.setEntryValues(entryValues.toArray(
new CharSequence[entryValues.size()]));
// Set the value to the first entry if it is invalid.
String value = pref.getValue();
int index = pref.findIndexOfValue(value);
if (index == -1) {
pref.setValueIndex(0);
}
}
private void updateVideoQualitySummary() {
mVideoQuality.setSummary(mVideoQuality.getEntry());
}
private void updateWhiteBalanceSummary() {
mWhiteBalance.setSummary(mWhiteBalance.getEntry());
}
private void updateEffectSummary() {
mEffect.setSummary(mEffect.getEntry());
}
private void updateBrightnessSummary() {
mBrightness.setSummary(mBrightness.getEntry());
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
private void updatePictureSizeSummary() { |
| Solution content |
|---|
entries.add(allEntries[i]);
entryValues.add(allEntryValues[i]);
}
}
// Set entries and entry values to list preference.
pref.setEntries(entries.toArray(new CharSequence[entries.size()]));
pref.setEntryValues(entryValues.toArray(
new CharSequence[entryValues.size()]));
// Set the value to the first entry if it is invalid.
String value = pref.getValue();
int index = pref.findIndexOfValue(value);
if (index == -1) {
pref.setValueIndex(0);
}
}
private void updateVideoQualitySummary() {
mVideoQuality.setSummary(mVideoQuality.getEntry());
}
private void updateWhiteBalanceSummary() {
mWhiteBalance.setSummary(mWhiteBalance.getEntry());
}
private void updateEffectSummary() {
mEffect.setSummary(mEffect.getEntry());
}
private void updateBrightnessSummary() {
mBrightness.setSummary(mBrightness.getEntry());
}
private void updatePictureSizeSummary() { |
| File |
|---|
| CameraSettings.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
private void updateJpegQualitySummary() {
mJpegQuality.setSummary(mJpegQuality.getEntry());
<<<<<<< HEAD
=======
}
private void updateFocusModeSummary() {
mFocusMode.setSummary(mFocusMode.getEntry());
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, |
| Solution content |
|---|
private void updateJpegQualitySummary() {
mJpegQuality.setSummary(mJpegQuality.getEntry());
}
private void updateFocusModeSummary() {
mFocusMode.setSummary(mFocusMode.getEntry());
}
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, |
| File |
|---|
| CameraSettings.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
updatePictureSizeSummary();
} else if (key.equals(KEY_JPEG_QUALITY)) {
updateJpegQualitySummary();
<<<<<<< HEAD
=======
} else if (key.equals(KEY_FOCUS_MODE)) {
updateFocusModeSummary();
} else if (key.equals(KEY_BRIGHTNESS)) {
updateBrightnessSummary();
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
}
} |
| Solution content |
|---|
updatePictureSizeSummary();
} else if (key.equals(KEY_JPEG_QUALITY)) {
updateJpegQualitySummary();
} else if (key.equals(KEY_FOCUS_MODE)) {
updateFocusModeSummary();
} else if (key.equals(KEY_BRIGHTNESS)) {
updateBrightnessSummary();
}
}
} |
| File |
|---|
| CameraSettings.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
try {
Intent intent = getIntent();
Bundle extras = intent.getExtras();
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "extras are " + extras);
}
if (extras != null) {
for (String s : extras.keySet()) {
if (Config.LOGV) {
Log.v(TAG, "" + s + " >>> " + extras.get(s));
}
}
=======
if (extras != null) {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
if (extras.getString("circleCrop") != null) {
mCircleCrop = true;
mAspectX = 1; |
| Solution content |
|---|
try {
Intent intent = getIntent();
Bundle extras = intent.getExtras();
if (extras != null) {
if (extras.getString("circleCrop") != null) {
mCircleCrop = true;
mAspectX = 1; |
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| For statement |
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
if (mBitmap == null) {
Uri target = intent.getData();
<<<<<<< HEAD
mAllImages = ImageManager.makeImageList(target, CropImage.this,
ImageManager.SORT_ASCENDING);
=======
mAllImages = ImageManager.makeImageList(target,
mContentResolver, ImageManager.SORT_ASCENDING);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mImage = mAllImages.getImageForUri(target);
if (mImage != null) {
// don't read in really large bitmaps. max out at 1000. |
| Solution content |
|---|
if (mBitmap == null) {
Uri target = intent.getData();
mAllImages = ImageManager.makeImageList(target,
mContentResolver, ImageManager.SORT_ASCENDING);
mImage = mAllImages.getImageForUri(target);
if (mImage != null) {
// don't read in really large bitmaps. max out at 1000. |
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
// TODO when saving the resulting bitmap use the
// decode/crop/encode api so we don't lose any resolution.
mBitmap = mImage.thumbBitmap();
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "thumbBitmap returned " + mBitmap);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
} |
| Solution content |
|---|
// TODO when saving the resulting bitmap use the
// decode/crop/encode api so we don't lose any resolution.
mBitmap = mImage.thumbBitmap();
}
}
|
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
true, false);
mImageView.setImageBitmapResetBase(mBitmap, true);
if (mImageView.getScale() == 1F) {
<<<<<<< HEAD
mImageView.center(true, true, false);
=======
mImageView.center(true, true);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
new Thread(new Runnable() { |
| Solution content |
|---|
true, false);
mImageView.setImageBitmapResetBase(mBitmap, true);
if (mImageView.getScale() == 1F) {
mImageView.center(true, true);
}
new Thread(new Runnable() { |
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
final Bitmap b = (mImage != null)
? mImage.fullSizeBitmap(500)
: mBitmap;
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "back from fullSizeBitmap(500) "
+ "with bitmap of size " + b.getWidth()
+ " / " + b.getHeight());
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mHandler.post(new Runnable() {
public void run() {
if (b != mBitmap && b != null) { |
| Solution content |
|---|
final Bitmap b = (mImage != null)
? mImage.fullSizeBitmap(500)
: mBitmap;
mHandler.post(new Runnable() {
public void run() {
if (b != mBitmap && b != null) { |
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
mImageView.setImageBitmapResetBase(b, true);
}
if (mImageView.getScale() == 1F) {
<<<<<<< HEAD
mImageView.center(true, true, false);
=======
mImageView.center(true, true);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
new Thread(mRunFaceDetection).start(); |
| Solution content |
|---|
mImageView.setImageBitmapResetBase(b, true);
}
if (mImageView.getScale() == 1F) {
mImageView.center(true, true);
}
new Thread(mRunFaceDetection).start(); |
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
mSaving = true;
if (mCroppedImage == null) {
if (mCrop == null) {
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "no cropped image...");
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
return;
}
|
| Solution content |
|---|
mSaving = true;
if (mCroppedImage == null) {
if (mCrop == null) {
return;
}
|
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
if (mOutputX != 0 && mOutputY != 0) {
if (mScale) {
/* Scale the image to the required dimensions */
<<<<<<< HEAD
mCroppedImage = ImageLoader.transform(new Matrix(),
=======
mCroppedImage = Util.transform(new Matrix(),
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mCroppedImage, mOutputX, mOutputY, mScaleUp);
} else {
|
| Solution content |
|---|
if (mOutputX != 0 && mOutputY != 0) {
if (mScale) {
/* Scale the image to the required dimensions */
mCroppedImage = Util.transform(new Matrix(),
mCroppedImage, mOutputX, mOutputY, mScaleUp);
} else {
|
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
outputStream);
}
} catch (IOException ex) {
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "got IOException " + ex);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
} finally {
if (outputStream != null) {
try { |
| Solution content |
|---|
outputStream);
}
} catch (IOException ex) {
} finally {
if (outputStream != null) {
try { |
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
x += 1;
String candidate = directory.toString()
+ "/" + fileName + "-" + x + ".jpg";
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "candidate is " + candidate);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
boolean exists =
(new java.io.File(candidate)).exists();
if (!exists) { |
| Solution content |
|---|
x += 1;
String candidate = directory.toString()
+ "/" + fileName + "-" + x + ".jpg";
boolean exists =
(new java.io.File(candidate)).exists();
if (!exists) { |
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
}
try {
<<<<<<< HEAD
Uri newUri = ImageManager.instance().addImage(
CropImage.this,
=======
Uri newUri = ImageManager.addImage(
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
getContentResolver(),
mImage.getTitle(),
mImage.getDateTaken(), |
| Solution content |
|---|
}
try {
Uri newUri = ImageManager.addImage(
getContentResolver(),
mImage.getTitle(),
mImage.getDateTaken(), |
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
fileName + "-" + x + ".jpg");
ICancelable |
| Solution content |
|---|
fileName + "-" + x + ".jpg");
ICancelable |
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
<<<<<<< HEAD
center(true, true, true);
=======
center(true, true);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
break;
case MotionEvent.ACTION_MOVE:
// if we're not zoomed then there's no point in even allowing |
| Solution content |
|---|
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
center(true, true);
break;
case MotionEvent.ACTION_MOVE:
// if we're not zoomed then there's no point in even allowing |
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
// it back to the normalized location (with false meaning don't
// animate).
if (getScale() == 1F) {
<<<<<<< HEAD
center(true, true, false);
=======
center(true, true);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
break;
} |
| Solution content |
|---|
// it back to the normalized location (with false meaning don't
// animate).
if (getScale() == 1F) {
center(true, true);
}
break;
} |
| File |
|---|
| CropImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
sb.append(val);
}
String s = sb.toString();
<<<<<<< HEAD
if (android.util.Config.LOGV) {
android.util.Log.v("camera", "saving exif data: " + s);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
saveAttributesNative(mFilename, s);
commitChangesNative(mFilename);
mSavedAttributes = true; |
| Solution content |
|---|
sb.append(val);
}
String s = sb.toString();
saveAttributesNative(mFilename, s);
commitChangesNative(mFilename);
mSavedAttributes = true; |
| File |
|---|
| ExifInterface.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
return mHasThumbnail;
}
<<<<<<< HEAD
/**
* Saves the changes (added Exif tags, added thumbnail) to the JPG file.
* You have to call saveAttributes() before committing the changes.
*/
public void commitChanges() {
if (!mSavedAttributes) {
throw new RuntimeException("Must call saveAttributes "
+ "before calling commitChanges");
}
commitChangesNative(mFilename);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
public boolean hasThumbnail() {
if (!mSavedAttributes) {
getAttributes(); |
| Solution content |
|---|
return mHasThumbnail;
}
public boolean hasThumbnail() {
if (!mSavedAttributes) {
getAttributes(); |
| File |
|---|
| ExifInterface.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
// This is called when we receive media-related broadcast.
private void onReceiveMediaBroadcast(Intent intent) {
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "onReceiveMediaBroadcast " + intent.getAction());
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
String action = intent.getAction();
if (action.equals(Intent.ACTION_MEDIA_MOUNTED)) {
// SD card available |
| Solution content |
|---|
// This is called when we receive media-related broadcast.
private void onReceiveMediaBroadcast(Intent intent) {
String action = intent.getAction();
if (action.equals(Intent.ACTION_MEDIA_MOUNTED)) {
// SD card available |
| File |
|---|
| GalleryPicker.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
// TODO also listen for the media scanner finished message
} else if (action.equals(Intent.ACTION_MEDIA_UNMOUNTED)) {
// SD card unavailable
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "sd card no longer available");
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
Toast.makeText(GalleryPicker.this,
getResources().getString(R.string.wait), 5000);
rebake(true, false); |
| Solution content |
|---|
// TODO also listen for the media scanner finished message
} else if (action.equals(Intent.ACTION_MEDIA_UNMOUNTED)) {
// SD card unavailable
Toast.makeText(GalleryPicker.this,
getResources().getString(R.string.wait), 5000);
rebake(true, false); |
| File |
|---|
| GalleryPicker.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
<<<<<<< HEAD
rebake(false, true);
} else if (action.equals(
Intent.ACTION_MEDIA_SCANNER_FINISHED)) {
if (Config.LOGV) {
Log.v(TAG, "rebake because of "
+ "ACTION_MEDIA_SCANNER_FINISHED");
}
rebake(false, false);
} else if (action.equals(Intent.ACTION_MEDIA_EJECT)) {
if (Config.LOGV) {
Log.v(TAG, "rebake because of ACTION_MEDIA_EJECT");
}
=======
rebake(false, false);
} else if (action.equals(Intent.ACTION_MEDIA_EJECT)) {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
rebake(true, false);
}
} |
| Solution content |
|---|
rebake(false, true);
} else if (action.equals(
Intent.ACTION_MEDIA_SCANNER_FINISHED)) {
rebake(false, false);
} else if (action.equals(Intent.ACTION_MEDIA_EJECT)) {
rebake(true, false);
}
} |
| File |
|---|
| GalleryPicker.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
if (mWorkerThread != null) {
try {
mDone = true;
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "about to call join on thread "
+ mWorkerThread.getId());
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mWorkerThread.join();
} finally {
mWorkerThread = null; |
| Solution content |
|---|
if (mWorkerThread != null) {
try {
mDone = true;
mWorkerThread.join();
} finally {
mWorkerThread = null; |
| File |
|---|
| GalleryPicker.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
temp = newMap;
}
<<<<<<< HEAD
Bitmap temp2 = ImageLoader.transform(m, temp, imageWidth,
imageHeight, true);
=======
Bitmap temp2 = Util.transform(m, temp, imageWidth,
imageHeight, true);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
if (temp2 != temp) {
temp.recycle();
} |
| Solution content |
|---|
temp = newMap;
}
Bitmap temp2 = Util.transform(m, temp, imageWidth,
imageHeight, true);
if (temp2 != temp) {
temp.recycle();
} |
| File |
|---|
| GalleryPicker.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
private IImageList createImageList(int mediaTypes, String bucketId) {
<<<<<<< HEAD
return ImageManager.instance().allImages(
this,
=======
return ImageManager.allImages(
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
getContentResolver(),
ImageManager.DataLocation.ALL,
mediaTypes, |
| Solution content |
|---|
}
private IImageList createImageList(int mediaTypes, String bucketId) {
return ImageManager.allImages(
getContentResolver(),
ImageManager.DataLocation.ALL,
mediaTypes, |
| File |
|---|
| GalleryPicker.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Return statement |
| Chunk |
|---|
| Conflicting content |
|---|
public GalleryPickerItem(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
<<<<<<< HEAD
public GalleryPickerItem(Context context,
AttributeSet attrs,
=======
public GalleryPickerItem(Context context,
AttributeSet attrs,
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
int defStyle) {
super(context, attrs, defStyle);
|
| Solution content |
|---|
public GalleryPickerItem(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public GalleryPickerItem(Context context,
AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
|
| File |
|---|
| GalleryPickerItem.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
@Override
protected boolean verifyDrawable(Drawable who) {
<<<<<<< HEAD
return super.verifyDrawable(who) || (who == mFrame)
=======
return super.verifyDrawable(who) || (who == mFrame)
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
|| (who == mOverlay);
}
|
| Solution content |
|---|
@Override
protected boolean verifyDrawable(Drawable who) {
return super.verifyDrawable(who) || (who == mFrame)
|| (who == mOverlay);
}
|
| File |
|---|
| GalleryPickerItem.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Attribute |
| Method invocation |
| Return statement |
| Chunk |
|---|
| Conflicting content |
|---|
import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.content.res.Configuration; <<<<<<< HEAD ======= import android.content.res.Resources; >>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; |
| Solution content |
|---|
import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
import android.os.PowerManager; import android.preference.PreferenceManager; import android.provider.MediaStore; <<<<<<< HEAD import android.util.AttributeSet; import android.util.Config; import android.util.Log; import android.view.ContextMenu; import android.view.GestureDetector; ======= import android.util.Log; import android.view.ContextMenu; >>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; |
| Solution content |
|---|
import android.os.PowerManager; import android.preference.PreferenceManager; import android.provider.MediaStore; import android.util.Log; import android.view.ContextMenu; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
import android.widget.Scroller;
import android.widget.TextView;
import android.widget.Toast;
<<<<<<< HEAD
import java.util.Calendar;
import java.util.GregorianCalendar;
public class ImageGallery2 extends Activity {
=======
public class ImageGallery2 extends Activity implements GridViewSpecial.Listener {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
private static final String TAG = "ImageGallery2";
IImageList mAllImages;
private int mInclusion; |
| Solution content |
|---|
import android.widget.TextView;
import android.widget.Toast;
public class ImageGallery2 extends Activity implements GridViewSpecial.Listener {
private static final String TAG = "ImageGallery2";
IImageList mAllImages;
private int mInclusion; |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Class signature |
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.custom_gallery_title);
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "findView... " + findViewById(R.id.loading_indicator));
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mGvs = (GridViewSpecial) findViewById(R.id.grid);
mGvs.requestFocus(); |
| Solution content |
|---|
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.custom_gallery_title);
mGvs = (GridViewSpecial) findViewById(R.id.grid);
mGvs.requestFocus(); |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
}
public boolean onSlideShowClicked() {
<<<<<<< HEAD
IImage img = mSelectedImageGetter.getCurrentImage();
=======
IImage img = getCurrentImage();
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
if (img == null) {
img = mAllImages.getImageAt(0);
if (img == null) { |
| Solution content |
|---|
}
public boolean onSlideShowClicked() {
IImage img = getCurrentImage();
if (img == null) {
img = mAllImages.getImageAt(0);
if (img == null) { |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
};
<<<<<<< HEAD
private SelectedImageGetter mSelectedImageGetter =
new SelectedImageGetter() {
public Uri getCurrentImageUri() {
IImage image = getCurrentImage();
if (image != null) {
return image.fullSizeImageUri();
} else {
return null;
}
}
public IImage getCurrentImage() {
int currentSelection = mGvs.mCurrentSelection;
if (currentSelection < 0
|| currentSelection >= mAllImages.getCount()) {
return null;
} else {
return mAllImages.getImageAt(currentSelection);
}
}
};
=======
private Uri getCurrentImageUri() {
IImage image = getCurrentImage();
if (image != null) {
return image.fullSizeImageUri();
} else {
return null;
}
}
private IImage getCurrentImage() {
int currentSelection = mGvs.mCurrentSelection;
if (currentSelection < 0
|| currentSelection >= mAllImages.getCount()) {
return null;
} else {
return mAllImages.getImageAt(currentSelection);
}
}
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
@Override
public void onConfigurationChanged(Configuration newConfig) { |
| Solution content |
|---|
}
};
private Uri getCurrentImageUri() {
IImage image = getCurrentImage();
if (image != null) {
return image.fullSizeImageUri();
} else {
return null;
}
}
private IImage getCurrentImage() {
int currentSelection = mGvs.mCurrentSelection;
if (currentSelection < 0
|| currentSelection >= mAllImages.getCount()) {
return null;
} else {
return mAllImages.getImageAt(currentSelection);
}
}
@Override
public void onConfigurationChanged(Configuration newConfig) { |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
mTargetScroll = mGvs.getScrollY();
}
<<<<<<< HEAD
private Runnable mLongPressCallback = new Runnable() {
public void run() {
mGvs.select(-2, false);
mGvs.showContextMenu();
}
};
boolean canHandleEvent() {
// Don't process event in pause state.
return (!mPausing) && (mGvs.mCurrentSpec != null);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (!canHandleEvent()) return false;
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
mGvs.select(-2, false);
// The keyUp doesn't get called when the longpress menu comes up. We
// only get here when the user lets go of the center key before the
// longpress menu comes up.
mHandler.removeCallbacks(mLongPressCallback);
// open the photo
if (mSelectedImageGetter.getCurrentImage() != null) {
mGvs.onSelect(mGvs.mCurrentSelection);
}
return true;
}
return super.onKeyUp(keyCode, event);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (!canHandleEvent()) return false;
boolean handled = true;
int sel = mGvs.mCurrentSelection;
int columns = mGvs.mCurrentSpec.mColumns;
int count = mAllImages.getCount();
boolean pressed = false;
if (mGvs.mShowSelection) {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_RIGHT:
if (sel != count && (sel % columns < columns - 1)) {
sel += 1;
}
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
if (sel > 0 && (sel % columns != 0)) {
sel -= 1;
}
break;
case KeyEvent.KEYCODE_DPAD_UP:
if ((sel / columns) != 0) {
sel -= columns;
}
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
if ((sel / columns) != (sel + columns / columns)) {
sel = Math.min(count - 1, sel + columns);
}
break;
case KeyEvent.KEYCODE_DPAD_CENTER:
pressed = true;
mHandler.postDelayed(mLongPressCallback,
ViewConfiguration.getLongPressTimeout());
break;
case KeyEvent.KEYCODE_DEL:
MenuHelper.deleteImage(this, mDeletePhotoRunnable,
mSelectedImageGetter.getCurrentImage());
break;
default:
handled = false;
break;
}
} else {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_RIGHT:
case KeyEvent.KEYCODE_DPAD_LEFT:
case KeyEvent.KEYCODE_DPAD_UP:
case KeyEvent.KEYCODE_DPAD_DOWN:
int [] range = new int[2];
GridViewSpecial.ImageBlockManager ibm =
mGvs.mImageBlockManager;
if (ibm != null) {
mGvs.mImageBlockManager.getVisibleRange(range);
int topPos = range[0];
android.graphics.Rect r =
mGvs.getRectForPosition(topPos);
if (r.top < mGvs.getScrollY()) {
topPos += columns;
}
topPos = Math.min(count - 1, topPos);
sel = topPos;
}
break;
default:
handled = false;
break;
}
}
if (handled) {
mGvs.select(sel, pressed);
return true;
} else {
return super.onKeyDown(keyCode, event);
}
=======
boolean canHandleEvent() {
// Don't process event in pause state.
return (!mPausing) && (mLayoutComplete);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (!canHandleEvent()) return false;
switch (keyCode) {
case KeyEvent.KEYCODE_DEL:
MenuHelper.deleteImage(
this, mDeletePhotoRunnable, getCurrentImage());
return true;
}
return super.onKeyDown(keyCode, event);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
boolean isPickIntent() { |
| Solution content |
|---|
mTargetScroll = mGvs.getScrollY();
}
boolean canHandleEvent() {
// Don't process event in pause state.
return (!mPausing) && (mLayoutComplete);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (!canHandleEvent()) return false;
switch (keyCode) {
case KeyEvent.KEYCODE_DEL:
MenuHelper.deleteImage(
this, mDeletePhotoRunnable, getCurrentImage());
return true;
}
return super.onKeyDown(keyCode, event);
}
|
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Return statement |
| Switch statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
|| Intent.ACTION_GET_CONTENT.equals(action));
}
<<<<<<< HEAD
void launchCropperOrFinish(IImage img) {
=======
private void launchCropperOrFinish(IImage img) {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
Bundle myExtras = getIntent().getExtras();
long size = MenuHelper.getImageFileSize(img); |
| Solution content |
|---|
|| Intent.ACTION_GET_CONTENT.equals(action));
}
private void launchCropperOrFinish(IImage img) {
Bundle myExtras = getIntent().getExtras();
long size = MenuHelper.getImageFileSize(img); |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "onActivityResult: " + requestCode
+ "; resultCode is " + resultCode + "; data is " + data);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
switch (requestCode) {
case MenuHelper.RESULT_COMMON_MENU_CROP: {
if (resultCode == RESULT_OK) { |
| Solution content |
|---|
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
switch (requestCode) {
case MenuHelper.RESULT_COMMON_MENU_CROP: {
if (resultCode == RESULT_OK) { |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
break;
}
case VIEW_MSG: {
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "got VIEW_MSG with " + data);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
IImage img = mAllImages.getImageForUri(data.getData());
launchCropperOrFinish(img);
break; |
| Solution content |
|---|
break;
}
case VIEW_MSG: {
IImage img = mAllImages.getImageForUri(data.getData());
launchCropperOrFinish(img);
break; |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
mAllImages = ImageManager.emptyImageList();
} else {
mAllImages = allImages(!unmounted);
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "mAllImages is now " + mAllImages);
}
=======
mGvs.setImageList(mAllImages);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mGvs.init(mHandler);
mGvs.start();
mGvs.requestLayout(); |
| Solution content |
|---|
mAllImages = ImageManager.emptyImageList();
} else {
mAllImages = allImages(!unmounted);
mGvs.setImageList(mAllImages);
mGvs.init(mHandler);
mGvs.start();
mGvs.requestLayout(); |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
super.onResume();
BitmapManager.instance().allowAllDecoding();
<<<<<<< HEAD
try {
mGvs.setSizeChoice(Integer.parseInt(
mPrefs.getString("pref_gallery_size_key", "1")),
mTargetScroll);
String sortOrder = mPrefs.getString("pref_gallery_sort_key", null);
if (sortOrder != null) {
mSortAscending = sortOrder.equals("ascending");
}
} catch (RuntimeException ex) {
=======
mGvs.setSizeChoice(Integer.parseInt(
mPrefs.getString("pref_gallery_size_key", "1")),
mTargetScroll);
mGvs.requestFocus();
String sortOrder = mPrefs.getString("pref_gallery_sort_key", null);
if (sortOrder != null) {
mSortAscending = sortOrder.equals("ascending");
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
mPausing = false; |
| Solution content |
|---|
super.onResume();
BitmapManager.instance().allowAllDecoding();
mGvs.setSizeChoice(Integer.parseInt(
mPrefs.getString("pref_gallery_size_key", "1")),
mTargetScroll);
mGvs.requestFocus();
String sortOrder = mPrefs.getString("pref_gallery_sort_key", null);
if (sortOrder != null) {
mSortAscending = sortOrder.equals("ascending");
}
mPausing = false; |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Catch clause |
| If statement |
| Method invocation |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "onReceiveIntent " + intent.getAction());
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
String action = intent.getAction();
if (action.equals(Intent.ACTION_MEDIA_MOUNTED)) {
// SD card available |
| Solution content |
|---|
mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(Intent.ACTION_MEDIA_MOUNTED)) {
// SD card available |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
// TODO also listen for the media scanner finished message
} else if (action.equals(Intent.ACTION_MEDIA_UNMOUNTED)) {
// SD card unavailable
<<<<<<< HEAD
if (Config.LOGV) Log.v(TAG, "sd card no longer available");
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
Toast.makeText(ImageGallery2.this,
getResources().getString(R.string.wait), 5000);
rebake(true, false); |
| Solution content |
|---|
// TODO also listen for the media scanner finished message
} else if (action.equals(Intent.ACTION_MEDIA_UNMOUNTED)) {
// SD card unavailable
Toast.makeText(ImageGallery2.this,
getResources().getString(R.string.wait), 5000);
rebake(true, false); |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
rebake(false, true);
} else if (action.equals(
Intent.ACTION_MEDIA_SCANNER_FINISHED)) {
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "rebake because of "
+ "ACTION_MEDIA_SCANNER_FINISHED");
}
rebake(false, false);
} else if (action.equals(Intent.ACTION_MEDIA_EJECT)) {
if (Config.LOGV) {
Log.v(TAG, "rebake because of ACTION_MEDIA_EJECT");
}
=======
rebake(false, false);
} else if (action.equals(Intent.ACTION_MEDIA_EJECT)) {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
rebake(true, false);
}
} |
| Solution content |
|---|
rebake(false, true);
} else if (action.equals(
Intent.ACTION_MEDIA_SCANNER_FINISHED)) {
rebake(false, false);
} else if (action.equals(Intent.ACTION_MEDIA_EJECT)) {
rebake(true, false);
}
} |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
};
registerReceiver(mReceiver, intentFilter);
<<<<<<< HEAD
rebake(false, ImageManager.isMediaScannerScanning(this));
=======
rebake(false, ImageManager.isMediaScannerScanning(
getContentResolver()));
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
private void stopCheckingThumbnails() { |
| Solution content |
|---|
}
};
registerReceiver(mReceiver, intentFilter);
rebake(false, ImageManager.isMediaScannerScanning(
getContentResolver()));
}
private void stopCheckingThumbnails() { |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
private void checkThumbnails() {
final long startTime = System.currentTimeMillis();
<<<<<<< HEAD
final long t1 = System.currentTimeMillis();
mThumbnailCheckThread = new BitmapThread(new Runnable() {
public void run() {
android.content.res.Resources resources = getResources();
final TextView progressTextView =
(TextView) findViewById(R.id.loading_text);
final String progressTextFormatString =
resources.getString(
R.string.loading_progress_format_string);
PowerManager pm =
(PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock mWakeLock =
pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
"ImageGallery2.checkThumbnails");
mWakeLock.acquire();
IImageList.ThumbCheckCallback r =
new IImageList.ThumbCheckCallback() {
boolean mDidSetProgress = false;
public boolean checking(final int count,
final int maxCount) {
if (mStopThumbnailChecking) {
return false;
}
if (!mLayoutComplete) {
return true;
}
if (!mDidSetProgress) {
mHandler.post(new Runnable() {
public void run() {
findViewById(
R.id.loading_indicator)
.setVisibility(View.VISIBLE);
}
});
mDidSetProgress = true;
}
mGvs.postInvalidate();
if (System.currentTimeMillis()
- startTime > 1000) {
mHandler.post(new Runnable() {
public void run() {
String s = String.format(
progressTextFormatString,
maxCount - count);
progressTextView.setText(s);
}
});
}
return !mPausing;
}
};
=======
mThumbnailCheckThread = new BitmapThread(new Runnable() {
public void run() {
Resources resources = getResources();
TextView progressTextView =
(TextView) findViewById(R.id.loading_text);
String progressTextFormatString =
resources.getString(
R.string.loading_progress_format_string);
PowerManager pm = (PowerManager)
getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock mWakeLock = pm.newWakeLock(
PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
"ImageGallery2.checkThumbnails");
mWakeLock.acquire();
IImageList.ThumbCheckCallback r = new MyThumbCheckCallback(
progressTextView, startTime, progressTextFormatString);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
IImageList imageList = allImages(true);
imageList.checkThumbnails(r, imageList.getCount());
mWakeLock.release(); |
| Solution content |
|---|
private void checkThumbnails() {
final long startTime = System.currentTimeMillis();
mThumbnailCheckThread = new BitmapThread(new Runnable() {
public void run() {
Resources resources = getResources();
TextView progressTextView =
(TextView) findViewById(R.id.loading_text);
String progressTextFormatString =
resources.getString(
R.string.loading_progress_format_string);
PowerManager pm = (PowerManager)
getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock mWakeLock = pm.newWakeLock(
PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
"ImageGallery2.checkThumbnails");
mWakeLock.acquire();
IImageList.ThumbCheckCallback r = new MyThumbCheckCallback(
progressTextView, startTime, progressTextFormatString);
IImageList imageList = allImages(true);
imageList.checkThumbnails(r, imageList.getCount());
mWakeLock.release(); |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
View.GONE);
}
});
<<<<<<< HEAD
long t2 = System.currentTimeMillis();
if (Config.LOGV) {
Log.v(TAG, "check thumbnails thread finishing; took "
+ (t2 - t1));
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
});
|
| Solution content |
|---|
View.GONE);
}
});
}
});
|
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
return (image != null) && ImageManager.isVideo(image);
}
<<<<<<< HEAD
=======
private boolean isImageType(String type) {
return type.equals("vnd.android.cursor.dir/image")
|| type.equals("image/*");
}
private boolean isVideoType(String type) {
return type.equals("vnd.android.cursor.dir/video")
|| type.equals("video/*");
}
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
private synchronized IImageList allImages(boolean assumeMounted) {
if (mAllImages == null) {
mNoImagesView = findViewById(R.id.no_images); |
| Solution content |
|---|
return (image != null) && ImageManager.isVideo(image);
}
private boolean isImageType(String type) {
return type.equals("vnd.android.cursor.dir/image")
|| type.equals("image/*");
}
private boolean isVideoType(String type) {
return type.equals("vnd.android.cursor.dir/video")
|| type.equals("video/*");
}
private synchronized IImageList allImages(boolean assumeMounted) {
if (mAllImages == null) {
mNoImagesView = findViewById(R.id.no_images); |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
Intent intent = getIntent();
if (intent != null) {
String type = intent.resolveType(this);
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "allImages... type is " + type);
}
TextView leftText = (TextView) findViewById(R.id.left_text);
if (type != null) {
if (type.equals("vnd.android.cursor.dir/image")
|| type.equals("image/*")) {
=======
TextView leftText = (TextView) findViewById(R.id.left_text);
if (type != null) {
if (isImageType(type)) {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mInclusion = ImageManager.INCLUDE_IMAGES;
if (isPickIntent()) {
leftText.setText( |
| Solution content |
|---|
Intent intent = getIntent();
if (intent != null) {
String type = intent.resolveType(this);
TextView leftText = (TextView) findViewById(R.id.left_text);
if (type != null) {
if (isImageType(type)) {
mInclusion = ImageManager.INCLUDE_IMAGES;
if (isPickIntent()) {
leftText.setText( |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Cast expression |
| If statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
leftText.setText(R.string.photos_gallery_title);
}
}
<<<<<<< HEAD
if (type.equals("vnd.android.cursor.dir/video")
|| type.equals("video/*")) {
=======
if (isVideoType(type)) {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mInclusion = ImageManager.INCLUDE_VIDEOS;
if (isPickIntent()) {
leftText.setText( |
| Solution content |
|---|
leftText.setText(R.string.photos_gallery_title);
}
}
if (isVideoType(type)) {
mInclusion = ImageManager.INCLUDE_VIDEOS;
if (isPickIntent()) {
leftText.setText( |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
mInclusion = ImageManager.INCLUDE_DRM_IMAGES;
}
}
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "computing images... mSortAscending is "
+ mSortAscending + "; assumeMounted is "
+ assumeMounted);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
Uri uri = getIntent().getData();
if (!assumeMounted) {
mAllImages = ImageManager.emptyImageList(); |
| Solution content |
|---|
mInclusion = ImageManager.INCLUDE_DRM_IMAGES;
}
}
Uri uri = getIntent().getData();
if (!assumeMounted) {
mAllImages = ImageManager.emptyImageList(); |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
return mAllImages;
}
<<<<<<< HEAD
private class CreateContextMenuListener implements
View.OnCreateContextMenuListener {
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenu.ContextMenuInfo menuInfo) {
if (mSelectedImageGetter.getCurrentImage() == null) {
return;
}
boolean isImage = ImageManager.isImage(
mSelectedImageGetter.getCurrentImage());
if (isImage) {
menu.add(0, 0, 0, R.string.view).setOnMenuItemClickListener(
new MenuItem.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
mGvs.onSelect(mGvs.mCurrentSelection);
return true;
}
});
}
menu.setHeaderTitle(isImage
? R.string.context_menu_header
: R.string.video_context_menu_header);
if ((mInclusion & (ImageManager.INCLUDE_IMAGES
| ImageManager.INCLUDE_VIDEOS)) != 0) {
MenuHelper.MenuItemsResult r = MenuHelper.addImageMenuItems(
menu,
MenuHelper.INCLUDE_ALL,
isImage,
ImageGallery2.this,
mHandler,
mDeletePhotoRunnable,
new MenuHelper.MenuInvoker() {
public void run(MenuHelper.MenuCallback cb) {
cb.run(mSelectedImageGetter
.getCurrentImageUri(),
mSelectedImageGetter.getCurrentImage());
mGvs.clearCache();
mGvs.invalidate();
mGvs.requestLayout();
mGvs.start();
mNoImagesView.setVisibility(
mAllImages.getCount() > 0
? View.GONE
: View.VISIBLE);
}
}
}
});
if (r != null) {
r.gettingReadyToOpen(menu,
mSelectedImageGetter.getCurrentImage());
}
if (isImage) {
addSlideShowMenu(menu, 1000);
}
}
}
}
}
class GridViewSpecial extends View {
private static final String TAG = "GridViewSpecial";
ImageGallery2 mGallery;
private Paint mGridViewPaint = new Paint();
ImageBlockManager mImageBlockManager;
private Handler mHandler;
LayoutSpec mCurrentSpec;
boolean mShowSelection = false;
int mCurrentSelection = -1;
private boolean mCurrentSelectionPressed;
private boolean mDirectionBiasDown = true;
private static final boolean DUMP = false;
long mVideoSizeLimit;
class LayoutSpec {
LayoutSpec(int cols, int w, int h, int leftEdgePadding,
int rightEdgePadding, int intercellSpacing) {
mColumns = cols;
mCellWidth = w;
mCellHeight = h;
mLeftEdgePadding = leftEdgePadding;
mRightEdgePadding = rightEdgePadding;
mCellSpacing = intercellSpacing;
}
int mColumns;
int mCellWidth, mCellHeight;
int mLeftEdgePadding, mRightEdgePadding;
int mCellSpacing;
}
private LayoutSpec [] mCellSizeChoices = new LayoutSpec[] {
new LayoutSpec(0, 67, 67, 14, 14, 8),
new LayoutSpec(0, 92, 92, 14, 14, 8),
};
private int mSizeChoice = 1;
// Use a number like 100 or 200 here to allow the user to
// overshoot the start (top) or end (bottom) of the gallery.
// After overshooting the gallery will animate back to the
// appropriate location.
private int mMaxOvershoot = 0; // 100;
private int mMaxScrollY;
private int mMinScrollY;
private boolean mFling = true;
private Scroller mScroller = null;
private GestureDetector mGestureDetector;
public void dump() {
if (Config.LOGV){
Log.v(TAG, "mSizeChoice is " + mCellSizeChoices[mSizeChoice]);
Log.v(TAG, "mCurrentSpec.width / mCellHeight are "
+ mCurrentSpec.mCellWidth + " / "
+ mCurrentSpec.mCellHeight);
}
mImageBlockManager.dump();
}
private void init(Context context) {
mGridViewPaint.setColor(0xFF000000);
mGallery = (ImageGallery2) context;
setVerticalScrollBarEnabled(true);
initializeScrollbars(context.obtainStyledAttributes(
android.R.styleable.View));
mGestureDetector = new GestureDetector(context,
new SimpleOnGestureListener() {
@Override
public boolean onDown(MotionEvent e) {
if (mScroller != null && !mScroller.isFinished()) {
mScroller.forceFinished(true);
return false;
}
int pos = computeSelectedIndex(e);
if (pos >= 0 && pos < mGallery.mAllImages.getCount()) {
select(pos, true);
} else {
select(-1, false);
if (mImageBlockManager != null) {
mImageBlockManager.repaintSelection(mCurrentSelection);
}
invalidate();
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2,
float velocityX, float velocityY) {
final float maxVelocity = 2500;
if (velocityY > maxVelocity) {
velocityY = maxVelocity;
} else if (velocityY < -maxVelocity) {
velocityY = -maxVelocity;
}
select(-1, false);
if (mFling) {
mScroller = new Scroller(getContext());
mScroller.fling(0, mScrollY, 0, -(int) velocityY, 0, 0, 0,
mMaxScrollY);
computeScroll();
}
return true;
}
@Override
public void onLongPress(MotionEvent e) {
performLongClick();
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2,
float distanceX, float distanceY) {
select(-1, false);
scrollBy(0, (int) distanceY);
invalidate();
return true;
}
@Override
public boolean onSingleTapUp(MotionEvent e) {
select(mCurrentSelection, false);
int index = computeSelectedIndex(e);
if (index >= 0 && index < mGallery.mAllImages.getCount()) {
onSelect(index);
return true;
}
return false;
}
});
// mGestureDetector.setIsLongpressEnabled(false);
}
public GridViewSpecial(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context);
}
public GridViewSpecial(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public GridViewSpecial(Context context) {
super(context);
init(context);
}
@Override
protected int computeVerticalScrollRange() {
return mMaxScrollY + getHeight();
}
public void setSizeChoice(int choice, int scrollY) {
mSizeChoice = choice;
clearCache();
scrollTo(0, scrollY);
requestLayout();
invalidate();
}
/**
*
* @param newSel -2 means use old selection, -1 means remove selection
* @param newPressed
*/
public void select(int newSel, boolean newPressed) {
if (newSel == -2) {
newSel = mCurrentSelection;
}
int oldSel = mCurrentSelection;
if ((oldSel == newSel) && (mCurrentSelectionPressed == newPressed)) {
return;
}
mShowSelection = (newSel != -1);
mCurrentSelection = newSel;
mCurrentSelectionPressed = newPressed;
if (mImageBlockManager != null) {
mImageBlockManager.repaintSelection(oldSel);
mImageBlockManager.repaintSelection(newSel);
if (newSel != -1) {
ensureVisible(newSel);
}
}
private void ensureVisible(int pos) {
android.graphics.Rect r = getRectForPosition(pos);
int top = getScrollY();
int bot = top + getHeight();
if (r.bottom > bot) {
mScroller = new Scroller(getContext());
mScroller.startScroll(mScrollX, mScrollY, 0,
r.bottom - getHeight() - mScrollY, 200);
computeScroll();
} else if (r.top < top) {
mScroller = new Scroller(getContext());
mScroller.startScroll(mScrollX, mScrollY, 0, r.top - mScrollY, 200);
computeScroll();
}
invalidate();
}
public void start() {
if (mGallery.mLayoutComplete) {
if (mImageBlockManager == null) {
mImageBlockManager = new ImageBlockManager();
mImageBlockManager.moveDataWindow(true, true);
}
}
}
public void onPause() {
mScroller = null;
if (mImageBlockManager != null) {
mImageBlockManager.onPause();
mImageBlockManager = null;
}
}
public void clearCache() {
if (mImageBlockManager != null) {
mImageBlockManager.onPause();
mImageBlockManager = null;
}
}
@Override
public void onLayout(boolean changed, int left, int top,
int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (mGallery.isFinishing() || mGallery.mPausing) {
return;
}
clearCache();
mCurrentSpec = mCellSizeChoices[mSizeChoice];
int oldColumnCount = mCurrentSpec.mColumns;
int width = right - left;
mCurrentSpec.mColumns = 1;
width -= mCurrentSpec.mCellWidth;
mCurrentSpec.mColumns += width
/ (mCurrentSpec.mCellWidth + mCurrentSpec.mCellSpacing);
mCurrentSpec.mLeftEdgePadding = ((right - left)
- ((mCurrentSpec.mColumns - 1) * mCurrentSpec.mCellSpacing)
- (mCurrentSpec.mColumns * mCurrentSpec.mCellWidth)) / 2;
mCurrentSpec.mRightEdgePadding = mCurrentSpec.mLeftEdgePadding;
int rows = (mGallery.mAllImages.getCount() + mCurrentSpec.mColumns - 1)
/ mCurrentSpec.mColumns;
mMaxScrollY = mCurrentSpec.mCellSpacing
+ (rows
* (mCurrentSpec.mCellSpacing + mCurrentSpec.mCellHeight))
- (bottom - top) + mMaxOvershoot;
mMinScrollY = 0 - mMaxOvershoot;
mGallery.mLayoutComplete = true;
start();
if (mGallery.mSortAscending && mGallery.mTargetScroll == 0) {
scrollTo(0, mMaxScrollY - mMaxOvershoot);
} else {
if (oldColumnCount != 0) {
int y = mGallery.mTargetScroll *
oldColumnCount / mCurrentSpec.mColumns;
Log.v(TAG, "target was " + mGallery.mTargetScroll
+ " now " + y);
scrollTo(0, y);
}
}
}
Bitmap scaleTo(int width, int height, Bitmap b) {
Matrix m = new Matrix();
m.setScale(width / 64F, height / 64F);
Bitmap b2 = Bitmap.createBitmap(b, 0, 0, b.getWidth(), b.getHeight(),
m, false);
if (b2 != b) {
b.recycle();
}
return b2;
}
class ImageBlockManager {
private ImageLoader mLoader;
private int mBlockCacheFirstBlockNumber = 0;
// mBlockCache is an array with a starting point which is not
// necessarily zero. The first element of the array is indicated by
// mBlockCacheStartOffset.
private int mBlockCacheStartOffset = 0;
private ImageBlock [] mBlockCache;
private static final int sRowsPerPage = 6; // should compute this
private static final int sPagesPreCache = 2;
private static final int sPagesPostCache = 2;
private int mWorkCounter = 0;
private boolean mDone = false;
private Thread mWorkerThread;
private Bitmap mMissingImageThumbnailBitmap;
private Bitmap mMissingVideoThumbnailBitmap;
private Drawable mVideoOverlay;
private Drawable mVideoMmsErrorOverlay;
public void dump() {
synchronized (ImageBlockManager.this) {
StringBuilder line1 = new StringBuilder();
StringBuilder line2 = new StringBuilder();
if (Config.LOGV) {
Log.v(TAG, ">>> mBlockCacheFirstBlockNumber: "
+ mBlockCacheFirstBlockNumber + " "
+ mBlockCacheStartOffset);
}
for (int i = 0; i < mBlockCache.length; i++) {
int index = (mBlockCacheStartOffset + i)
% mBlockCache.length;
ImageBlock block = mBlockCache[index];
block.dump(line1, line2);
}
if (Config.LOGV){
Log.v(TAG, line1.toString());
Log.v(TAG, line2.toString());
}
}
}
ImageBlockManager() {
mLoader = new ImageLoader(mHandler, 1);
mBlockCache = new ImageBlock[sRowsPerPage
* (sPagesPreCache + sPagesPostCache + 1)];
for (int i = 0; i < mBlockCache.length; i++) {
mBlockCache[i] = new ImageBlock();
}
mWorkerThread = new Thread(new Runnable() {
public void run() {
while (true) {
int workCounter;
synchronized (ImageBlockManager.this) {
workCounter = mWorkCounter;
}
if (mDone) {
if (Config.LOGV) {
Log.v(TAG, "stopping the loader here "
+ Thread.currentThread().getName());
}
if (mLoader != null) {
mLoader.stop();
}
if (mBlockCache != null) {
for (int i = 0; i < mBlockCache.length; i++) {
ImageBlock block = mBlockCache[i];
if (block != null) {
block.recycleBitmaps();
mBlockCache[i] = null;
}
}
}
mBlockCache = null;
mBlockCacheStartOffset = 0;
mBlockCacheFirstBlockNumber = 0;
break;
}
loadNext();
synchronized (ImageBlockManager.this) {
if ((workCounter == mWorkCounter) && (!mDone)) {
try {
ImageBlockManager.this.wait();
} catch (InterruptedException ex) {
}
}
}
} // while
} // run
});
BitmapManager.instance().allowThreadDecoding(mWorkerThread);
mWorkerThread.setName("image-block-manager");
mWorkerThread.start();
}
// Create this bitmap lazily, and only once for all the ImageBlocks to
// use
public Bitmap getErrorBitmap(IImage image) {
if (ImageManager.isImage(image)) {
if (mMissingImageThumbnailBitmap == null) {
mMissingImageThumbnailBitmap =
BitmapFactory.decodeResource(
GridViewSpecial.this.getResources(),
R.drawable.ic_missing_thumbnail_picture);
}
return mMissingImageThumbnailBitmap;
} else {
if (mMissingVideoThumbnailBitmap == null) {
mMissingVideoThumbnailBitmap =
BitmapFactory.decodeResource(
GridViewSpecial.this.getResources(),
R.drawable.ic_missing_thumbnail_video);
}
return mMissingVideoThumbnailBitmap;
}
}
private ImageBlock getBlockForPos(int pos) {
synchronized (ImageBlockManager.this) {
int blockNumber = pos / mCurrentSpec.mColumns;
int delta = blockNumber - mBlockCacheFirstBlockNumber;
if (delta >= 0 && delta < mBlockCache.length) {
int index = (mBlockCacheStartOffset + delta)
% mBlockCache.length;
ImageBlock b = mBlockCache[index];
return b;
}
}
return null;
}
private void repaintSelection(int pos) {
synchronized (ImageBlockManager.this) {
ImageBlock b = getBlockForPos(pos);
if (b != null) {
b.repaintSelection();
}
}
}
private void onPause() {
synchronized (ImageBlockManager.this) {
mDone = true;
ImageBlockManager.this.notify();
}
if (mWorkerThread != null) {
try {
BitmapManager.instance().cancelThreadDecoding(mWorkerThread);
mWorkerThread.join();
mWorkerThread = null;
} catch (InterruptedException ex) {
//
}
}
Log.v(TAG, "/ImageBlockManager.onPause");
}
void getVisibleRange(int [] range) {
// try to work around a possible bug in the VM wherein this appears
// to be null
try {
synchronized (ImageBlockManager.this) {
int blockLength = mBlockCache.length;
boolean lookingForStart = true;
ImageBlock prevBlock = null;
for (int i = 0; i < blockLength; i++) {
int index = (mBlockCacheStartOffset + i) % blockLength;
ImageBlock block = mBlockCache[index];
if (lookingForStart) {
if (block.mIsVisible) {
range[0] = block.mBlockNumber
* mCurrentSpec.mColumns;
lookingForStart = false;
}
} else {
if (!block.mIsVisible || i == blockLength - 1) {
range[1] = (prevBlock.mBlockNumber
* mCurrentSpec.mColumns)
+ mCurrentSpec.mColumns - 1;
break;
}
}
prevBlock = block;
}
}
} catch (NullPointerException ex) {
Log.e(TAG, "this is somewhat null, what up?");
range[0] = range[1] = 0;
}
}
private void loadNext() {
final int blockHeight = (mCurrentSpec.mCellSpacing
+ mCurrentSpec.mCellHeight);
final int firstVisBlock =
Math.max(0, (mScrollY - mCurrentSpec.mCellSpacing)
/ blockHeight);
final int lastVisBlock =
(mScrollY - mCurrentSpec.mCellSpacing + getHeight())
/ blockHeight;
synchronized (ImageBlockManager.this) {
ImageBlock [] blocks = mBlockCache;
int numBlocks = blocks.length;
if (mDirectionBiasDown) {
int first = (mBlockCacheStartOffset
+ (firstVisBlock - mBlockCacheFirstBlockNumber))
% blocks.length;
for (int i = 0; i < numBlocks; i++) {
int j = first + i;
if (j >= numBlocks) {
j -= numBlocks;
}
ImageBlock b = blocks[j];
if (b.startLoading() > 0) {
break;
}
}
} else {
int first = (mBlockCacheStartOffset
+ (lastVisBlock - mBlockCacheFirstBlockNumber))
% blocks.length;
for (int i = 0; i < numBlocks; i++) {
int j = first - i;
if (j < 0) {
j += numBlocks;
}
ImageBlock b = blocks[j];
if (b.startLoading() > 0) {
break;
}
}
}
if (DUMP) {
this.dump();
}
}
}
private void moveDataWindow(boolean directionBiasDown,
boolean forceRefresh) {
final int blockHeight = (mCurrentSpec.mCellSpacing
+ mCurrentSpec.mCellHeight);
final int firstVisBlock = (mScrollY - mCurrentSpec.mCellSpacing)
/ blockHeight;
final int lastVisBlock =
(mScrollY - mCurrentSpec.mCellSpacing + getHeight())
/ blockHeight;
final int preCache = sPagesPreCache;
final int startBlock = Math.max(0,
firstVisBlock - (preCache * sRowsPerPage));
synchronized (ImageBlockManager.this) {
boolean any = false;
ImageBlock [] blocks = mBlockCache;
int numBlocks = blocks.length;
int delta = startBlock - mBlockCacheFirstBlockNumber;
mBlockCacheFirstBlockNumber = startBlock;
if (Math.abs(delta) > numBlocks || forceRefresh) {
for (int i = 0; i < numBlocks; i++) {
int blockNum = startBlock + i;
blocks[i].setStart(blockNum);
any = true;
}
mBlockCacheStartOffset = 0;
} else if (delta > 0) {
mBlockCacheStartOffset += delta;
if (mBlockCacheStartOffset >= numBlocks) {
mBlockCacheStartOffset -= numBlocks;
}
for (int i = delta; i > 0; i--) {
int index = (mBlockCacheStartOffset + numBlocks - i)
% numBlocks;
int blockNum = mBlockCacheFirstBlockNumber
+ numBlocks - i;
blocks[index].setStart(blockNum);
any = true;
}
} else if (delta < 0) {
mBlockCacheStartOffset += delta;
if (mBlockCacheStartOffset < 0) {
mBlockCacheStartOffset += numBlocks;
}
for (int i = 0; i < -delta; i++) {
int index = (mBlockCacheStartOffset + i) % numBlocks;
int blockNum = mBlockCacheFirstBlockNumber + i;
blocks[index].setStart(blockNum);
any = true;
}
}
for (int i = 0; i < numBlocks; i++) {
int index = (mBlockCacheStartOffset + i) % numBlocks;
ImageBlock block = blocks[index];
int blockNum = block.mBlockNumber;
boolean isVis = blockNum >= firstVisBlock
&& blockNum <= lastVisBlock;
block.setVisibility(isVis);
}
if (DUMP) {
mImageBlockManager.dump();
}
if (any) {
ImageBlockManager.this.notify();
mWorkCounter += 1;
}
=======
public void onSelect(int index) {
if (index >= 0 && index < mAllImages.getCount()) {
IImage img = mAllImages.getImageAt(index);
if (img == null) {
return;
}
if (isPickIntent()) {
launchCropperOrFinish(img);
} else {
Uri targetUri = img.fullSizeImageUri();
Uri thisUri = getIntent().getData();
if (thisUri != null) {
String bucket = thisUri.getQueryParameter("bucketId");
if (bucket != null) {
targetUri = targetUri.buildUpon()
.appendQueryParameter("bucketId", bucket)
.build();
}
}
Intent intent = new Intent(Intent.ACTION_VIEW, targetUri);
if (img instanceof VideoObject) {
intent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION,
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
try {
startActivity(intent);
} catch (Exception ex) {
// sdcard removal??
}
}
}
}
private final class MyThumbCheckCallback implements IImageList.ThumbCheckCallback {
private final TextView progressTextView;
private final long startTime;
private final String progressTextFormatString;
boolean mDidSetProgress = false;
private MyThumbCheckCallback(TextView progressTextView, long startTime,
String progressTextFormatString) {
this.progressTextView = progressTextView;
this.startTime = startTime;
this.progressTextFormatString = progressTextFormatString;
}
public boolean checking(final int count,
final int maxCount) {
if (mStopThumbnailChecking) {
return false;
}
if (!mLayoutComplete) {
return true;
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
if (DUMP) {
dump(); |
| Solution content |
|---|
return mAllImages;
}
public void onSelect(int index) {
if (index >= 0 && index < mAllImages.getCount()) {
IImage img = mAllImages.getImageAt(index);
if (img == null) {
return;
}
if (isPickIntent()) {
launchCropperOrFinish(img);
} else {
Uri targetUri = img.fullSizeImageUri();
Uri thisUri = getIntent().getData();
if (thisUri != null) {
String bucket = thisUri.getQueryParameter("bucketId");
if (bucket != null) {
targetUri = targetUri.buildUpon()
.appendQueryParameter("bucketId", bucket)
.build();
}
}
Intent intent = new Intent(Intent.ACTION_VIEW, targetUri);
if (img instanceof VideoObject) {
intent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION,
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
try {
startActivity(intent);
} catch (Exception ex) {
// sdcard removal??
}
}
}
}
private final class MyThumbCheckCallback implements IImageList.ThumbCheckCallback {
private final TextView progressTextView;
private final long startTime;
private final String progressTextFormatString;
boolean mDidSetProgress = false;
private MyThumbCheckCallback(TextView progressTextView, long startTime,
String progressTextFormatString) {
this.progressTextView = progressTextView;
this.startTime = startTime;
this.progressTextFormatString = progressTextFormatString;
}
public boolean checking(final int count,
final int maxCount) {
if (mStopThumbnailChecking) {
return false;
}
if (!mLayoutComplete) {
return true;
}
if (!mDidSetProgress) {
mHandler.post(new Runnable() {
public void run() {
findViewById(
R.id.loading_indicator)
.setVisibility(View.VISIBLE);
}
});
mDidSetProgress = true;
}
mGvs.postInvalidate();
// If there is a new image done and it has been
// one second, update the progress text.
if (System.currentTimeMillis()
- startTime > 1000) {
mHandler.post(new Runnable() {
public void run() {
String s = String.format(
progressTextFormatString,
maxCount - count);
progressTextView.setText(s);
}
});
}
return !mPausing;
}
}
private class CreateContextMenuListener implements
View.OnCreateContextMenuListener {
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenu.ContextMenuInfo menuInfo) {
if (getCurrentImage() == null) {
return;
}
boolean isImage = ImageManager.isImage(getCurrentImage());
if (isImage) {
menu.add(0, 0, 0, R.string.view).setOnMenuItemClickListener(
new MenuItem.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
onSelect(mGvs.mCurrentSelection);
return true;
}
});
}
menu.setHeaderTitle(isImage
? R.string.context_menu_header
: R.string.video_context_menu_header);
if ((mInclusion & (ImageManager.INCLUDE_IMAGES
| ImageManager.INCLUDE_VIDEOS)) != 0) {
MenuHelper.MenuItemsResult r = MenuHelper.addImageMenuItems(
menu,
MenuHelper.INCLUDE_ALL,
isImage,
ImageGallery2.this,
mHandler,
mDeletePhotoRunnable,
new MenuHelper.MenuInvoker() {
public void run(MenuHelper.MenuCallback cb) {
cb.run(getCurrentImageUri(), getCurrentImage());
mGvs.clearCache();
mGvs.invalidate();
mGvs.requestLayout();
mGvs.start();
mNoImagesView.setVisibility(
mAllImages.getCount() > 0
? View.GONE
: View.VISIBLE);
}
});
if (r != null) {
r.gettingReadyToOpen(menu, getCurrentImage());
}
if (isImage) {
addSlideShowMenu(menu, 1000);
}
}
}
}
public void onLayout() {
mLayoutComplete = true;
if (mSortAscending && mTargetScroll == 0) {
mGvs.scrollToImage(mAllImages.getCount() - 1);
} else {
mGvs.scrollToImage(mFirstVisibleIndex);
}
}
public void onScroll(int index) {
mFirstVisibleIndex = index;
}
}
|
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Class declaration |
| Class signature |
| Comment |
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Return statement |
| Synchronized statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
}
<<<<<<< HEAD
void doDraw(Canvas canvas) {
synchronized (ImageBlockManager.this) {
ImageBlockManager.ImageBlock [] blocks = mBlockCache;
int blockCount = 0;
if (blocks[0] == null) {
return;
}
final int thisHeight = getHeight();
final int thisWidth = getWidth();
final int height = blocks[0].mBitmap.getHeight();
final int scrollPos = mScrollY;
int currentBlock = (scrollPos < 0)
? ((scrollPos - height + 1) / height)
: (scrollPos / height);
while (true) {
final int yPos = currentBlock * height;
if (yPos >= scrollPos + thisHeight) {
break;
}
if (currentBlock < 0) {
canvas.drawRect(0, yPos, thisWidth, 0, mGridViewPaint);
currentBlock += 1;
continue;
}
int effectiveOffset =
(mBlockCacheStartOffset
+ (currentBlock++ - mBlockCacheFirstBlockNumber))
% blocks.length;
if (effectiveOffset < 0
|| effectiveOffset >= blocks.length) {
break;
}
ImageBlock block = blocks[effectiveOffset];
if (block == null) {
break;
}
synchronized (block) {
Bitmap b = block.mBitmap;
if (b == null) {
break;
}
canvas.drawBitmap(b, 0, yPos, mGridViewPaint);
blockCount += 1;
}
}
}
}
int blockHeight() {
return mCurrentSpec.mCellSpacing + mCurrentSpec.mCellHeight;
}
private class ImageBlock {
Drawable mCellOutline;
Bitmap mBitmap = Bitmap.createBitmap(getWidth(), blockHeight(),
Bitmap.Config.RGB_565);
Canvas mCanvas = new Canvas(mBitmap);
Paint mPaint = new Paint();
int mBlockNumber;
// columns which have been requested to the loader
int mRequestedMask;
}
// columns which have been completed from the loader
int mCompletedMask;
boolean mIsVisible;
public void dump(StringBuilder line1, StringBuilder line2) {
synchronized (ImageBlock.this) {
line2.append(mCompletedMask != 0xF ? 'L' : '_');
line1.append(mIsVisible ? 'V' : ' ');
}
}
ImageBlock() {
mPaint.setTextSize(14F);
mPaint.setStyle(Paint.Style.FILL);
mBlockNumber = -1;
mCellOutline = GridViewSpecial.this.getResources()
.getDrawable(android.R.drawable.gallery_thumb);
}
private void recycleBitmaps() {
synchronized (ImageBlock.this) {
mBitmap.recycle();
mBitmap = null;
}
}
private void cancelExistingRequests() {
synchronized (ImageBlock.this) {
for (int i = 0; i < mCurrentSpec.mColumns; i++) {
int mask = (1 << i);
if ((mRequestedMask & mask) != 0) {
int pos =
(mBlockNumber * mCurrentSpec.mColumns) + i;
if (mLoader.cancel(
mGallery.mAllImages.getImageAt(pos))) {
mRequestedMask &= ~mask;
}
}
}
}
}
private void setStart(final int blockNumber) {
synchronized (ImageBlock.this) {
if (blockNumber == mBlockNumber) {
return;
}
cancelExistingRequests();
mBlockNumber = blockNumber;
mRequestedMask = 0;
mCompletedMask = 0;
mCanvas.drawColor(0xFF000000);
mPaint.setColor(0xFFDDDDDD);
int imageNumber = blockNumber * mCurrentSpec.mColumns;
int lastImageNumber = mGallery.mAllImages.getCount() - 1;
int spacing = mCurrentSpec.mCellSpacing;
int leftSpacing = mCurrentSpec.mLeftEdgePadding;
final int yPos = spacing;
for (int col = 0; col < mCurrentSpec.mColumns; col++) {
if (imageNumber++ >= lastImageNumber) {
break;
}
final int xPos = leftSpacing
+ (col * (mCurrentSpec.mCellWidth + spacing));
mCanvas.drawRect(xPos, yPos,
xPos + mCurrentSpec.mCellWidth,
yPos + mCurrentSpec.mCellHeight, mPaint);
paintSel(0, xPos, yPos);
}
}
}
private boolean setVisibility(boolean isVis) {
synchronized (ImageBlock.this) {
boolean retval = mIsVisible != isVis;
mIsVisible = isVis;
return retval;
}
}
private int startLoading() {
synchronized (ImageBlock.this) {
final int startRow = mBlockNumber;
int count = mGallery.mAllImages.getCount();
if (startRow == -1) {
return 0;
if ((startRow * mCurrentSpec.mColumns) >= count) {
return 0;
}
int retVal = 0;
int base = (mBlockNumber * mCurrentSpec.mColumns);
for (int col = 0; col < mCurrentSpec.mColumns; col++) {
if ((mCompletedMask & (1 << col)) != 0) {
continue;
}
int spacing = mCurrentSpec.mCellSpacing;
int leftSpacing = mCurrentSpec.mLeftEdgePadding;
final int yPos = spacing;
final int xPos = leftSpacing
+ (col * (mCurrentSpec.mCellWidth + spacing));
int pos = base + col;
if (pos >= count) {
break;
}
IImage image = mGallery.mAllImages.getImageAt(pos);
if (image != null) {
loadImage(base, col, image, xPos, yPos);
retVal += 1;
}
}
return retVal;
}
}
Bitmap resizeBitmap(Bitmap b) {
// assume they're both square for now
if (b == null || (b.getWidth() == mCurrentSpec.mCellWidth
&& b.getHeight() == mCurrentSpec.mCellHeight)) {
return b;
}
float scale = (float) mCurrentSpec.mCellWidth
/ (float) b.getWidth();
Matrix m = new Matrix();
m.setScale(scale, scale, b.getWidth(), b.getHeight());
Bitmap b2 = Bitmap.createBitmap(b, 0, 0, b.getWidth(),
b.getHeight(), m, false);
return b2;
}
private void drawBitmap(IImage image, int base, int baseOffset,
Bitmap b, int xPos, int yPos) {
mCanvas.setBitmap(mBitmap);
if (b != null) {
// if the image is close to the target size then crop,
// otherwise scale both the bitmap and the view should be
// square but I suppose that could change in the future.
int w = mCurrentSpec.mCellWidth;
int h = mCurrentSpec.mCellHeight;
int bw = b.getWidth();
int bh = b.getHeight();
int deltaW = bw - w;
int deltaH = bh - h;
if (deltaW < 10 && deltaH < 10) {
int halfDeltaW = deltaW / 2;
int halfDeltaH = deltaH / 2;
android.graphics.Rect src =
new android.graphics.Rect(0 + halfDeltaW,
0 + halfDeltaH, bw - halfDeltaW,
bh - halfDeltaH);
android.graphics.Rect dst =
new android.graphics.Rect(xPos, yPos,
xPos + w, yPos + h);
if (src.width() != dst.width()
|| src.height() != dst.height()) {
if (Config.LOGV){
Log.v(TAG, "nope... width doesn't match "
+ src.width() + " " + dst.width());
Log.v(TAG, "nope... height doesn't match "
+ src.height() + " " + dst.height());
}
}
mCanvas.drawBitmap(b, src, dst, mPaint);
} else {
android.graphics.Rect src =
new android.graphics.Rect(0, 0, bw, bh);
android.graphics.Rect dst =
new android.graphics.Rect(xPos, yPos, xPos + w,
yPos + h);
mCanvas.drawBitmap(b, src, dst, mPaint);
}
} else {
// If the thumbnail cannot be drawn, put up an error icon
// instead
Bitmap error = mImageBlockManager.getErrorBitmap(image);
int width = error.getWidth();
int height = error.getHeight();
Rect source = new Rect(0, 0, width, height);
int left = (mCurrentSpec.mCellWidth - width) / 2 + xPos;
int top = (mCurrentSpec.mCellHeight - height) / 2 + yPos;
Rect dest = new Rect(left, top, left + width, top + height);
mCanvas.drawBitmap(error, source, dest, mPaint);
}
if (ImageManager.isVideo(image)) {
Drawable overlay = null;
long size = MenuHelper.getImageFileSize(image);
if (size >= 0 && size <= mVideoSizeLimit) {
if (mVideoOverlay == null) {
mVideoOverlay = getResources().getDrawable(
R.drawable.ic_gallery_video_overlay);
}
overlay = mVideoOverlay;
} else {
if (mVideoMmsErrorOverlay == null) {
mVideoMmsErrorOverlay = getResources().getDrawable(
R.drawable.ic_error_mms_video_overlay);
}
overlay = mVideoMmsErrorOverlay;
Paint paint = new Paint();
paint.setARGB(0x80, 0x00, 0x00, 0x00);
mCanvas.drawRect(xPos, yPos,
xPos + mCurrentSpec.mCellWidth,
yPos + mCurrentSpec.mCellHeight, paint);
}
int width = overlay.getIntrinsicWidth();
int height = overlay.getIntrinsicHeight();
int left = (mCurrentSpec.mCellWidth - width) / 2 + xPos;
int top = (mCurrentSpec.mCellHeight - height) / 2 + yPos;
Rect newBounds =
new Rect(left, top, left + width, top + height);
overlay.setBounds(newBounds);
overlay.draw(mCanvas);
}
paintSel(base + baseOffset, xPos, yPos);
}
private void repaintSelection() {
int count = mGallery.mAllImages.getCount();
int startPos = mBlockNumber * mCurrentSpec.mColumns;
synchronized (ImageBlock.this) {
for (int i = 0; i < mCurrentSpec.mColumns; i++) {
int pos = startPos + i;
if (pos >= count) {
break;
}
int row = 0; // i / mCurrentSpec.mColumns;
int col = i - (row * mCurrentSpec.mColumns);
// this is duplicated from getOrKick
// (TODO: don't duplicate this code)
int spacing = mCurrentSpec.mCellSpacing;
int leftSpacing = mCurrentSpec.mLeftEdgePadding;
final int yPos = spacing
+ (row * (mCurrentSpec.mCellHeight + spacing));
final int xPos = leftSpacing
+ (col * (mCurrentSpec.mCellWidth + spacing));
paintSel(pos, xPos, yPos);
}
}
}
private void paintSel(int pos, int xPos, int yPos) {
int[] stateSet = EMPTY_STATE_SET;
if (pos == mCurrentSelection && mShowSelection) {
if (mCurrentSelectionPressed) {
stateSet = PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET;
} else {
stateSet = ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET;
}
}
mCellOutline.setState(stateSet);
mCanvas.setBitmap(mBitmap);
mCellOutline.setBounds(xPos, yPos,
xPos + mCurrentSpec.mCellWidth,
yPos + mCurrentSpec.mCellHeight);
mCellOutline.draw(mCanvas);
}
private void loadImage(
final int base,
final int baseOffset,
final IImage image,
final int xPos,
final int yPos) {
synchronized (ImageBlock.this) {
final int startBlock = mBlockNumber;
final int pos = base + baseOffset;
final ImageLoader.LoadedCallback r =
new ImageLoader.LoadedCallback() {
public void run(Bitmap b) {
boolean more = false;
synchronized (ImageBlock.this) {
if (startBlock != mBlockNumber) {
return;
}
if (mBitmap == null) {
return;
}
drawBitmap(image, base, baseOffset, b, xPos,
yPos);
int mask = (1 << baseOffset);
mRequestedMask &= ~mask;
mCompletedMask |= mask;
if (mRequestedMask == 0) {
if (mIsVisible) {
postInvalidate();
}
more = true;
}
}
if (b != null) {
b.recycle();
}
if (more) {
synchronized (ImageBlockManager.this) {
ImageBlockManager.this.notify();
mWorkCounter += 1;
}
}
if (DUMP) {
ImageBlockManager.this.dump();
}
}
};
mRequestedMask |= (1 << baseOffset);
mLoader.getBitmap(image, pos, r, mIsVisible, false);
}
}
}
}
public void init(Handler handler) {
mHandler = handler;
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (false) {
canvas.drawRect(0, 0, getWidth(), getHeight(), mGridViewPaint);
if (Config.LOGV) {
Log.v(TAG, "painting background w/h " + getWidth()
+ " / " + getHeight());
=======
if (!mDidSetProgress) {
mHandler.post(new Runnable() {
public void run() {
findViewById(
R.id.loading_indicator)
});
.setVisibility(View.VISIBLE);
}
mDidSetProgress = true;
}
mGvs.postInvalidate();
// If there is a new image done and it has been
// one second, update the progress text.
if (System.currentTimeMillis()
- startTime > 1000) {
mHandler.post(new Runnable() {
public void run() {
String s = String.format(
progressTextFormatString,
maxCount - count);
progressTextView.setText(s);
}
});
}
return !mPausing;
}
}
private class CreateContextMenuListener implements
View.OnCreateContextMenuListener {
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenu.ContextMenuInfo menuInfo) {
if (getCurrentImage() == null) {
return;
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
return;
} |
| Solution content |
|---|
}
if (!mDidSetProgress) {
mHandler.post(new Runnable() {
public void run() {
findViewById(
R.id.loading_indicator)
.setVisibility(View.VISIBLE);
}
});
mDidSetProgress = true;
}
mGvs.postInvalidate();
// If there is a new image done and it has been
// one second, update the progress text.
if (System.currentTimeMillis()
- startTime > 1000) {
mHandler.post(new Runnable() {
public void run() {
String s = String.format(
progressTextFormatString,
maxCount - count);
progressTextView.setText(s);
}
});
}
return !mPausing;
}
}
private class CreateContextMenuListener implements
View.OnCreateContextMenuListener {
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenu.ContextMenuInfo menuInfo) {
if (getCurrentImage() == null) {
return;
}
boolean isImage = ImageManager.isImage(getCurrentImage());
if (isImage) {
menu.add(0, 0, 0, R.string.view).setOnMenuItemClickListener(
new MenuItem.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
onSelect(mGvs.mCurrentSelection);
return true;
}
});
}
menu.setHeaderTitle(isImage
? R.string.context_menu_header
: R.string.video_context_menu_header);
if ((mInclusion & (ImageManager.INCLUDE_IMAGES
| ImageManager.INCLUDE_VIDEOS)) != 0) {
MenuHelper.MenuItemsResult r = MenuHelper.addImageMenuItems(
menu,
MenuHelper.INCLUDE_ALL,
isImage,
ImageGallery2.this,
mHandler,
mDeletePhotoRunnable,
new MenuHelper.MenuInvoker() {
public void run(MenuHelper.MenuCallback cb) {
cb.run(getCurrentImageUri(), getCurrentImage());
mGvs.clearCache();
mGvs.invalidate();
mGvs.requestLayout();
mGvs.start();
mNoImagesView.setVisibility(
mAllImages.getCount() > 0
? View.GONE
: View.VISIBLE);
}
});
if (r != null) {
r.gettingReadyToOpen(menu, getCurrentImage());
}
if (isImage) {
addSlideShowMenu(menu, 1000);
}
}
}
}
public void onLayout() {
mLayoutComplete = true;
if (mSortAscending && mTargetScroll == 0) {
mGvs.scrollToImage(mAllImages.getCount() - 1);
} else {
mGvs.scrollToImage(mFirstVisibleIndex);
}
}
public void onScroll(int index) {
mFirstVisibleIndex = index;
}
}
|
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Class declaration |
| Class signature |
| Comment |
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Return statement |
| Chunk |
|---|
| Conflicting content |
|---|
return;
}
<<<<<<< HEAD
if (mImageBlockManager != null) {
mImageBlockManager.doDraw(canvas);
mImageBlockManager.moveDataWindow(mDirectionBiasDown, false);
}
}
@Override
public void computeScroll() {
if (mScroller != null) {
boolean more = mScroller.computeScrollOffset();
scrollTo(0, mScroller.getCurrY());
if (more) {
postInvalidate(); // So we draw again
} else {
mScroller = null;
}
} else {
super.computeScroll();
}
}
android.graphics.Rect getRectForPosition(int pos) {
int row = pos / mCurrentSpec.mColumns;
int col = pos - (row * mCurrentSpec.mColumns);
int left = mCurrentSpec.mLeftEdgePadding
+ (col * mCurrentSpec.mCellWidth)
+ (Math.max(0, col - 1) * mCurrentSpec.mCellSpacing);
int top = (row * mCurrentSpec.mCellHeight)
+ (row * mCurrentSpec.mCellSpacing);
return new android.graphics.Rect(left, top,
left + mCurrentSpec.mCellWidth + mCurrentSpec.mCellWidth,
top + mCurrentSpec.mCellHeight + mCurrentSpec.mCellSpacing);
}
int computeSelectedIndex(android.view.MotionEvent ev) {
int spacing = mCurrentSpec.mCellSpacing;
int leftSpacing = mCurrentSpec.mLeftEdgePadding;
int x = (int) ev.getX();
int y = (int) ev.getY();
int row = (mScrollY + y - spacing)
/ (mCurrentSpec.mCellHeight + spacing);
int col = Math.min(mCurrentSpec.mColumns - 1,
(x - leftSpacing) / (mCurrentSpec.mCellWidth + spacing));
return (row * mCurrentSpec.mColumns) + col;
}
@Override
public boolean onTouchEvent(android.view.MotionEvent ev) {
if (!mGallery.canHandleEvent()) {
return false;
}
mGestureDetector.onTouchEvent(ev);
return true;
}
void onSelect(int index) {
if (index >= 0 && index < mGallery.mAllImages.getCount()) {
IImage img = mGallery.mAllImages.getImageAt(index);
if (img == null) {
return;
}
if (mGallery.isPickIntent()) {
mGallery.launchCropperOrFinish(img);
} else {
Uri targetUri = img.fullSizeImageUri();
Uri thisUri = mGallery.getIntent().getData();
if (thisUri != null) {
String bucket = thisUri.getQueryParameter("bucketId");
if (bucket != null) {
targetUri = targetUri.buildUpon()
.appendQueryParameter("bucketId", bucket)
.build();
}
}
Intent intent = new Intent(Intent.ACTION_VIEW, targetUri);
if (img instanceof VideoObject) {
intent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION,
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
try {
mContext.startActivity(intent);
} catch (Exception ex) {
// sdcard removal??
=======
boolean isImage = ImageManager.isImage(getCurrentImage());
if (isImage) {
menu.add(0, 0, 0, R.string.view).setOnMenuItemClickListener(
new MenuItem.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
onSelect(mGvs.mCurrentSelection);
return true;
}
});
}
menu.setHeaderTitle(isImage
? R.string.context_menu_header
: R.string.video_context_menu_header);
if ((mInclusion & (ImageManager.INCLUDE_IMAGES
| ImageManager.INCLUDE_VIDEOS)) != 0) {
MenuHelper.MenuItemsResult r = MenuHelper.addImageMenuItems(
menu,
MenuHelper.INCLUDE_ALL,
isImage,
ImageGallery2.this,
mHandler,
mDeletePhotoRunnable,
new MenuHelper.MenuInvoker() {
public void run(MenuHelper.MenuCallback cb) {
cb.run(getCurrentImageUri(), getCurrentImage());
mGvs.clearCache();
mGvs.invalidate();
mGvs.requestLayout();
mGvs.start();
mNoImagesView.setVisibility(
mAllImages.getCount() > 0
? View.GONE
: View.VISIBLE);
}
});
if (r != null) {
r.gettingReadyToOpen(menu, getCurrentImage());
}
if (isImage) {
addSlideShowMenu(menu, 1000);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
}
} |
| Solution content |
|---|
}
boolean isImage = ImageManager.isImage(getCurrentImage());
if (isImage) {
menu.add(0, 0, 0, R.string.view).setOnMenuItemClickListener(
new MenuItem.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
onSelect(mGvs.mCurrentSelection);
return true;
}
});
}
menu.setHeaderTitle(isImage
? R.string.context_menu_header
: R.string.video_context_menu_header);
if ((mInclusion & (ImageManager.INCLUDE_IMAGES
| ImageManager.INCLUDE_VIDEOS)) != 0) {
MenuHelper.MenuItemsResult r = MenuHelper.addImageMenuItems(
menu,
MenuHelper.INCLUDE_ALL,
isImage,
ImageGallery2.this,
mHandler,
mDeletePhotoRunnable,
new MenuHelper.MenuInvoker() {
public void run(MenuHelper.MenuCallback cb) {
cb.run(getCurrentImageUri(), getCurrentImage());
mGvs.clearCache();
mGvs.invalidate();
mGvs.requestLayout();
mGvs.start();
mNoImagesView.setVisibility(
mAllImages.getCount() > 0
? View.GONE
: View.VISIBLE);
}
});
if (r != null) {
r.gettingReadyToOpen(menu, getCurrentImage());
}
if (isImage) {
addSlideShowMenu(menu, 1000);
}
}
} |
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Catch clause |
| Comment |
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
case 3: text = "April"; break;
}
}
<<<<<<< HEAD
@Override
public void scrollBy(int x, int y) {
scrollTo(x, mScrollY + y);
}
Toast mDateLocationToast;
int [] mDateRange = new int[2];
private String month(int month) {
String text = "";
switch (month) {
case 0: text = "January"; break;
case 1: text = "February"; break;
case 2: text = "March"; break;
case 4: text = "May"; break;
case 5: text = "June"; break;
case 6: text = "July"; break;
case 7: text = "August"; break;
case 8: text = "September"; break;
case 9: text = "October"; break;
case 10: text = "November"; break;
case 11: text = "December"; break;
}
return text;
}
Runnable mToastRunnable = new Runnable() {
public void run() {
if (mDateLocationToast != null) {
mDateLocationToast.cancel();
mDateLocationToast = null;
}
int count = mGallery.mAllImages.getCount();
if (count == 0) {
return;
}
GridViewSpecial.this.mImageBlockManager.getVisibleRange(mDateRange);
IImage firstImage = mGallery.mAllImages.getImageAt(mDateRange[0]);
int lastOffset = Math.min(count - 1, mDateRange[1]);
IImage lastImage = mGallery.mAllImages.getImageAt(lastOffset);
GregorianCalendar dateStart = new GregorianCalendar();
GregorianCalendar dateEnd = new GregorianCalendar();
dateStart.setTimeInMillis(firstImage.getDateTaken());
dateEnd.setTimeInMillis(lastImage.getDateTaken());
String text1 = month(dateStart.get(Calendar.MONTH)) + " "
+ dateStart.get(Calendar.YEAR);
String text2 = month(dateEnd.get(Calendar.MONTH)) + " "
+ dateEnd.get(Calendar.YEAR);
String text = text1;
if (!text2.equals(text1)) {
text = text + " : " + text2;
}
mDateLocationToast = Toast.makeText(mContext, text,
Toast.LENGTH_LONG);
mDateLocationToast.show();
}
};
@Override
public void scrollTo(int x, int y) {
y = Math.min(mMaxScrollY, y);
y = Math.max(mMinScrollY, y);
if (y > mScrollY) {
mDirectionBiasDown = true;
} else if (y < mScrollY) {
mDirectionBiasDown = false;
}
super.scrollTo(x, y);
}
}
=======
public void onLayout() {
mLayoutComplete = true;
if (mSortAscending && mTargetScroll == 0) {
mGvs.scrollToImage(mAllImages.getCount() - 1);
} else {
mGvs.scrollToImage(mFirstVisibleIndex);
}
}
public void onScroll(int index) {
mFirstVisibleIndex = index;
}
}
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f |
| Solution content |
|---|
}
}
public void onLayout() {
mLayoutComplete = true;
if (mSortAscending && mTargetScroll == 0) {
mGvs.scrollToImage(mAllImages.getCount() - 1);
} else {
mGvs.scrollToImage(mFirstVisibleIndex);
}
}
public void onScroll(int index) {
mFirstVisibleIndex = index;
}
}
|
| File |
|---|
| ImageGallery2.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
* A dedicated decoding thread used by ImageGallery.
*/
public class ImageLoader {
<<<<<<< HEAD
=======
@SuppressWarnings("unused")
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
private static final String TAG = "ImageLoader";
// queue of work to do in the worker thread |
| Solution content |
|---|
* A dedicated decoding thread used by ImageGallery.
*/
public class ImageLoader {
@SuppressWarnings("unused")
private static final String TAG = "ImageLoader";
// queue of work to do in the worker thread |
| File |
|---|
| ImageLoader.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Chunk |
|---|
| Conflicting content |
|---|
synchronized void clear(Uri uri) {
}
<<<<<<< HEAD
public synchronized void dump() {
synchronized (mQueue) {
if (Config.LOGV) {
Log.v(TAG, "Loader queue length is " + mQueue.size());
}
}
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
public interface LoadedCallback {
public void run(Bitmap result);
} |
| Solution content |
|---|
synchronized void clear(Uri uri) {
}
public interface LoadedCallback {
public void run(Bitmap result);
} |
| File |
|---|
| ImageLoader.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
start();
}
}
<<<<<<< HEAD
long t1 = System.currentTimeMillis();
long t2, t3, t4;
synchronized (mQueue) {
t2 = System.currentTimeMillis();
=======
synchronized (mQueue) {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
WorkItem w =
new WorkItem(image, tag, imageLoadedRunnable, postBack);
|
| Solution content |
|---|
start();
}
}
synchronized (mQueue) {
WorkItem w =
new WorkItem(image, tag, imageLoadedRunnable, postBack);
|
| File |
|---|
| ImageLoader.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Synchronized statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
if (false) {
dumpQueue("+" + (postAtFront ? "F " : "B ") + tag + ": ");
}
<<<<<<< HEAD
t3 = System.currentTimeMillis();
}
t4 = System.currentTimeMillis();
// Log.v(TAG, "getBitmap breakdown: tot= " + (t4-t1) + "; " + "; " +
// (t4-t3) + "; " + (t3-t2) + "; " + (t2-t1));
=======
}
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
return null;
}
|
| Solution content |
|---|
}
if (false) {
dumpQueue("+" + (postAtFront ? "F " : "B ") + tag + ": ");
}
return null;
}
|
| File |
|---|
| ImageLoader.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
for (int i = 0; i < mQueue.size(); i++) {
sb.append(mQueue.get(i).mTag + " ");
}
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, sb.toString());
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
}
|
| Solution content |
|---|
for (int i = 0; i < mQueue.size(); i++) {
sb.append(mQueue.get(i).mTag + " ");
}
}
}
|
| File |
|---|
| ImageLoader.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
}
private synchronized void start() {
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "ImageLoader.start() <<<<<<<<<<<<<<<<<<<<<<<<<<<<");
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
synchronized (mDecodeThreads) {
if (mDecodeThreads.size() > 0) {
return; |
| Solution content |
|---|
}
private synchronized void start() {
synchronized (mDecodeThreads) {
if (mDecodeThreads.size() > 0) {
return; |
| File |
|---|
| ImageLoader.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
if (workItem != null) {
if (false) {
dumpQueue("-" + workItem.mTag + ": ");
<<<<<<< HEAD
}
Bitmap b = workItem.mImage.miniThumbBitmap();
if (b == null && Config.LOGV) {
Log.v(TAG, "unable to read thumbnail for "
+ workItem.mImage
.fullSizeImageUri());
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
Bitmap b = workItem.mImage.miniThumbBitmap();
|
| Solution content |
|---|
if (workItem != null) {
if (false) {
dumpQueue("-" + workItem.mTag + ": ");
}
Bitmap b = workItem.mImage.miniThumbBitmap();
|
| File |
|---|
| ImageLoader.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
}
<<<<<<< HEAD
public static Bitmap transform(Matrix scaler,
Bitmap source,
int targetWidth,
int targetHeight,
boolean scaleUp) {
int deltaX = source.getWidth() - targetWidth;
int deltaY = source.getHeight() - targetHeight;
if (!scaleUp && (deltaX < 0 || deltaY < 0)) {
/*
* In this case the bitmap is smaller, at least in one dimension,
* than the target. Transform it by placing as much of the image
* as possible into the target and leaving the top/bottom or
* left/right (or both) black.
*/
Bitmap b2 = Bitmap.createBitmap(targetWidth, targetHeight,
Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b2);
int deltaXHalf = Math.max(0, deltaX / 2);
int deltaYHalf = Math.max(0, deltaY / 2);
Rect src = new Rect(
deltaXHalf,
deltaYHalf,
deltaXHalf + Math.min(targetWidth, source.getWidth()),
deltaYHalf + Math.min(targetHeight, source.getHeight()));
int dstX = (targetWidth - src.width()) / 2;
int dstY = (targetHeight - src.height()) / 2;
Rect dst = new Rect(
dstX,
dstY,
targetWidth - dstX,
targetHeight - dstY);
if (Config.LOGV) {
Log.v(TAG, "draw " + src.toString() + " ==> " + dst.toString());
}
c.drawBitmap(source, src, dst, null);
return b2;
}
float bitmapWidthF = source.getWidth();
float bitmapHeightF = source.getHeight();
float bitmapAspect = bitmapWidthF / bitmapHeightF;
float viewAspect = (float) targetWidth / (float) targetHeight;
if (bitmapAspect > viewAspect) {
float scale = targetHeight / bitmapHeightF;
if (scale < .9F || scale > 1F) {
scaler.setScale(scale, scale);
} else {
scaler = null;
}
} else {
float scale = targetWidth / bitmapWidthF;
if (scale < .9F || scale > 1F) {
scaler.setScale(scale, scale);
} else {
scaler = null;
}
}
Bitmap b1;
if (scaler != null) {
// this is used for minithumb and crop, so we want to filter here.
b1 = Bitmap.createBitmap(source, 0, 0,
source.getWidth(), source.getHeight(), scaler, true);
} else {
b1 = source;
}
int dx1 = Math.max(0, b1.getWidth() - targetWidth);
int dy1 = Math.max(0, b1.getHeight() - targetHeight);
Bitmap b2 = Bitmap.createBitmap(
b1,
dx1 / 2,
dy1 / 2,
targetWidth,
targetHeight);
if (b1 != source) {
b1.recycle();
}
return b2;
}
public void stop() {
if (Config.LOGV) {
Log.v(TAG, "ImageLoader.stop " + mDecodeThreads.size() +
" threads");
}
=======
public void stop() {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mDone = true;
synchronized (mQueue) {
mQueue.notifyAll(); |
| Solution content |
|---|
}
}
public void stop() {
mDone = true;
synchronized (mQueue) {
mQueue.notifyAll(); |
| File |
|---|
| ImageLoader.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method declaration |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
}
=======
import com.android.camera.gallery.ImageListUber;
import com.android.camera.gallery.SingleImageList;
import com.android.camera.gallery.VideoList;
<<<<<<< HEAD
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.location.Location;
import android.net.Uri;
import android.os.Environment;
import android.provider.DrmStore;
import android.provider.MediaStore;
import android.provider.MediaStore.Images;
import android.provider.MediaStore.Images.ImageColumns;
import android.util.Config;
import android.util.Log;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
/**
* ImageManager is used to retrieve and store images
return sInstance;
*/
}
* in the media content provider.
public class ImageManager {
// To enable verbose logging for this class, change false to true. The other
// logic ensures that this logging can be disabled by turned off DEBUG and
// lower, and that it can be enabled by "setprop log.tag.ImageManager
// VERBOSE" if desired.
//
// IMPORTANT: Never check in this file set to true!
private static final boolean VERBOSE =
Config.LOGD && (false || Config.LOGV);
private static final String TAG = "ImageManager";
private static ImageManager sInstance = null;
private static Uri sStorageURI = Images.Media.EXTERNAL_CONTENT_URI;
private static Uri sThumbURI = Images.Thumbnails.EXTERNAL_CONTENT_URI;
private static Uri sVideoStorageURI =
Uri.parse("content://media/external/video/media");
private static Uri sVideoThumbURI =
Uri.parse("content://media/external/video/thumbnails");
/**
* Enumerate type for the location of the images in gallery.
*/
public static enum DataLocation { NONE, INTERNAL, EXTERNAL, ALL }
public static final Bitmap DEFAULT_THUMBNAIL =
Bitmap.createBitmap(32, 32, Bitmap.Config.RGB_565);
public static final Bitmap NO_IMAGE_BITMAP =
Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565);
public static final int SORT_ASCENDING = 1;
public static final int SORT_DESCENDING = 2;
public static final int INCLUDE_IMAGES = (1 << 0);
public static final int INCLUDE_DRM_IMAGES = (1 << 1);
public static final int INCLUDE_VIDEOS = (1 << 2);
public static final String CAMERA_IMAGE_BUCKET_NAME =
Environment.getExternalStorageDirectory().toString()
+ "/DCIM/Camera";
public static final String CAMERA_IMAGE_BUCKET_ID =
getBucketId(CAMERA_IMAGE_BUCKET_NAME);
public static final int MINI_THUMB_TARGET_SIZE = 96;
public static final int THUMBNAIL_TARGET_SIZE = 320;
/**
* Matches code in MediaProvider.computeBucketValues. Should be a common
* function.
*/
public static String getBucketId(String path) {
return String.valueOf(path.toLowerCase().hashCode());
}
/**
* OSX requires plugged-in USB storage to have path /DCIM/NNNAAAAA to be
* imported. This is a temporary fix for bug#1655552.
*/
public static void ensureOSXCompatibleFolder() {
File nnnAAAAA = new File(
Environment.getExternalStorageDirectory().toString()
+ "/DCIM/100ANDRO");
if ((!nnnAAAAA.exists()) && (!nnnAAAAA.mkdir())) {
Log.e(TAG, "create NNNAAAAA file: " + nnnAAAAA.getPath()
+ " failed");
}
}
public static void debugWhere(String tag, String msg) {
Exception ex = new Exception();
if (msg != null) {
Log.v(tag, msg);
}
boolean first = true;
for (StackTraceElement s : ex.getStackTrace()) {
if (first) {
first = false;
} else {
Log.v(tag, s.toString());
}
}
}
public static DataLocation getDefaultDataLocation() {
return DataLocation.EXTERNAL;
}
/**
* Returns the singleton instance of the ImageManager.
* @return the ImageManager instance.
*/
public static ImageManager instance() {
if (sInstance == null) {
sInstance = new ImageManager();
}
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.location.Location;
import android.net.Uri;
import android.os.Environment;
import android.provider.DrmStore;
import android.provider.MediaStore;
import android.provider.MediaStore.Images;
import android.provider.MediaStore.Images.ImageColumns;
import android.util.Log;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
/**
* ImageManager is used to retrieve and store images
* in the media content provider.
*/
public class ImageManager {
private static final String TAG = "ImageManager";
private static ImageManager sInstance = null;
private static final Uri STORAGE_URI = Images.Media.EXTERNAL_CONTENT_URI;
private static final Uri THUMB_URI
= Images.Thumbnails.EXTERNAL_CONTENT_URI;
private static final Uri VIDEO_STORAGE_URI =
Uri.parse("content://media/external/video/media");
private static final Uri VIDEO_THUMBNAIL_URI =
Uri.parse("content://media/external/video/thumbnails");
/**
* Enumerate type for the location of the images in gallery.
*/
public static enum DataLocation { NONE, INTERNAL, EXTERNAL, ALL }
public static final Bitmap DEFAULT_THUMBNAIL =
Bitmap.createBitmap(32, 32, Bitmap.Config.RGB_565);
public static final Bitmap NO_IMAGE_BITMAP =
Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565);
public static final int SORT_ASCENDING = 1;
public static final int SORT_DESCENDING = 2;
public static final int INCLUDE_IMAGES = (1 << 0);
public static final int INCLUDE_DRM_IMAGES = (1 << 1);
public static final int INCLUDE_VIDEOS = (1 << 2);
public static final String CAMERA_IMAGE_BUCKET_NAME =
Environment.getExternalStorageDirectory().toString()
+ "/DCIM/Camera";
public static final String CAMERA_IMAGE_BUCKET_ID =
getBucketId(CAMERA_IMAGE_BUCKET_NAME);
/**
* Matches code in MediaProvider.computeBucketValues. Should be a common
* function.
*/
public static String getBucketId(String path) {
return String.valueOf(path.toLowerCase().hashCode());
}
/**
* OSX requires plugged-in USB storage to have path /DCIM/NNNAAAAA to be
* imported. This is a temporary fix for bug#1655552.
*/
public static void ensureOSXCompatibleFolder() {
File nnnAAAAA = new File(
Environment.getExternalStorageDirectory().toString()
+ "/DCIM/100ANDRO");
if ((!nnnAAAAA.exists()) && (!nnnAAAAA.mkdir())) {
Log.e(TAG, "create NNNAAAAA file: " + nnnAAAAA.getPath()
+ " failed");
}
}
public static void debugWhere(String tag, String msg) {
Exception ex = new Exception();
if (msg != null) {
Log.v(tag, msg);
}
boolean first = true;
for (StackTraceElement s : ex.getStackTrace()) {
if (first) {
first = false;
} else {
Log.v(tag, s.toString());
}
}
}
public static DataLocation getDefaultDataLocation() {
return DataLocation.EXTERNAL;
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
public static int roundOrientation(int orientationInput) {
int orientation = orientationInput;
if (orientation == -1) { |
| Solution content |
|---|
import com.android.camera.gallery.ImageListUber;
import com.android.camera.gallery.SingleImageList;
import com.android.camera.gallery.VideoList;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.location.Location;
import android.net.Uri;
import android.os.Environment;
import android.provider.DrmStore;
import android.provider.MediaStore;
import android.provider.MediaStore.Images;
import android.provider.MediaStore.Images.ImageColumns;
import android.util.Log;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
/**
* ImageManager is used to retrieve and store images
* in the media content provider.
*/
public class ImageManager {
private static final String TAG = "ImageManager";
private static ImageManager sInstance = null;
private static final Uri STORAGE_URI = Images.Media.EXTERNAL_CONTENT_URI;
private static final Uri THUMB_URI
= Images.Thumbnails.EXTERNAL_CONTENT_URI;
private static final Uri VIDEO_STORAGE_URI =
Uri.parse("content://media/external/video/media");
private static final Uri VIDEO_THUMBNAIL_URI =
Uri.parse("content://media/external/video/thumbnails");
/**
* Enumerate type for the location of the images in gallery.
*/
public static enum DataLocation { NONE, INTERNAL, EXTERNAL, ALL }
public static final Bitmap DEFAULT_THUMBNAIL =
Bitmap.createBitmap(32, 32, Bitmap.Config.RGB_565);
public static final Bitmap NO_IMAGE_BITMAP =
Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565);
public static final int SORT_ASCENDING = 1;
public static final int SORT_DESCENDING = 2;
public static final int INCLUDE_IMAGES = (1 << 0);
public static final int INCLUDE_DRM_IMAGES = (1 << 1);
public static final int INCLUDE_VIDEOS = (1 << 2);
public static final String CAMERA_IMAGE_BUCKET_NAME =
Environment.getExternalStorageDirectory().toString()
+ "/DCIM/Camera";
public static final String CAMERA_IMAGE_BUCKET_ID =
getBucketId(CAMERA_IMAGE_BUCKET_NAME);
/**
* Matches code in MediaProvider.computeBucketValues. Should be a common
* function.
*/
public static String getBucketId(String path) {
return String.valueOf(path.toLowerCase().hashCode());
}
/**
* OSX requires plugged-in USB storage to have path /DCIM/NNNAAAAA to be
* imported. This is a temporary fix for bug#1655552.
*/
public static void ensureOSXCompatibleFolder() {
File nnnAAAAA = new File(
Environment.getExternalStorageDirectory().toString()
+ "/DCIM/100ANDRO");
if ((!nnnAAAAA.exists()) && (!nnnAAAAA.mkdir())) {
Log.e(TAG, "create NNNAAAAA file: " + nnnAAAAA.getPath()
+ " failed");
}
}
public static void debugWhere(String tag, String msg) {
Exception ex = new Exception();
if (msg != null) {
Log.v(tag, msg);
}
boolean first = true;
for (StackTraceElement s : ex.getStackTrace()) {
if (first) {
first = false;
} else {
Log.v(tag, s.toString());
}
}
}
public static DataLocation getDefaultDataLocation() {
return DataLocation.EXTERNAL;
}
public static int roundOrientation(int orientationInput) {
int orientation = orientationInput;
if (orientation == -1) { |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Class signature |
| Comment |
| Enum declaration |
| Import |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
retVal = 0;
}
<<<<<<< HEAD
if (VERBOSE) {
Log.v(TAG, "map orientation " + orientationInput + " to " + retVal);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
return retVal;
}
|
| Solution content |
|---|
retVal = 0;
}
return retVal;
}
|
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
*/
public static boolean isVideo(IImage image) {
return Util.isVideoMimeType(image.getMimeType());
<<<<<<< HEAD
}
public Uri addImage(Context ctx, ContentResolver cr, String title,
=======
}
public static void setImageSize(ContentResolver cr, Uri uri, long size) {
ContentValues values = new ContentValues();
values.put(Images.Media.SIZE, size);
cr.update(uri, values, null, null);
}
public static Uri addImage(ContentResolver cr, String title,
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
long dateTaken, Location location,
int orientation, String directory, String filename) {
|
| Solution content |
|---|
*/
public static boolean isVideo(IImage image) {
return Util.isVideoMimeType(image.getMimeType());
}
public static void setImageSize(ContentResolver cr, Uri uri, long size) {
ContentValues values = new ContentValues();
values.put(Images.Media.SIZE, size);
cr.update(uri, values, null, null);
}
public static Uri addImage(ContentResolver cr, String title,
long dateTaken, Location location,
int orientation, String directory, String filename) {
|
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method declaration |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
ContentValues values = new ContentValues(7);
values.put(Images.Media.TITLE, title);
<<<<<<< HEAD
values.put(Images.Media.DISPLAY_NAME, title);
=======
// That filename is what will be handed to Gmail when a user shares a
// photo. Gmail gets the name of the picture attachment from the
// "DISPLAY_NAME" field.
values.put(Images.Media.DISPLAY_NAME, filename);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
values.put(Images.Media.DATE_TAKEN, dateTaken);
values.put(Images.Media.MIME_TYPE, "image/jpeg");
values.put(Images.Media.ORIENTATION, orientation); |
| Solution content |
|---|
ContentValues values = new ContentValues(7);
values.put(Images.Media.TITLE, title);
// That filename is what will be handed to Gmail when a user shares a
// photo. Gmail gets the name of the picture attachment from the
// "DISPLAY_NAME" field.
values.put(Images.Media.DISPLAY_NAME, filename);
values.put(Images.Media.DATE_TAKEN, dateTaken);
values.put(Images.Media.MIME_TYPE, "image/jpeg");
values.put(Images.Media.ORIENTATION, orientation); |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
String path = parentFile.toString().toLowerCase();
String name = parentFile.getName();
<<<<<<< HEAD
if (VERBOSE) {
Log.v(TAG, "addImage id is " + path.hashCode() + "; name "
+ name + "; path is " + path);
}
if (location != null) {
if (VERBOSE) {
Log.v(TAG, "lat long " + location.getLatitude() + " / "
+ location.getLongitude());
}
=======
if (location != null) {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
values.put(Images.Media.LATITUDE, location.getLatitude());
values.put(Images.Media.LONGITUDE, location.getLongitude());
} |
| Solution content |
|---|
String path = parentFile.toString().toLowerCase();
String name = parentFile.getName();
if (location != null) {
values.put(Images.Media.LATITUDE, location.getLatitude());
values.put(Images.Media.LONGITUDE, location.getLongitude());
} |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
values.put(Images.Media.DATA, value);
}
<<<<<<< HEAD
long t3 = System.currentTimeMillis();
Uri uri = cr.insert(sStorageURI, values);
// The line above will create a filename that ends in .jpg
// That filename is what will be handed to gmail when a user shares a
// photo. Gmail gets the name of the picture attachment from the
// "DISPLAY_NAME" field. Extract the filename and jam it into the
// display name.
String projection[] = new String [] {
ImageColumns._ID, Images.Media.DISPLAY_NAME, Images.Media.DATA};
Cursor c = cr.query(uri, projection, null, null, null);
//TODO: check why we need this
if (c.moveToFirst()) {
String filePath = c.getString(2);
if (filePath != null) {
int pos = filePath.lastIndexOf("/");
if (pos >= 0) {
// pick off the filename
filePath = filePath.substring(pos + 1);
c.updateString(1, filePath);
c.commitUpdates();
}
}
}
c.close();
return uri;
=======
return cr.insert(STORAGE_URI, values);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
private static class AddImageCancelable extends BaseCancelable |
| Solution content |
|---|
}
values.put(Images.Media.DATA, value);
return cr.insert(STORAGE_URI, values);
}
private static class AddImageCancelable extends BaseCancelable |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Method invocation |
| Return statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
private static class AddImageCancelable extends BaseCancelable |
| Solution content |
|---|
private static class AddImageCancelable extends BaseCancelable |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
throw new IllegalArgumentException("source cannot be null");
}
mUri = uri;
<<<<<<< HEAD
mCtx = ctx;
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mCr = cr;
mOrientation = orientation;
mSource = source; |
| Solution content |
|---|
throw new IllegalArgumentException("source cannot be null");
}
mUri = uri;
mCr = cr;
mOrientation = orientation;
mSource = source; |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
@Override
public boolean doCancelWork() {
<<<<<<< HEAD
if (VERBOSE) {
Log.v(TAG, "calling AddImageCancelable.cancel() "
+ mSaveImageCancelable);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
if (mSaveImageCancelable != null) {
mSaveImageCancelable.cancel();
} |
| Solution content |
|---|
@Override
public boolean doCancelWork() {
if (mSaveImageCancelable != null) {
mSaveImageCancelable.cancel();
} |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
public Void get() {
try {
<<<<<<< HEAD
long t1 = System.currentTimeMillis();
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
synchronized (this) {
if (mCancel) {
throw new CanceledException(); |
| Solution content |
|---|
public Void get() {
try {
synchronized (this) {
if (mCancel) {
throw new CanceledException(); |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
long id = ContentUris.parseId(mUri);
<<<<<<< HEAD
BaseImageList il = new ImageList(mCtx, mCr, sStorageURI,
sThumbURI, SORT_ASCENDING, null);
Image image = new Image(id, 0, mCr, il, il.getCount(), 0);
long t5 = System.currentTimeMillis();
=======
BaseImageList il = new ImageList(mCr, STORAGE_URI,
THUMB_URI, SORT_ASCENDING, null);
Image image = new Image(id, 0, mCr, il, il.getCount(), 0);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
String[] projection = new String[] {
ImageColumns._ID,
ImageColumns.MINI_THUMB_MAGIC, ImageColumns.DATA}; |
| Solution content |
|---|
}
long id = ContentUris.parseId(mUri);
BaseImageList il = new ImageList(mCr, STORAGE_URI,
THUMB_URI, SORT_ASCENDING, null);
Image image = new Image(id, 0, mCr, il, il.getCount(), 0);
String[] projection = new String[] {
ImageColumns._ID,
ImageColumns.MINI_THUMB_MAGIC, ImageColumns.DATA}; |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
ImageColumns.MINI_THUMB_MAGIC, ImageColumns.DATA};
Cursor c = mCr.query(mUri, projection, null, null, null);
<<<<<<< HEAD
c.moveToPosition(0);
synchronized (this) {
checkCanceled();
mSaveImageCancelable = image.saveImageContents(
mSource, mJpegData, mOrientation, true, c);
}
if (mSaveImageCancelable.get()) {
long t6 = System.currentTimeMillis();
if (VERBOSE) {
Log.v(TAG, "saveImageContents took " + (t6 - t5));
Log.v(TAG, "updating new picture with id " + id);
}
c.updateLong(1, id);
c.commitUpdates();
c.close();
long t7 = System.currentTimeMillis();
if (VERBOSE) {
Log.v(TAG, "commit updates to save mini thumb took "
+ (t7 - t6));
}
} else {
c.close();
throw new CanceledException();
}
} catch (CanceledException ex) {
if (VERBOSE) {
Log.v(TAG, "caught CanceledException");
}
if (mUri != null) {
if (VERBOSE) {
Log.v(TAG, "canceled... cleaning up this uri: " + mUri);
}
mCr.delete(mUri, null, null);
}
=======
try {
c.moveToPosition(0);
synchronized (this) {
checkCanceled();
mSaveImageCancelable = image.saveImageContents(
mSource, mJpegData, mOrientation, true,
c.getString(2));
}
} finally {
c.close();
}
if (mSaveImageCancelable.get()) {
ContentValues values = new ContentValues();
values.put(ImageColumns.MINI_THUMB_MAGIC, 0);
mCr.update(mUri, values, null, null);
} else {
throw new CanceledException();
}
} catch (CanceledException ex) {
if (mUri != null) {
mCr.delete(mUri, null, null);
}
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
acknowledgeCancel();
}
return null; |
| Solution content |
|---|
ImageColumns.MINI_THUMB_MAGIC, ImageColumns.DATA};
Cursor c = mCr.query(mUri, projection, null, null, null);
try {
c.moveToPosition(0);
synchronized (this) {
checkCanceled();
mSaveImageCancelable = image.saveImageContents(
mSource, mJpegData, mOrientation, true,
c.getString(2));
}
} finally {
c.close();
}
if (mSaveImageCancelable.get()) {
ContentValues values = new ContentValues();
values.put(ImageColumns.MINI_THUMB_MAGIC, 0);
mCr.update(mUri, values, null, null);
} else {
throw new CanceledException();
}
} catch (CanceledException ex) {
if (mUri != null) {
mCr.delete(mUri, null, null);
}
acknowledgeCancel();
}
return null; |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Catch clause |
| If statement |
| Method invocation |
| Synchronized statement |
| Try statement |
| Chunk |
|---|
| Conflicting content |
|---|
}
}
<<<<<<< HEAD
public ICancelable |
| Solution content |
|---|
}
}
public static ICancelable |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
IImageList imageList;
if (uriString.startsWith("content://drm")) {
<<<<<<< HEAD
imageList = ImageManager.instance().allImages(
ctx, cr, ImageManager.DataLocation.ALL,
=======
imageList = ImageManager.allImages(
cr, ImageManager.DataLocation.ALL,
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
ImageManager.INCLUDE_DRM_IMAGES, sort);
} else if (isSingleImageMode(uriString)) {
imageList = new SingleImageList(cr, uri); |
| Solution content |
|---|
IImageList imageList;
if (uriString.startsWith("content://drm")) {
imageList = ImageManager.allImages(
cr, ImageManager.DataLocation.ALL,
ImageManager.INCLUDE_DRM_IMAGES, sort);
} else if (isSingleImageMode(uriString)) {
imageList = new SingleImageList(cr, uri); |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
imageList = new SingleImageList(cr, uri);
} else {
String bucketId = uri.getQueryParameter("bucketId");
<<<<<<< HEAD
if (VERBOSE) {
Log.v(TAG, "bucketId is " + bucketId);
}
imageList = ImageManager.instance().allImages(
ctx, cr, ImageManager.DataLocation.ALL,
=======
imageList = ImageManager.allImages(
cr, ImageManager.DataLocation.ALL,
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
ImageManager.INCLUDE_IMAGES, sort, bucketId);
}
return imageList; |
| Solution content |
|---|
imageList = new SingleImageList(cr, uri);
} else {
String bucketId = uri.getQueryParameter("bucketId");
imageList = ImageManager.allImages(
cr, ImageManager.DataLocation.ALL,
ImageManager.INCLUDE_IMAGES, sort, bucketId);
}
return imageList; |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
&& !uriString.startsWith(
MediaStore.Images.Media.INTERNAL_CONTENT_URI.toString());
}
<<<<<<< HEAD
private static class EmptyImageList implements IImageList {
public void checkThumbnails(IImageList.ThumbCheckCallback cb,
int totalThumbnails) {
}
public void commitChanges() {
}
public void deactivate() {
}
public HashMap |
| Solution content |
|---|
&& !uriString.startsWith(
MediaStore.Images.Media.INTERNAL_CONTENT_URI.toString());
}
private static class EmptyImageList implements IImageList {
public void checkThumbnails(IImageList.ThumbCheckCallback cb,
int totalThumbnails) {
}
public void deactivate() {
}
public HashMap |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Class declaration |
| If statement |
| Method declaration |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
// use this code to merge videos and stills into the same list
ArrayList |
| Solution content |
|---|
// use this code to merge videos and stills into the same list
ArrayList |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Catch clause |
| Comment |
| If statement |
| Method invocation |
| Return statement |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
public static boolean hasStorage(boolean requireWriteAccess) {
<<<<<<< HEAD
//TODO: After fix the bug, add "if (VERBOSE)" before logging errors.
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) { |
| Solution content |
|---|
}
public static boolean hasStorage(boolean requireWriteAccess) {
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) { |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
public static boolean isMediaScannerScanning(ContentResolver cr) {
boolean result = false;
<<<<<<< HEAD
Cursor cursor = query(context, MediaStore.getMediaScannerUri(),
=======
Cursor cursor = query(cr, MediaStore.getMediaScannerUri(),
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
new String [] {MediaStore.MEDIA_SCANNER_VOLUME},
null, null, null);
if (cursor != null) { |
| Solution content |
|---|
public static boolean isMediaScannerScanning(ContentResolver cr) {
boolean result = false;
Cursor cursor = query(cr, MediaStore.getMediaScannerUri(),
new String [] {MediaStore.MEDIA_SCANNER_VOLUME},
null, null, null);
if (cursor != null) { |
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
cursor.close();
}
<<<<<<< HEAD
if (VERBOSE) {
Log.v(TAG, "isMediaScannerScanning returning " + result);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
return result;
}
|
| Solution content |
|---|
cursor.close();
}
return result;
}
|
| File |
|---|
| ImageManager.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
import android.os.Handler;
import android.util.AttributeSet;
import android.view.KeyEvent;
<<<<<<< HEAD
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
import android.widget.ImageView;
abstract class ImageViewTouchBase extends ImageView { |
| Solution content |
|---|
import android.os.Handler;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.ImageView;
abstract class ImageViewTouchBase extends ImageView { |
| File |
|---|
| ImageViewTouchBase.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
protected Bitmap mBitmapDisplayed;
int mThisWidth = -1, mThisHeight = -1;
<<<<<<< HEAD
float mMaxZoom;
// ImageViewTouchBase will pass a Bitmap to the Recycler if it has finished
// its use of that Bitmap.
public interface Recycler {
public void recycle(Bitmap b);
}
public void setRecycler(Recycler r) {
mRecycler = r;
}
=======
float mMaxZoom;
// ImageViewTouchBase will pass a Bitmap to the Recycler if it has finished
// its use of that Bitmap.
public interface Recycler {
public void recycle(Bitmap b);
}
public void setRecycler(Recycler r) {
mRecycler = r;
}
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
private Recycler mRecycler;
@Override |
| Solution content |
|---|
protected Bitmap mBitmapDisplayed;
int mThisWidth = -1, mThisHeight = -1;
float mMaxZoom;
// ImageViewTouchBase will pass a Bitmap to the Recycler if it has finished
// its use of that Bitmap.
public interface Recycler {
public void recycle(Bitmap b);
}
public void setRecycler(Recycler r) {
mRecycler = r;
}
private Recycler mRecycler;
@Override |
| File |
|---|
| ImageViewTouchBase.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Interface declaration |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
// view's dimensions then center it (literally). If the image
// is scaled larger than the view and is translated out of view
// then translate it back into view (i.e. eliminate black bars).
<<<<<<< HEAD
protected void center(boolean vertical, boolean horizontal,
boolean animate) {
=======
protected void center(boolean vertical, boolean horizontal) {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
if (mBitmapDisplayed == null) {
return;
} |
| Solution content |
|---|
// view's dimensions then center it (literally). If the image
// is scaled larger than the view and is translated out of view
// then translate it back into view (i.e. eliminate black bars).
protected void center(boolean vertical, boolean horizontal) {
if (mBitmapDisplayed == null) {
return;
} |
| File |
|---|
| ImageViewTouchBase.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
mSuppMatrix.postScale(1F / rate, 1F / rate, cx, cy);
}
setImageMatrix(getImageViewMatrix());
<<<<<<< HEAD
center(true, true, false);
=======
center(true, true);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
protected void postTranslate(float dx, float dy) { |
| Solution content |
|---|
mSuppMatrix.postScale(1F / rate, 1F / rate, cx, cy);
}
setImageMatrix(getImageViewMatrix());
center(true, true);
}
protected void postTranslate(float dx, float dy) { |
| File |
|---|
| ImageViewTouchBase.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
import android.provider.MediaStore; import android.provider.MediaStore.Images; import android.text.format.Formatter; <<<<<<< HEAD import android.util.Config; ======= >>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f import android.util.Log; import android.view.Menu; import android.view.MenuItem; |
| Solution content |
|---|
import android.provider.MediaStore; import android.provider.MediaStore.Images; import android.text.format.Formatter; import android.util.Log; import android.view.Menu; import android.view.MenuItem; |
| File |
|---|
| MenuHelper.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
}
boolean readOnly = image.isReadonly();
boolean isDrm = image.isDrm();
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "readOnly: " + readOnly + "; drm: " + isDrm);
}
for (MenuItem item : requiresWriteAccessItems) {
if (Config.LOGV) {
Log.v(TAG, "item is " + item.toString());
}
=======
for (MenuItem item : requiresWriteAccessItems) {
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
item.setVisible(!readOnly);
item.setEnabled(!readOnly);
} |
| Solution content |
|---|
}
boolean readOnly = image.isReadonly();
boolean isDrm = image.isDrm();
for (MenuItem item : requiresWriteAccessItems) {
item.setVisible(!readOnly);
item.setEnabled(!readOnly);
} |
| File |
|---|
| MenuHelper.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| For statement |
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
item.setEnabled(!readOnly);
}
for (MenuItem item : requiresNoDrmAccessItems) {
<<<<<<< HEAD
if (Config.LOGV) {
Log.v(TAG, "item is " + item.toString());
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
item.setVisible(!isDrm);
item.setEnabled(!isDrm);
} |
| Solution content |
|---|
item.setEnabled(!readOnly);
}
for (MenuItem item : requiresNoDrmAccessItems) {
item.setVisible(!isDrm);
item.setEnabled(!isDrm);
} |
| File |
|---|
| MenuHelper.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
static void deletePhoto(Activity activity, Runnable onDelete) {
deleteImpl(activity, onDelete, true);
<<<<<<< HEAD
}
static void deleteVideo(Activity activity, Runnable onDelete) {
deleteImpl(activity, onDelete, false);
}
=======
}
static void deleteVideo(Activity activity, Runnable onDelete) {
deleteImpl(activity, onDelete, false);
}
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
static void deleteImage(Activity activity, Runnable onDelete,
IImage image) {
if (image != null) { |
| Solution content |
|---|
static void deletePhoto(Activity activity, Runnable onDelete) {
deleteImpl(activity, onDelete, true);
}
static void deleteVideo(Activity activity, Runnable onDelete) {
deleteImpl(activity, onDelete, false);
}
static void deleteImage(Activity activity, Runnable onDelete,
IImage image) {
if (image != null) { |
| File |
|---|
| MenuHelper.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
import android.content.res.Resources; import android.graphics.PixelFormat; import android.os.Handler; <<<<<<< HEAD import android.util.Log; ======= >>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; |
| Solution content |
|---|
import android.content.res.Resources; import android.graphics.PixelFormat; import android.os.Handler; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; |
| File |
|---|
| OnScreenHint.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
private final WindowManager.LayoutParams mParams =
new WindowManager.LayoutParams();
<<<<<<< HEAD
private WindowManager mWM;
=======
private final WindowManager mWM;
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
private final Handler mHandler = new Handler();
/** |
| Solution content |
|---|
private final WindowManager.LayoutParams mParams =
new WindowManager.LayoutParams();
private final WindowManager mWM;
private final Handler mHandler = new Handler();
/** |
| File |
|---|
| OnScreenHint.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Chunk |
|---|
| Conflicting content |
|---|
if (mNextView == null) {
throw new RuntimeException("setView must have been called");
}
<<<<<<< HEAD
if (LOCAL_LOGV) {
Log.v(TAG, "SHOW: " + this);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mHandler.post(mShow);
}
|
| Solution content |
|---|
if (mNextView == null) {
throw new RuntimeException("setView must have been called");
}
mHandler.post(mShow);
}
|
| File |
|---|
| OnScreenHint.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
* Close the view if it's showing.
*/
public void cancel() {
<<<<<<< HEAD
if (LOCAL_LOGV) {
Log.v(TAG, "HIDE: " + this);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mHandler.post(mHide);
}
|
| Solution content |
|---|
* Close the view if it's showing.
*/
public void cancel() {
mHandler.post(mHide);
}
|
| File |
|---|
| OnScreenHint.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
}
private synchronized void handleShow() {
<<<<<<< HEAD
if (LOCAL_LOGV) {
Log.v(TAG, "HANDLE SHOW: " + this + " mView=" + mView
+ " mNextView=" + mNextView);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
if (mView != mNextView) {
// remove the old view if necessary
handleHide(); |
| Solution content |
|---|
}
private synchronized void handleShow() {
if (mView != mNextView) {
// remove the old view if necessary
handleHide(); |
| File |
|---|
| OnScreenHint.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
mParams.verticalMargin = mVerticalMargin;
mParams.horizontalMargin = mHorizontalMargin;
if (mView.getParent() != null) {
<<<<<<< HEAD
if (LOCAL_LOGV) {
Log.v(TAG, "REMOVE! " + mView + " in " + this);
}
mWM.removeView(mView);
}
if (LOCAL_LOGV) {
Log.v(TAG, "ADD! " + mView + " in " + this);
}
=======
mWM.removeView(mView);
}
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mWM.addView(mView, mParams);
}
} |
| Solution content |
|---|
mParams.verticalMargin = mVerticalMargin;
mParams.horizontalMargin = mHorizontalMargin;
if (mView.getParent() != null) {
mWM.removeView(mView);
}
mWM.addView(mView, mParams);
}
} |
| File |
|---|
| OnScreenHint.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
private synchronized void handleHide() {
<<<<<<< HEAD
if (LOCAL_LOGV) {
Log.v(TAG, "HANDLE HIDE: " + this + " mView=" + mView);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
if (mView != null) {
// note: checking parent() just to make sure the view has
// been added... i have seen cases where we get here when |
| Solution content |
|---|
}
private synchronized void handleHide() {
if (mView != null) {
// note: checking parent() just to make sure the view has
// been added... i have seen cases where we get here when |
| File |
|---|
| OnScreenHint.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
// been added... i have seen cases where we get here when
// the view isn't yet added, so let's try not to crash.
if (mView.getParent() != null) {
<<<<<<< HEAD
if (LOCAL_LOGV) {
Log.v(TAG, "REMOVE! " + mView + " in " + this);
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mWM.removeView(mView);
}
mView = null; |
| Solution content |
|---|
// been added... i have seen cases where we get here when
// the view isn't yet added, so let's try not to crash.
if (mView.getParent() != null) {
mWM.removeView(mView);
}
mView = null; |
| File |
|---|
| OnScreenHint.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
// This is dangerous because the caller could set bitmaps on
// appWidgetIds they don't own, so we guard this call at the manifest
// level by requiring the BIND_APPWIDGET permission.
<<<<<<< HEAD
final Intent intent = getIntent();
final Bundle extras = intent.getExtras();
=======
final Intent intent = getIntent();
final Bundle extras = intent.getExtras();
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
final int[] appWidgetIds =
extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
final ArrayList |
| Solution content |
|---|
// This is dangerous because the caller could set bitmaps on
// appWidgetIds they don't own, so we guard this call at the manifest
// level by requiring the BIND_APPWIDGET permission.
final Intent intent = getIntent();
final Bundle extras = intent.getExtras();
final int[] appWidgetIds =
extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
final ArrayList |
| File |
|---|
| PhotoAppWidgetBind.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
final ArrayList |
| Solution content |
|---|
extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
final ArrayList |
| File |
|---|
| PhotoAppWidgetBind.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; <<<<<<< HEAD import android.location.LocationManager; ======= >>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f import android.media.MediaRecorder; import android.net.Uri; import android.os.Bundle; |
| Solution content |
|---|
import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.media.MediaRecorder; import android.net.Uri; import android.os.Bundle; |
| File |
|---|
| VideoCamera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
private boolean mIsVideoCaptureIntent;
// mLastPictureButton and mThumbController
<<<<<<< HEAD
// are non-null only if isVideoCaptureIntent() is true;
=======
// are non-null only if mIsVideoCaptureIntent is true.
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
private ImageView mLastPictureButton;
private ThumbnailController mThumbController;
|
| Solution content |
|---|
private boolean mIsVideoCaptureIntent;
// mLastPictureButton and mThumbController
// are non-null only if mIsVideoCaptureIntent is true.
private ImageView mLastPictureButton;
private ThumbnailController mThumbController;
|
| File |
|---|
| VideoCamera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
boolean mPausing = false;
private ContentResolver mContentResolver;
<<<<<<< HEAD
int mCurrentZoomIndex = 0;
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
private ShutterButton mShutterButton;
private TextView mRecordingTimeView; |
| Solution content |
|---|
boolean mPausing = false;
private ContentResolver mContentResolver;
private ShutterButton mShutterButton;
private TextView mRecordingTimeView; |
| File |
|---|
| VideoCamera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Chunk |
|---|
| Conflicting content |
|---|
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
<<<<<<< HEAD
mLocationManager = (LocationManager) getSystemService(
Context.LOCATION_SERVICE);
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
mContentResolver = getContentResolver();
|
| Solution content |
|---|
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
mContentResolver = getContentResolver();
|
| File |
|---|
| VideoCamera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Cast expression |
| Chunk |
|---|
| Conflicting content |
|---|
}
private void updateLastVideo() {
<<<<<<< HEAD
IImageList list = ImageManager.instance().allImages(
this,
=======
IImageList list = ImageManager.allImages(
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mContentResolver,
dataLocation(),
ImageManager.INCLUDE_VIDEOS, |
| Solution content |
|---|
}
private void updateLastVideo() {
IImageList list = ImageManager.allImages(
mContentResolver,
dataLocation(),
ImageManager.INCLUDE_VIDEOS, |
| File |
|---|
| VideoCamera.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
mThumbController.setData(null, null);
}
list.deactivate();
<<<<<<< HEAD
}
private static final String[] DATA_PATH_PROJECTION = new String[] {
"_data"
};
private String getDataPath(Uri uri) {
Cursor c = null;
try {
c = mContentResolver.query(uri, DATA_PATH_PROJECTION, null, null,
null);
if (c != null && c.moveToFirst()) {
return c.getString(0);
} else {
return null;
}
} finally {
if (c != null) {
c.close();
}
=======
}
private static final String[] DATA_PATH_PROJECTION = new String[] {
"_data"
};
private String getDataPath(Uri uri) {
Cursor c = null;
try {
c = mContentResolver.query(uri, DATA_PATH_PROJECTION, null, null,
null);
if (c != null && c.moveToFirst()) {
return c.getString(0);
} else {
return null;
}
} finally {
if (c != null) {
c.close();
}
}
}
private void updateRecordingTime() {
if (!mMediaRecorderRecording) {
return;
}
long now = SystemClock.uptimeMillis();
long delta = now - mRecordingStartTime;
// Starting a minute before reaching the max duration
// limit, we'll countdown the remaining time instead.
boolean countdownRemainingTime =
(delta >= MAX_RECORDING_DURATION_MS - 60000);
if (countdownRemainingTime) {
delta = Math.max(0, MAX_RECORDING_DURATION_MS - delta);
}
long seconds = (delta + 500) / 1000; // round to nearest
long minutes = seconds / 60;
long hours = minutes / 60;
long remainderMinutes = minutes - (hours * 60);
long remainderSeconds = seconds - (minutes * 60);
String secondsString = Long.toString(remainderSeconds);
if (secondsString.length() < 2) {
secondsString = "0" + secondsString;
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
String minutesString = Long.toString(remainderMinutes);
if (minutesString.length() < 2) { |
| Solution content |
|---|
mThumbController.setData(null, null);
}
list.deactivate();
}
private static final String[] DATA_PATH_PROJECTION = new String[] {
"_data"
};
private String getDataPath(Uri uri) {
Cursor c = null;
try {
c = mContentResolver.query(uri, DATA_PATH_PROJECTION, null, null,
null);
if (c != null && c.moveToFirst()) {
return c.getString(0);
} else {
return null;
}
} finally {
if (c != null) {
c.close();
}
}
}
private void updateRecordingTime() {
if (!mMediaRecorderRecording) {
return;
}
long now = SystemClock.uptimeMillis();
long delta = now - mRecordingStartTime;
// Starting a minute before reaching the max duration
// limit, we'll countdown the remaining time instead.
boolean countdownRemainingTime =
(delta >= MAX_RECORDING_DURATION_MS - 60000);
if (countdownRemainingTime) {
delta = Math.max(0, MAX_RECORDING_DURATION_MS - delta);
}
long seconds = (delta + 500) / 1000; // round to nearest
long minutes = seconds / 60;
long hours = minutes / 60;
long remainderMinutes = minutes - (hours * 60);
long remainderSeconds = seconds - (minutes * 60);
String secondsString = Long.toString(remainderSeconds);
if (secondsString.length() < 2) {
secondsString = "0" + secondsString;
}
String minutesString = Long.toString(remainderMinutes);
if (minutesString.length() < 2) {
minutesString = "0" + minutesString;
}
String text = minutesString + ":" + secondsString;
if (hours > 0) {
String hoursString = Long.toString(hours);
if (hoursString.length() < 2) {
hoursString = "0" + hoursString;
}
text = hoursString + ":" + text;
}
mRecordingTimeView.setText(text);
if (mRecordingTimeCountsDown != countdownRemainingTime) {
// Avoid setting the color on every update, do it only
// when it needs changing.
mRecordingTimeCountsDown = countdownRemainingTime;
int color = getResources().getColor(
countdownRemainingTime
? R.color.recording_time_remaining_text
: R.color.recording_time_elapsed_text);
mRecordingTimeView.setTextColor(color);
}
// Work around a limitation of the T-Mobile G1: The T-Mobile
// hardware blitter can't pixel-accurately scale and clip at the
// same time, and the SurfaceFlinger doesn't attempt to work around
// this limitation. In order to avoid visual corruption we must
// manually refresh the entire surface view when changing any
// overlapping view's contents.
mVideoPreview.invalidate();
mHandler.sendEmptyMessageDelayed(UPDATE_RECORD_TIME, 1000);
}
} |
| File |
|---|
| VideoCamera.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
mShutterButton.setVisibility(View.GONE);
findViewById(R.id.slideShowContainer).getRootView().requestLayout();
<<<<<<< HEAD
=======
// The preferences we want to read:
// mUseShuffleOrder
// mSlideShowLoop
// mAnimationIndex
// mSlideShowInterval
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mUseShuffleOrder = mPrefs.getBoolean(
"pref_gallery_slideshow_shuffle_key", false);
mSlideShowLoop = mPrefs.getBoolean( |
| Solution content |
|---|
mShutterButton.setVisibility(View.GONE);
findViewById(R.id.slideShowContainer).getRootView().requestLayout();
// The preferences we want to read:
// mUseShuffleOrder
// mSlideShowLoop
// mAnimationIndex
// mSlideShowInterval
mUseShuffleOrder = mPrefs.getBoolean(
"pref_gallery_slideshow_shuffle_key", false);
mSlideShowLoop = mPrefs.getBoolean( |
| File |
|---|
| ViewImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
int sort = mSortAscending
? ImageManager.SORT_ASCENDING
: ImageManager.SORT_DESCENDING;
<<<<<<< HEAD
mAllImages = ImageManager.makeImageList(uri, this, sort);
=======
mAllImages = ImageManager.makeImageList(uri, getContentResolver(),
sort);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
uri = uri.buildUpon().query(null).build();
// TODO smarter/faster here please |
| Solution content |
|---|
int sort = mSortAscending
? ImageManager.SORT_ASCENDING
: ImageManager.SORT_DESCENDING;
mAllImages = ImageManager.makeImageList(uri, getContentResolver(),
sort);
uri = uri.buildUpon().query(null).build();
// TODO smarter/faster here please |
| File |
|---|
| ViewImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
if (getIntent() != null && getIntent().getData() != null) {
bucket = getIntent().getData().getQueryParameter("bucketId");
}
<<<<<<< HEAD
if (bucket != null) {
uri = uri.buildUpon().appendQueryParameter("bucketId", bucket)
.build();
}
}
return uri;
}
@Override
public void onSaveInstanceState(Bundle b) {
super.onSaveInstanceState(b);
=======
if (bucket != null) {
uri = uri.buildUpon().appendQueryParameter("bucketId", bucket)
.build();
}
}
return uri;
}
@Override
public void onSaveInstanceState(Bundle b) {
super.onSaveInstanceState(b);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
Uri uri = getCurrentUri();
if (uri != null) {
b.putString("uri", uri.toString()); |
| Solution content |
|---|
if (getIntent() != null && getIntent().getData() != null) {
bucket = getIntent().getData().getQueryParameter("bucketId");
}
if (bucket != null) {
uri = uri.buildUpon().appendQueryParameter("bucketId", bucket)
.build();
}
}
return uri;
}
@Override
public void onSaveInstanceState(Bundle b) {
super.onSaveInstanceState(b);
Uri uri = getCurrentUri();
if (uri != null) {
b.putString("uri", uri.toString()); |
| File |
|---|
| ViewImage.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| If statement |
| Method invocation |
| Method signature |
| Return statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
protected void postTranslateCenter(float dx, float dy) {
super.postTranslate(dx, dy);
<<<<<<< HEAD
center(true, true, false);
=======
center(true, true);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
static final float PAN_RATE = 20; |
| Solution content |
|---|
protected void postTranslateCenter(float dx, float dy) {
super.postTranslate(dx, dy);
center(true, true);
}
static final float PAN_RATE = 20; |
| File |
|---|
| ViewImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
nextImagePos = current - 1;
} else {
panBy(PAN_RATE, 0);
<<<<<<< HEAD
center(true, false, true);
=======
center(true, false);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
return true;
} |
| Solution content |
|---|
nextImagePos = current - 1;
} else {
panBy(PAN_RATE, 0);
center(true, false);
}
return true;
} |
| File |
|---|
| ViewImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
nextImagePos = current + 1;
} else {
panBy(-PAN_RATE, 0);
<<<<<<< HEAD
center(true, false, true);
=======
center(true, false);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
return true;
} |
| Solution content |
|---|
nextImagePos = current + 1;
} else {
panBy(-PAN_RATE, 0);
center(true, false);
}
return true;
} |
| File |
|---|
| ViewImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
case KeyEvent.KEYCODE_DPAD_UP: {
panBy(0, PAN_RATE);
<<<<<<< HEAD
center(true, false, false);
=======
center(false, true);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
return true;
}
case KeyEvent.KEYCODE_DPAD_DOWN: { |
| Solution content |
|---|
}
case KeyEvent.KEYCODE_DPAD_UP: {
panBy(0, PAN_RATE);
center(false, true);
return true;
}
case KeyEvent.KEYCODE_DPAD_DOWN: { |
| File |
|---|
| ViewImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
case KeyEvent.KEYCODE_DPAD_DOWN: {
panBy(0, -PAN_RATE);
<<<<<<< HEAD
center(true, false, false);
=======
center(false, true);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
return true;
}
case KeyEvent.KEYCODE_DEL: |
| Solution content |
|---|
}
case KeyEvent.KEYCODE_DPAD_DOWN: {
panBy(0, -PAN_RATE);
center(false, true);
return true;
}
case KeyEvent.KEYCODE_DEL: |
| File |
|---|
| ViewImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
mViewImage.setImage(nextImagePos);
}
} else if (nextImagePos != -2) {
<<<<<<< HEAD
center(true, true, false);
=======
center(true, true);
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
}
}
|
| Solution content |
|---|
mViewImage.setImage(nextImagePos);
}
} else if (nextImagePos != -2) {
center(true, true);
}
}
|
| File |
|---|
| ViewImage.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
+ "Couldn't get bitmap for path "
+ mTempFilePath);
} else {
<<<<<<< HEAD
if (android.util.Config.LOGV) {
Log.v(LOG_TAG, "bitmap size is "
+ bitmap.getWidth()
+ " / " + bitmap.getHeight());
}
=======
>>>>>>> 5e5aa7e1e8bd03e9919d5f14b9f5df75cf68ff8f
mHandler.sendEmptyMessage(SHOW_PROGRESS);
new SetWallpaperThread(bitmap, mHandler,
this, tempFile).start(); |
| Solution content |
|---|
+ "Couldn't get bitmap for path "
+ mTempFilePath);
} else {
mHandler.sendEmptyMessage(SHOW_PROGRESS);
new SetWallpaperThread(bitmap, mHandler,
this, tempFile).start(); |
| File |
|---|
| Wallpaper.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |