diff options
author | Wei Huang <weih@google.com> | 2011-11-03 11:49:52 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-11-03 11:49:52 -0700 |
commit | 19346d5702f5848167c16d71941e2c48cd17ed05 (patch) | |
tree | f9ab349026cd57625b1d0b717b21f401888ef68b /src/com/android/camera/panorama | |
parent | 015c544e8a9fc7c63a8ab3b378fc85bf73b58113 (diff) | |
parent | ae557ecc220f9d491e8c65b1c895827fbedcdafe (diff) | |
download | packages_apps_LegacyCamera-19346d5702f5848167c16d71941e2c48cd17ed05.zip packages_apps_LegacyCamera-19346d5702f5848167c16d71941e2c48cd17ed05.tar.gz packages_apps_LegacyCamera-19346d5702f5848167c16d71941e2c48cd17ed05.tar.bz2 |
Merge "The dialog for comfirmation is made rotatable." into ics-mr1
Diffstat (limited to 'src/com/android/camera/panorama')
-rwxr-xr-x | src/com/android/camera/panorama/PanoramaActivity.java | 85 |
1 files changed, 14 insertions, 71 deletions
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java index f893e30..8b9c65a 100755 --- a/src/com/android/camera/panorama/PanoramaActivity.java +++ b/src/com/android/camera/panorama/PanoramaActivity.java @@ -25,6 +25,7 @@ import com.android.camera.MenuHelper; import com.android.camera.ModePicker; import com.android.camera.OnClickAttr; import com.android.camera.R; +import com.android.camera.RotateDialogController; import com.android.camera.ShutterButton; import com.android.camera.SoundPlayer; import com.android.camera.Storage; @@ -35,11 +36,8 @@ import com.android.camera.ui.RotateImageView; import com.android.camera.ui.RotateLayout; import com.android.camera.ui.SharePopup; -import android.app.Dialog; -import android.app.ProgressDialog; import android.content.ContentResolver; import android.content.Context; -import android.content.DialogInterface; import android.content.res.AssetFileDescriptor; import android.content.pm.ActivityInfo; import android.content.res.Resources; @@ -50,7 +48,6 @@ import android.graphics.PixelFormat; 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; @@ -63,23 +60,18 @@ import android.os.ParcelFileDescriptor; import android.os.SystemProperties; import android.util.Log; import android.view.Gravity; -import android.view.LayoutInflater; import android.view.Menu; import android.view.OrientationEventListener; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; -import android.widget.Button; import android.widget.ImageView; -import android.widget.ProgressBar; import android.widget.TextView; import java.io.ByteArrayOutputStream; -import java.io.FileNotFoundException; import java.io.File; import java.util.List; -import java.util.Vector; /** * Activity to handle panorama capturing. @@ -131,15 +123,6 @@ public class PanoramaActivity extends ActivityBase implements private ShutterButton mShutterButton; private Object mWaitObject = new Object(); - private RotateLayout mRotateDialog; - private View mRotateDialogTitleLayout; - private View mRotateDialogButtonLayout; - private TextView mRotateDialogTitle; - private View mRotateDialogTitleSeperator; - private ProgressBar mRotateDialogSpinner; - private TextView mRotateDialogText; - private TextView mRotateDialogButton; - private String mPreparePreviewString; private String mDialogTitle; private String mDialogOkString; @@ -196,6 +179,8 @@ public class PanoramaActivity extends ActivityBase implements private int mDeviceOrientation; private int mOrientationCompensation; + private RotateDialogController mRotateDialog; + private class MosaicJpeg { public MosaicJpeg(byte[] data, int width, int height) { this.data = data; @@ -316,8 +301,14 @@ public class PanoramaActivity extends ActivityBase implements if (mPausing) { resetToPreview(); } else { - showAlertDialog( - mDialogTitle, mDialogPanoramaFailedString, mDialogOkString); + mRotateDialog.showAlertDialog( + mDialogTitle, mDialogPanoramaFailedString, + mDialogOkString, new Runnable() { + @Override + public void run() { + resetToPreview(); + }}, + null, null); } break; case MSG_RESET_TO_PREVIEW: @@ -334,12 +325,6 @@ public class PanoramaActivity extends ActivityBase implements }; } - @OnClickAttr - public void onAlertDialogButtonClicked(View v) { - dismissDialog(); - resetToPreview(); - } - private void setupCamera() { openCamera(); Parameters parameters = mCameraDevice.getParameters(); @@ -604,7 +589,7 @@ public class PanoramaActivity extends ActivityBase implements mSurfaceTexture.setOnFrameAvailableListener(null); if (!aborted && !mThreadRunning) { - showWaitingDialog(mPreparePreviewString); + mRotateDialog.showWaitingDialog(mPreparePreviewString); runBackgroundThread(new Thread() { @Override public void run() { @@ -716,14 +701,7 @@ public class PanoramaActivity extends ActivityBase implements mPanoLayout = findViewById(R.id.pano_layout); - mRotateDialog = (RotateLayout) findViewById(R.id.rotate_dialog_layout); - mRotateDialogTitleLayout = findViewById(R.id.rotate_dialog_title_layout); - mRotateDialogButtonLayout = findViewById(R.id.rotate_dialog_button_layout); - mRotateDialogTitle = (TextView) findViewById(R.id.rotate_dialog_title); - mRotateDialogTitleSeperator = (View) findViewById(R.id.rotate_dialog_title_divider); - mRotateDialogSpinner = (ProgressBar) findViewById(R.id.rotate_dialog_spinner); - mRotateDialogText = (TextView) findViewById(R.id.rotate_dialog_text); - mRotateDialogButton = (Button) findViewById(R.id.rotate_dialog_button); + mRotateDialog = new RotateDialogController(this, R.layout.rotate_dialog); if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { Rotatable[] rotateLayout = { @@ -847,41 +825,6 @@ public class PanoramaActivity extends ActivityBase implements reportProgress(); } - private void resetRotateDialog() { - mRotateDialogTitleLayout.setVisibility(View.GONE); - mRotateDialogSpinner.setVisibility(View.GONE); - mRotateDialogButtonLayout.setVisibility(View.GONE); - } - - private void dismissDialog() { - if (mRotateDialog.getVisibility() != View.INVISIBLE) { - mRotateDialog.setVisibility(View.INVISIBLE); - } - } - - private void showAlertDialog(String title, String msg, String buttonText) { - resetRotateDialog(); - - mRotateDialogTitle.setText(title); - mRotateDialogTitleLayout.setVisibility(View.VISIBLE); - - mRotateDialogText.setText(msg); - - mRotateDialogButton.setText(buttonText); - mRotateDialogButtonLayout.setVisibility(View.VISIBLE); - - mRotateDialog.setVisibility(View.VISIBLE); - } - - private void showWaitingDialog(String msg) { - resetRotateDialog(); - - mRotateDialogText.setText(msg); - mRotateDialogSpinner.setVisibility(View.VISIBLE); - - mRotateDialog.setVisibility(View.VISIBLE); - } - private void runBackgroundThread(Thread thread) { mThreadRunning = true; thread.start(); @@ -889,7 +832,7 @@ public class PanoramaActivity extends ActivityBase implements private void onBackgroundThreadFinished() { mThreadRunning = false; - dismissDialog(); + mRotateDialog.dismissDialog(); } private void cancelHighResComputation() { |