Merge "Replace the custom dialog with system dialog."
diff --git a/res/anim/fade_in_quick.xml b/res/anim/fade_in_quick.xml
deleted file mode 100644
index 80d827d..0000000
--- a/res/anim/fade_in_quick.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
-        android:propertyName="alpha"
-        android:duration="200"
-        android:valueFrom="0.0"
-        android:valueTo="1.0"
-        android:valueType="floatType"/>
diff --git a/res/anim/fade_out_quick.xml b/res/anim/fade_out_quick.xml
deleted file mode 100644
index 9659c4b..0000000
--- a/res/anim/fade_out_quick.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
-        android:propertyName="alpha"
-        android:duration="200"
-        android:valueFrom="1.0"
-        android:valueTo="0.0"
-        android:valueType="floatType" />
diff --git a/res/drawable/pano_rounded_rectangle.xml b/res/drawable/pano_rounded_rectangle.xml
deleted file mode 100644
index 2cbdbc3..0000000
--- a/res/drawable/pano_rounded_rectangle.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-        android:shape="rectangle">
-
-    <corners android:radius="@dimen/pano_custom_dialog_corner_radius" />
-
-    <size android:width="@dimen/pano_custom_dialog_width"
-            android:height="@dimen/pano_custom_dialog_height" />
-
-    <solid android:color="@color/pano_custom_dialog_background" />
-</shape>
diff --git a/res/layout/pano_capture.xml b/res/layout/pano_capture.xml
index 2246fdd..23e20e1 100644
--- a/res/layout/pano_capture.xml
+++ b/res/layout/pano_capture.xml
@@ -61,5 +61,4 @@
         android:visibility="gone"
         android:layout_centerInParent="true" />
 
-    <include layout="@layout/pano_dialog_view" />
 </RelativeLayout>
diff --git a/res/layout/pano_dialog_view.xml b/res/layout/pano_dialog_view.xml
deleted file mode 100644
index 288d00f..0000000
--- a/res/layout/pano_dialog_view.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@+id/pano_preview_progress_dialog"
-        android:visibility="gone"
-        android:background="#AA000000"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-    <ImageView
-            android:id="@+id/pano_custom_dialog_background"
-            android:src="@drawable/pano_rounded_rectangle"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_centerInParent="true" />
-
-    <LinearLayout
-            android:orientation="vertical"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_centerInParent="true">
-
-        <ProgressBar
-                android:layout_width="wrap_content"
-                android:layout_height="@dimen/pano_custom_dialog_spinner_height"
-                android:layout_gravity="center_horizontal" />
-
-        <TextView
-                style="@style/PanoCustomDialogText"
-                android:id="@+id/pano_custom_dialog_text_view"
-                android:text="@string/pano_dialog_prepare_preview"
-                android:paddingTop="15dp"
-                android:editable="false"
-                android:gravity="center"
-                android:layout_gravity="center_horizontal"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" />
-    </LinearLayout>
-</RelativeLayout>
diff --git a/res/values-w1024dp/dimens.xml b/res/values-w1024dp/dimens.xml
index 374c14b..46e8054 100644
--- a/res/values-w1024dp/dimens.xml
+++ b/res/values-w1024dp/dimens.xml
@@ -34,11 +34,6 @@
     <dimen name="pano_capture_too_fast_text_height">160dp</dimen>
     <dimen name="pano_indication_width">300dp</dimen>
     <dimen name="pano_indication_height">150dp</dimen>
-    <dimen name="pano_custom_dialog_corner_radius">24dp</dimen>
-    <dimen name="pano_custom_dialog_width">580dp</dimen>
-    <dimen name="pano_custom_dialog_height">200dp</dimen>
-    <dimen name="pano_custom_dialog_textview_top_padding">30dp</dimen>
-    <dimen name="pano_custom_dialog_spinner_height">70dp</dimen>
     <dimen name="setting_row_height">48dp</dimen>
     <dimen name="setting_item_text_size">21dp</dimen>
     <dimen name="setting_knob_width">72dp</dimen>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index b9ca511..66a374a 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -30,11 +30,6 @@
     <dimen name="pano_capture_too_fast_text_height">70dp</dimen>
     <dimen name="pano_indication_width">150dp</dimen>
     <dimen name="pano_indication_height">75dp</dimen>
