summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/camera/EffectsRecorder.java8
-rwxr-xr-xsrc/com/android/camera/VideoCamera.java17
-rwxr-xr-xsrc/com/android/camera/panorama/PanoramaActivity.java38
-rw-r--r--src/com/android/camera/ui/IndicatorControlBar.java4
-rw-r--r--src/com/android/camera/ui/IndicatorControlWheel.java30
5 files changed, 61 insertions, 36 deletions
diff --git a/src/com/android/camera/EffectsRecorder.java b/src/com/android/camera/EffectsRecorder.java
index 390efa6..3d2aebf 100644
--- a/src/com/android/camera/EffectsRecorder.java
+++ b/src/com/android/camera/EffectsRecorder.java
@@ -798,7 +798,13 @@ public class EffectsRecorder {
if (result == GraphRunner.RESULT_ERROR) {
// Handle error case
Log.e(TAG, "Error running filter graph!");
- raiseError(mRunner == null ? null : mRunner.getError());
+ Exception e = null;
+ if (mRunner != null) {
+ e = mRunner.getError();
+ } else if (mOldRunner != null) {
+ e = mOldRunner.getError();
+ }
+ raiseError(e);
}
if (mOldRunner != null) {
// Tear down old graph if available
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 1e90544..80a9a4c 100755
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -192,6 +192,7 @@ public class VideoCamera extends ActivityBase
private String mPrefVideoEffectDefault;
private boolean mResetEffect = true;
public static final String RESET_EFFECT_EXTRA = "reset_effect";
+ public static final String BACKGROUND_URI_GALLERY_EXTRA = "background_uri_gallery";
private boolean mMediaRecorderRecording = false;
private long mRecordingStartTime;
@@ -371,6 +372,9 @@ public class VideoCamera extends ActivityBase
// Do not reset the effect if users are switching between back and front
// cameras.
mResetEffect = getIntent().getBooleanExtra(RESET_EFFECT_EXTRA, true);
+ // If background replacement was on when the camera was switched, the
+ // background uri will be sent via the intent.
+ mEffectUriFromGallery = getIntent().getStringExtra(BACKGROUND_URI_GALLERY_EXTRA);
resetEffect();
/*
@@ -2112,14 +2116,19 @@ public class VideoCamera extends ActivityBase
// Restart the activity to have a crossfade animation.
// TODO: Use SurfaceTexture to implement a better and faster
// animation.
+ Intent intent;
if (mIsVideoCaptureIntent) {
// If the intent is video capture, stay in video capture mode.
- Intent intent = getIntent();
- intent.putExtra(RESET_EFFECT_EXTRA, false);
- MenuHelper.gotoVideoMode(this, intent);
+ intent = getIntent();
} else {
- MenuHelper.gotoVideoMode(this, false);
+ intent = new Intent(MediaStore.INTENT_ACTION_VIDEO_CAMERA);
}
+ // To maintain the same background in background replacer, we
+ // need to send the background video uri via the Intent (apart
+ // from the condition that the effects should not be reset).
+ intent.putExtra(BACKGROUND_URI_GALLERY_EXTRA, mEffectUriFromGallery);
+ intent.putExtra(RESET_EFFECT_EXTRA, false);
+ MenuHelper.gotoVideoMode(this, intent);
finish();
} else {
readVideoPreferences();
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java
index 6978477..a99e7be 100755
--- a/src/com/android/camera/panorama/PanoramaActivity.java
+++ b/src/com/android/camera/panorama/PanoramaActivity.java
@@ -140,11 +140,6 @@ public class PanoramaActivity extends ActivityBase implements
private int mTraversedAngleX;
private int mTraversedAngleY;
private long mTimestamp;
- // Control variables for the terminate condition.
- private int mMinAngleX;
- private int mMaxAngleX;
- private int mMinAngleY;
- private int mMaxAngleY;
private RotateImageView mThumbnailView;
private Thumbnail mThumbnail;
@@ -165,6 +160,7 @@ public class PanoramaActivity extends ActivityBase implements
private boolean mCancelComputation;
private float[] mTransformMatrix;
private float mHorizontalViewAngle;
+ private float mVerticalViewAngle;
// Prefer FOCUS_MODE_INFINITY to FOCUS_MODE_CONTINUOUS_VIDEO because of
// getting a better image quality by the former.
@@ -410,8 +406,8 @@ public class PanoramaActivity extends ActivityBase implements
parameters.setRecordingHint(false);
- mHorizontalViewAngle = (((mDeviceOrientation / 90) % 2) == 0) ?
- parameters.getHorizontalViewAngle() : parameters.getVerticalViewAngle();
+ mHorizontalViewAngle = parameters.getHorizontalViewAngle();
+ mVerticalViewAngle = parameters.getVerticalViewAngle();
}
public int getPreviewBufSize() {
@@ -546,22 +542,23 @@ public class PanoramaActivity extends ActivityBase implements
mCompassValueXStart = mCompassValueXStartBuffer;
mCompassValueYStart = mCompassValueYStartBuffer;
- mMinAngleX = 0;
- mMaxAngleX = 0;
- mMinAngleY = 0;
- mMaxAngleY = 0;
mTimestamp = 0;
mMosaicFrameProcessor.setProgressListener(new MosaicFrameProcessor.ProgressListener() {
@Override
public void onProgress(boolean isFinished, float panningRateX, float panningRateY,
float progressX, float progressY) {
+ float accumulatedHorizontalAngle = progressX * mHorizontalViewAngle;
+ float accumulatedVerticalAngle = progressY * mVerticalViewAngle;
if (isFinished
- || (mMaxAngleX - mMinAngleX >= DEFAULT_SWEEP_ANGLE)
- || (mMaxAngleY - mMinAngleY >= DEFAULT_SWEEP_ANGLE)) {
+ || (Math.abs(accumulatedHorizontalAngle) >= DEFAULT_SWEEP_ANGLE)
+ || (Math.abs(accumulatedVerticalAngle) >= DEFAULT_SWEEP_ANGLE)) {
stopCapture(false);
} else {
- updateProgress(panningRateX, progressX, progressY);
+ float panningRateXInDegree = panningRateX * mHorizontalViewAngle;
+ float panningRateYInDegree = panningRateY * mVerticalViewAngle;
+ updateProgress(panningRateXInDegree, panningRateYInDegree,
+ accumulatedHorizontalAngle, accumulatedVerticalAngle);
}
}
});
@@ -630,19 +627,25 @@ public class PanoramaActivity extends ActivityBase implements
mRightIndicator.setEnabled(false);
}
- private void updateProgress(float panningRate, float progressX, float progressY) {
+ private void updateProgress(float panningRateXInDegree, float panningRateYInDegree,
+ float progressHorizontalAngle, float progressVerticalAngle) {
mMosaicView.setReady();
mMosaicView.requestRender();
// TODO: Now we just display warning message by the panning speed.
// Since we only support horizontal panning, we should display a warning message
// in UI when there're significant vertical movements.
- if (Math.abs(panningRate * mHorizontalViewAngle) > PANNING_SPEED_THRESHOLD) {
+ if ((Math.abs(panningRateXInDegree) > PANNING_SPEED_THRESHOLD)
+ || (Math.abs(panningRateYInDegree) > PANNING_SPEED_THRESHOLD)) {
showTooFastIndication();
} else {
hideTooFastIndication();
}
- mPanoProgressBar.setProgress((int) (progressX * mHorizontalViewAngle));
+ int angleInMajorDirection =
+ (Math.abs(progressHorizontalAngle) > Math.abs(progressVerticalAngle))
+ ? (int) progressHorizontalAngle
+ : (int) progressVerticalAngle;
+ mPanoProgressBar.setProgress((angleInMajorDirection));
}
private void createContentView() {
@@ -825,6 +828,7 @@ public class PanoramaActivity extends ActivityBase implements
Math.max(widthRatio, heightRatio));
mThumbnail = Thumbnail.createThumbnail(
jpeg.data, orientation, inSampleSize, uri);
+ Util.broadcastNewPicture(PanoramaActivity.this, uri);
}
mMainHandler.sendMessage(
mMainHandler.obtainMessage(MSG_RESET_TO_PREVIEW_WITH_THUMBNAIL));
diff --git a/src/com/android/camera/ui/IndicatorControlBar.java b/src/com/android/camera/ui/IndicatorControlBar.java
index 197c594..615a5ba 100644
--- a/src/com/android/camera/ui/IndicatorControlBar.java
+++ b/src/com/android/camera/ui/IndicatorControlBar.java
@@ -57,7 +57,9 @@ public class IndicatorControlBar extends IndicatorControl implements
// Add CameraPicker control.
initializeCameraPicker();
- mCameraPicker.setBackgroundResource(R.drawable.bg_pressed);
+ if (mCameraPicker != null) {
+ mCameraPicker.setBackgroundResource(R.drawable.bg_pressed);
+ }
// Add the ZoomControl if supported.
if (zoomSupported) {
diff --git a/src/com/android/camera/ui/IndicatorControlWheel.java b/src/com/android/camera/ui/IndicatorControlWheel.java
index 90d8ba8..0948346 100644
--- a/src/com/android/camera/ui/IndicatorControlWheel.java
+++ b/src/com/android/camera/ui/IndicatorControlWheel.java
@@ -204,32 +204,36 @@ public class IndicatorControlWheel extends IndicatorControl implements
if (mInAnimation) return -1;
int count = getChildCountByLevel(mCurrentLevel);
if (count == 0) return -1;
- int startIndex = 0;
int sectors = count - 1;
+ int startIndex = (mCurrentLevel == 0) ? 0 : mSecondLevelStartIndex;
+ int endIndex;
+ if (mCurrentLevel == 0) {
+ // Skip the first component if it is zoom control, as we will
+ // deal with it specifically.
+ if (mZoomControl != null) startIndex++;
+ endIndex = mSecondLevelStartIndex - 1;
+ } else {
+ endIndex = getChildCount() - 1;
+ }
// Check which indicator is touched.
- if ((delta >= (mStartVisibleRadians[mCurrentLevel] - HIGHLIGHT_RADIANS / 2)) &&
- (delta <= (mEndVisibleRadians[mCurrentLevel] + HIGHLIGHT_RADIANS / 2))) {
+ double halfTouchSectorRadians = mTouchSectorRadians[mCurrentLevel];
+ if ((delta >= (mChildRadians[startIndex] - halfTouchSectorRadians)) &&
+ (delta <= (mChildRadians[endIndex] + halfTouchSectorRadians))) {
int index = 0;
- if (mCurrentLevel == 0) {
- // Skip the first component if it is zoom control, as we will
- // deal with it specifically.
- if (mZoomControl != null) startIndex++;
- } else {
- startIndex = mSecondLevelStartIndex;
- index = (int) ((delta - mStartVisibleRadians[mCurrentLevel])
+ if (mCurrentLevel == 1) {
+ index = (int) ((delta - mChildRadians[startIndex])
/ mSectorRadians[mCurrentLevel]);
// greater than the center of ending indicator
if (index > sectors) return (startIndex + sectors);
// less than the center of starting indicator
if (index < 0) return startIndex;
}
-
if (delta <= (mChildRadians[startIndex + index]
- + mTouchSectorRadians[mCurrentLevel] / 2)) {
+ + halfTouchSectorRadians)) {
return (startIndex + index);
}
if (delta >= (mChildRadians[startIndex + index + 1]
- - mTouchSectorRadians[mCurrentLevel] / 2)) {
+ - halfTouchSectorRadians)) {
return (startIndex + index + 1);
}