summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/pano_control.xml8
-rw-r--r--src/com/android/camera/FocusManager.java6
-rw-r--r--src/com/android/camera/panorama/PanoramaActivity.java50
3 files changed, 38 insertions, 26 deletions
diff --git a/res/layout/pano_control.xml b/res/layout/pano_control.xml
index 52cbb54..360bb0d 100644
--- a/res/layout/pano_control.xml
+++ b/res/layout/pano_control.xml
@@ -21,10 +21,6 @@
android:layout_alignParentRight="true"
android:background="@drawable/bg_camera_pattern">
- <include layout="@layout/review_thumbnail"/>
-
- <include layout="@layout/mode_picker"/>
-
<Button android:id="@+id/pano_start_button"
android:text="@string/pano_capture_start"
android:onClick="onStartButtonClicked"
@@ -33,4 +29,8 @@
android:layout_width="@dimen/pano_control_start_button_size"
android:layout_height="@dimen/pano_control_start_button_size" />
+ <include layout="@layout/review_thumbnail"/>
+
+ <include layout="@layout/mode_picker"/>
+
</com.android.camera.ui.ControlPanelLayout>
diff --git a/src/com/android/camera/FocusManager.java b/src/com/android/camera/FocusManager.java
index 2c8b66f..94093e6 100644
--- a/src/com/android/camera/FocusManager.java
+++ b/src/com/android/camera/FocusManager.java
@@ -297,10 +297,14 @@ public class FocusManager {
private void cancelAutoFocus() {
Log.v(TAG, "Cancel autofocus.");
+
+ // Reset the tap area before calling mListener.cancelAutofocus.
+ // Otherwise, focus mode stays at auto and the tap area passed to the
+ // driver is not reset.
+ resetTouchFocus();
mListener.cancelAutoFocus();
if (mFaceView != null) mFaceView.resume();
mState = STATE_IDLE;
- resetTouchFocus();
updateFocusUI();
mHandler.removeMessages(RESET_TOUCH_FOCUS);
}
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java
index c33c3e4..ee6bc23 100644
--- a/src/com/android/camera/panorama/PanoramaActivity.java
+++ b/src/com/android/camera/panorama/PanoramaActivity.java
@@ -41,12 +41,12 @@ import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.graphics.YuvImage;
import android.hardware.Camera;
+import android.hardware.Camera.Parameters;
+import android.hardware.Camera.Size;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
-import android.hardware.Camera.Parameters;
-import android.hardware.Camera.Size;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -59,7 +59,6 @@ import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
-import android.widget.ProgressBar;
import android.widget.TextView;
import java.io.ByteArrayOutputStream;
@@ -353,6 +352,8 @@ public class PanoramaActivity extends Activity implements
mTimeTaken = System.currentTimeMillis();
mCaptureState = CAPTURE_MOSAIC;
mTooFastPrompt.setVisibility(View.GONE);
+ mPanoControlLayout.startAnimation(mSlideOut);
+ mPanoControlLayout.setVisibility(View.GONE);
mMosaicFrameProcessor.setProgressListener(new MosaicFrameProcessor.ProgressListener() {
@Override
@@ -369,9 +370,6 @@ public class PanoramaActivity extends Activity implements
mStopCaptureButton.setVisibility(View.VISIBLE);
mCaptureView.setVisibility(View.VISIBLE);
mMosaicView.setVisibility(View.VISIBLE);
- mPanoControlLayout.startAnimation(mSlideOut);
- mPanoControlLayout.setVisibility(View.GONE);
-
}
private void stopCapture() {
@@ -382,9 +380,8 @@ public class PanoramaActivity extends Activity implements
mSurfaceTexture.setOnFrameAvailableListener(null);
- // TODO: show some dialog for long computation.
if (!mThreadRunning) {
- runBackgroundThread(mPreparePreviewString, new Thread() {
+ runBackgroundThreadAndShowDialog(mPreparePreviewString, false, new Thread() {
@Override
public void run() {
byte[] jpegData = generateFinalMosaic(false);
@@ -466,23 +463,24 @@ public class PanoramaActivity extends Activity implements
Thread t = new Thread() {
@Override
public void run() {
- while(true)
- {
+ while (mThreadRunning) {
final int progress = mMosaicFrameProcessor.reportProgress(highRes);
- try{
+ try {
Thread.sleep(50);
- }catch(Exception e) {}
-
- // Update the progress bar
+ } catch (Exception e) {
+ throw new RuntimeException("Panorama reportProgress failed", e);
+ }
+ // Update the progress bar
runOnUiThread(new Runnable() {
public void run() {
- //TODO: Set the the progress-bar progress update here...
+ // Check if mProgressDialog is null because the background thread
+ // finished.
+ if (mProgressDialog != null) {
+ mProgressDialog.setProgress(progress);
+ }
}
});
-
- if(progress>=100)
- break;
}
}
};
@@ -492,7 +490,7 @@ public class PanoramaActivity extends Activity implements
@OnClickAttr
public void onOkButtonClicked(View v) {
if (mPausing || mThreadRunning || mSurfaceTexture == null) return;
- runBackgroundThread(mGeneratePanoramaString, new Thread() {
+ runBackgroundThreadAndShowDialog(mGeneratePanoramaString, true, new Thread() {
@Override
public void run() {
byte[] jpegData = generateFinalMosaic(true);
@@ -512,9 +510,19 @@ public class PanoramaActivity extends Activity implements
reportProgress(true);
}
- private void runBackgroundThread(String str, Thread thread) {
+ /**
+ * If the style is horizontal one, the maximum progress is assumed to be 100.
+ */
+ private void runBackgroundThreadAndShowDialog(
+ String str, boolean showPercentageProgress, Thread thread) {
mThreadRunning = true;
- mProgressDialog = ProgressDialog.show(this, "", str);
+ mProgressDialog = new ProgressDialog(this);
+ if (showPercentageProgress) {
+ mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+ mProgressDialog.setMax(100);
+ }
+ mProgressDialog.setMessage(str);
+ mProgressDialog.show();
thread.start();
}