summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2011-09-07 17:34:00 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-07 17:34:00 -0700
commit90a21dd768fae18d670a338a72679e4c77ee1170 (patch)
treeefad8eda2fc188ceb5d6432df8c43c4cb2f79396
parente0861e7473d042bdd9c935f3bdf50ae220891b6c (diff)
parent2f9ed6f52580b8fecb77ec3ca123a804eea89f8c (diff)
downloadpackages_apps_LegacyCamera-90a21dd768fae18d670a338a72679e4c77ee1170.zip
packages_apps_LegacyCamera-90a21dd768fae18d670a338a72679e4c77ee1170.tar.gz
packages_apps_LegacyCamera-90a21dd768fae18d670a338a72679e4c77ee1170.tar.bz2
Merge "A customized dialog for preparing low-res review."
-rw-r--r--res/anim/fade_in_quick.xml22
-rw-r--r--res/anim/fade_out_quick.xml22
-rw-r--r--res/drawable/pano_rounded_rectangle.xml26
-rw-r--r--res/layout/pano_capture.xml2
-rw-r--r--res/layout/pano_dialog_view.xml53
-rw-r--r--res/values-w1024dp/dimens.xml7
-rw-r--r--res/values-w1024dp/styles.xml3
-rw-r--r--res/values/colors.xml1
-rw-r--r--res/values/dimens.xml7
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/values/styles.xml3
-rw-r--r--src/com/android/camera/panorama/PanoramaActivity.java51
12 files changed, 182 insertions, 17 deletions
diff --git a/res/anim/fade_in_quick.xml b/res/anim/fade_in_quick.xml
new file mode 100644
index 0000000..80d827d
--- /dev/null
+++ b/res/anim/fade_in_quick.xml
@@ -0,0 +1,22 @@
+<?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
new file mode 100644
index 0000000..9659c4b
--- /dev/null
+++ b/res/anim/fade_out_quick.xml
@@ -0,0 +1,22 @@
+<?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
new file mode 100644
index 0000000..2cbdbc3
--- /dev/null
+++ b/res/drawable/pano_rounded_rectangle.xml
@@ -0,0 +1,26 @@
+<?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 a271d23..7cf6c01 100644
--- a/res/layout/pano_capture.xml
+++ b/res/layout/pano_capture.xml
@@ -60,4 +60,6 @@
android:layout_width="wrap_content"
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
new file mode 100644
index 0000000..288d00f
--- /dev/null
+++ b/res/layout/pano_dialog_view.xml
@@ -0,0 +1,53 @@
+<?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 977c770..1ca3218 100644
--- a/res/values-w1024dp/dimens.xml
+++ b/res/values-w1024dp/dimens.xml
@@ -30,13 +30,16 @@
<dimen name="pano_control_start_button_size">180dp</dimen>
<dimen name="pano_mosaic_surface_width">960dp</dimen>
<dimen name="pano_mosaic_surface_height">360dp</dimen>
- <dimen name="pano_capture_stop_button_width">160dp</dimen>
- <dimen name="pano_capture_stop_button_height">160dp</dimen>
<dimen name="pano_review_button_width">180dp</dimen>
<dimen name="pano_review_button_height">180dp</dimen>
<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-w1024dp/styles.xml b/res/values-w1024dp/styles.xml
index 00016b5..e5da857 100644
--- a/res/values-w1024dp/styles.xml
+++ b/res/values-w1024dp/styles.xml
@@ -45,4 +45,7 @@
<item name="android:layout_alignParentRight">true</item>
<item name="android:visibility">gone</item>
</style>
+ <style name="PanoCustomDialogText">
+ <item name="android:textAppearance">@android:style/TextAppearance.Large</item>
+ </style>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index a0bbf7f..7d5081f 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -28,4 +28,5 @@
<color name="share_popup_background">#B0000000</color>
<color name="share_icon_background">#40000000</color>
<color name="indicator_background">#40000000</color>
+ <color name="pano_custom_dialog_background">#FF666666</color>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 63bb9b3..b1e3db4 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -26,13 +26,16 @@
<dimen name="pano_control_start_button_size">70dp</dimen>
<dimen name="pano_mosaic_surface_width">640dp</dimen>
<dimen name="pano_mosaic_surface_height">240dp</dimen>
- <dimen name="pano_capture_stop_button_width">70dp</dimen>
- <dimen name="pano_capture_stop_button_height">70dp</dimen>
<dimen name="pano_review_button_width">70dp</dimen>
<dimen name="pano_review_button_height">70dp</dimen>
<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/res/values/strings.xml b/res/values/strings.xml
index d1ec27a..8cf4662 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -272,7 +272,7 @@
<string name="pano_too_fast_prompt">Too Fast</string>
<!-- The text shown in the progress dialog when panorama preview is generating in the background [CHAR LIMIT=30] -->
- <string name="pano_dialog_prepare_preview">Preparing preview...</string>
+ <string name="pano_dialog_prepare_preview">Preparing panorama</string>
<!-- The text shown in the progress dialog when generating the final panorama result in the background [CHAR LIMIT=30] -->
<string name="pano_dialog_generate_panorama">Generating panorama...</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index eb7d30f..9e2046b 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -155,6 +155,9 @@
<item name="android:layout_height">0dp</item>
<item name="android:layout_weight">0.5</item>
</style>
+ <style name="PanoCustomDialogText">
+ <item name="android:textAppearance">@android:style/TextAppearance.Medium</item>
+ </style>
<style name="ReviewThumbnail">
<item name="android:layout_width">52dp</item>
<item name="android:layout_height">52dp</item>
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java
index 0c664e1..c2cb837 100644
--- a/src/com/android/camera/panorama/PanoramaActivity.java
+++ b/src/com/android/camera/panorama/PanoramaActivity.java
@@ -31,6 +31,9 @@ import com.android.camera.Util;
import com.android.camera.ui.RotateImageView;
import com.android.camera.ui.SharePopup;
+import android.animation.Animator;
+import android.animation.AnimatorInflater;
+import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
@@ -60,6 +63,7 @@ import android.view.OrientationEventListener;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
+import android.widget.RelativeLayout;
import android.widget.TextView;
import java.io.ByteArrayOutputStream;
@@ -76,7 +80,7 @@ public class PanoramaActivity extends Activity implements
public static final int DEFAULT_BLEND_MODE = Mosaic.BLENDTYPE_HORIZONTAL;
public static final int DEFAULT_CAPTURE_PIXELS = 960 * 720;
- private static final int MSG_FINAL_MOSAIC_READY = 1;
+ private static final int MSG_LOW_RES_FINAL_MOSAIC_READY = 1;
private static final int MSG_RESET_TO_PREVIEW_WITH_THUMBNAIL = 2;
private static final int MSG_GENERATE_FINAL_MOSAIC_ERROR = 3;
private static final int MSG_DISMISS_ALERT_DIALOG_AND_RESET_TO_PREVIEW = 4;
@@ -107,9 +111,16 @@ public class PanoramaActivity extends Activity implements
private ProgressDialog mProgressDialog;
private String mPreparePreviewString;
private String mGeneratePanoramaString;
+ private AlertDialog mAlertDialog;
private String mDialogTitle;
private String mDialogOk;
- private AlertDialog mAlertDialog;
+
+ // 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;
@@ -204,13 +215,11 @@ public class PanoramaActivity extends Activity implements
mDialogTitle = getResources().getString(R.string.pano_dialog_title);
mDialogOk = getResources().getString(R.string.dialog_ok);
- Context context = getApplicationContext();
-
mMainHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
- case MSG_FINAL_MOSAIC_READY:
+ case MSG_LOW_RES_FINAL_MOSAIC_READY:
onBackgroundThreadFinished();
showFinalMosaic((Bitmap) msg.obj);
break;
@@ -465,7 +474,7 @@ public class PanoramaActivity extends Activity implements
bitmap = BitmapFactory.decodeByteArray(jpeg.data, 0, jpeg.data.length);
}
mMainHandler.sendMessage(mMainHandler.obtainMessage(
- MSG_FINAL_MOSAIC_READY, bitmap));
+ MSG_LOW_RES_FINAL_MOSAIC_READY, bitmap));
}
});
reportProgress(false);
@@ -516,6 +525,14 @@ public class PanoramaActivity extends Activity implements
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);
}
@@ -600,20 +617,30 @@ public class PanoramaActivity extends Activity implements
private void runBackgroundThreadAndShowDialog(
String str, boolean showPercentageProgress, Thread thread) {
mThreadRunning = true;
- mProgressDialog = new ProgressDialog(this);
if (showPercentageProgress) {
- mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+ mProgressDialog = new ProgressDialog(this);
mProgressDialog.setMax(100);
+ mProgressDialog.setMessage(str);
+ mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+ mProgressDialog.setCancelable(false); // Don't allow back key to dismiss this dialog.
+ mProgressDialog.show();
+ } else {
+ mPanoramaPrepareDialogFadeIn.start();
+ mPanoramaPrepareDialog.setVisibility(View.VISIBLE);
}
- mProgressDialog.setMessage(str);
- mProgressDialog.show();
thread.start();
}
private void onBackgroundThreadFinished() {
mThreadRunning = false;
- mProgressDialog.dismiss();
- mProgressDialog = null;
+ if (mProgressDialog != null) {
+ mProgressDialog.dismiss();
+ mProgressDialog = null;
+ }
+ if (mPanoramaPrepareDialog.getVisibility() == View.VISIBLE) {
+ mPanoramaPrepareDialogFadeOut.start();
+ mPanoramaPrepareDialog.setVisibility(View.GONE);
+ }
}
@OnClickAttr