-    <dimen name="pano_custom_dialog_corner_radius">15dp</dimen>
-    <dimen name="pano_custom_dialog_width">320dp</dimen>
-    <dimen name="pano_custom_dialog_height">120dp</dimen>
-    <dimen name="pano_custom_dialog_textview_top_padding">15dp</dimen>
-    <dimen name="pano_custom_dialog_spinner_height">40dp</dimen>
     <dimen name="setting_row_height">42dp</dimen>
     <dimen name="setting_item_text_size">16dp</dimen>
     <dimen name="setting_knob_width">36dp</dimen>
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java
index c6a403e..8b6241b 100644
--- a/src/com/android/camera/panorama/PanoramaActivity.java
+++ b/src/com/android/camera/panorama/PanoramaActivity.java
@@ -120,13 +120,6 @@
     private String mDialogTitle;
     private String mDialogOk;
 
-    // This custom dialog is to follow the UI spec to produce a dialog with a spinner in the top
-    // center part and a text view in the bottom part. The background is a rounded rectangle. The
-    // system dialog cannot be used because there will be a rectangle with 3D-like edges.
-    private RelativeLayout mPanoramaPrepareDialog;
-    private Animator mPanoramaPrepareDialogFadeIn;
-    private Animator mPanoramaPrepareDialogFadeOut;
-
     private float mCompassValueX;
     private float mCompassValueY;
     private float mCompassValueXStart;
@@ -584,14 +577,6 @@
         mShutterButton.setBackgroundResource(R.drawable.btn_shutter_pan);
         mShutterButton.setOnShutterButtonListener(this);
 
-        mPanoramaPrepareDialog = (RelativeLayout)
-                findViewById(R.id.pano_preview_progress_dialog);
-
-        mPanoramaPrepareDialogFadeIn = AnimatorInflater.loadAnimator(this, R.anim.fade_in_quick);
-        mPanoramaPrepareDialogFadeIn.setTarget(mPanoramaPrepareDialog);
-        mPanoramaPrepareDialogFadeOut = AnimatorInflater.loadAnimator(this, R.anim.fade_out_quick);
-        mPanoramaPrepareDialogFadeOut.setTarget(mPanoramaPrepareDialog);
-
         mPanoLayout = findViewById(R.id.pano_layout);
     }
 
@@ -682,13 +667,13 @@
     private void runBackgroundThreadAndShowDialog(
             String str, boolean showPercentageProgress, Thread thread) {
         mThreadRunning = true;
+        mProgressDialog = new ProgressDialog(this);
+        mProgressDialog.setMessage(str);
+        mProgressDialog.setCancelable(false);  // Don't allow back key to dismiss this dialog.
         if (showPercentageProgress) {
-            mProgressDialog = new ProgressDialog(this);
             mProgressDialog.setMax(100);
-            mProgressDialog.setMessage(str);
             mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
             // TODO: update the UI according to specs.
-            mProgressDialog.setCancelable(false);  // Don't allow back key to dismiss this dialog.
 
             mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel",
                     new DialogInterface.OnClickListener() {
@@ -697,24 +682,17 @@
                             mCancelComputation = true;
                         }
                     });
-            mProgressDialog.show();
         } else {
-            mPanoramaPrepareDialogFadeIn.start();
-            mPanoramaPrepareDialog.setVisibility(View.VISIBLE);
+            mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
         }
+        mProgressDialog.show();
         thread.start();
     }
 
     private void onBackgroundThreadFinished() {
         mThreadRunning = false;
-        if (mProgressDialog != null) {
-            mProgressDialog.dismiss();
-            mProgressDialog = null;
-        }
-        if (mPanoramaPrepareDialog.getVisibility() == View.VISIBLE) {
-            mPanoramaPrepareDialogFadeOut.start();
-            mPanoramaPrepareDialog.setVisibility(View.GONE);
-        }
+        mProgressDialog.dismiss();
+        mProgressDialog = null;
     }
 
     @OnClickAttr