summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlikaid <likaid@codeaurora.org>2015-03-11 16:46:42 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2015-03-26 15:11:25 -0700
commit82d71e41c466f2e3b8370ffdd97aa84bfc9c4ce9 (patch)
tree4c45d49eae4b8bfb094abdd51a8454aa9e63d885
parentd343fc2bef002a3ceb4c3414fdac57c4bae11c59 (diff)
downloadandroid_packages_apps_Snap-82d71e41c466f2e3b8370ffdd97aa84bfc9c4ce9.zip
android_packages_apps_Snap-82d71e41c466f2e3b8370ffdd97aa84bfc9c4ce9.tar.gz
android_packages_apps_Snap-82d71e41c466f2e3b8370ffdd97aa84bfc9c4ce9.tar.bz2
SnapdragonCamera: The alert dialog's rotation is not right
It will pop up a alert dialog if something goes wrong while generating mosaic. The alert dialog's rotation is not right, as a result, the alert dialog's UI will gose wrong. Use RotateLayout to set the rotation before we show the alert. Change-Id: Iaa91e811393a90c9f28f98404d782d2cc2ad9fe9 CRs-Fixed: 805471
-rw-r--r--res/layout/panorama_module.xml73
-rw-r--r--src/com/android/camera/WideAnglePanoramaUI.java31
2 files changed, 89 insertions, 15 deletions
diff --git a/res/layout/panorama_module.xml b/res/layout/panorama_module.xml
index db05b80..5ae3002 100644
--- a/res/layout/panorama_module.xml
+++ b/res/layout/panorama_module.xml
@@ -55,6 +55,79 @@
</com.android.camera.ui.RotateLayout>
<include layout="@layout/pano_module_review" />
+
+ <com.android.camera.ui.RotateLayout
+ android:id="@+id/pano_dialog_layout"
+ android:gravity="center"
+ android:layout_gravity="center"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" >
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_gravity="center"
+ android:background="@color/popup_background"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <LinearLayout android:id="@+id/pano_dialog_title_layout"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView android:id="@+id/pano_dialog_title"
+ style="@style/TextAppearance.DialogWindowTitle"
+ android:gravity="center_vertical"
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/pano_dialog_title"
+ android:minHeight="64dp"/>
+ <View style="@style/PopupTitleSeparator" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:background="@color/popup_background"
+ android:padding="9dp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <TextView
+ style="@style/TextAppearance.Medium"
+ android:id="@+id/pano_dialog_text"
+ android:layout_gravity="center_vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/pano_dialog_panorama_failed" />
+ </LinearLayout>
+
+ <ImageView android:background="@drawable/list_divider"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <LinearLayout android:id="@+id/pano_dialog_button_layout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:minHeight="48dp"
+ android:orientation="horizontal">
+
+ <Button android:id="@+id/pano_dialog_button1"
+ style="@style/Widget.Button.Borderless"
+ android:gravity="center"
+ android:maxLines="1"
+ android:minHeight="48dp"
+ android:textSize="14sp"
+ android:text="@string/dialog_ok"
+ android:layout_weight="1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content" />
+ </LinearLayout>
+ </LinearLayout>
+ </com.android.camera.ui.RotateLayout>
+
<include layout="@layout/camera_controls"
android:layout_gravity="center"
style="@style/CameraControls"/>
diff --git a/src/com/android/camera/WideAnglePanoramaUI.java b/src/com/android/camera/WideAnglePanoramaUI.java
index 230c31c..862e4d2 100644
--- a/src/com/android/camera/WideAnglePanoramaUI.java
+++ b/src/com/android/camera/WideAnglePanoramaUI.java
@@ -41,6 +41,7 @@ import android.view.TextureView;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -103,6 +104,8 @@ public class WideAnglePanoramaUI implements
private int mOrientation;
private int mPreviewYOffset;
private RotateLayout mWaitingDialog;
+ private RotateLayout mPanoFailedDialog;
+ private Button mPanoFailedButton;
/** Constructor. */
public WideAnglePanoramaUI(
@@ -462,6 +465,8 @@ public class WideAnglePanoramaUI implements
setPanoramaPreviewView();
mWaitingDialog = (RotateLayout) mRootView.findViewById(R.id.waitingDialog);
+ mPanoFailedDialog = (RotateLayout) mRootView.findViewById(R.id.pano_dialog_layout);
+ mPanoFailedButton = (Button) mRootView.findViewById(R.id.pano_dialog_button1);
mDialogHelper = new DialogHelper();
setViews(appRes);
}
@@ -536,16 +541,13 @@ public class WideAnglePanoramaUI implements
}
private class DialogHelper {
- private AlertDialog mAlertDialog;
DialogHelper() {
- mAlertDialog = null;
}
public void dismissAll() {
- if (mAlertDialog != null) {
- mAlertDialog.dismiss();
- mAlertDialog = null;
+ if (mPanoFailedDialog != null) {
+ mPanoFailedDialog.setVisibility(View.INVISIBLE);
}
if (mWaitingDialog != null) {
mWaitingDialog.setVisibility(View.INVISIBLE);
@@ -556,16 +558,14 @@ public class WideAnglePanoramaUI implements
CharSequence title, CharSequence message,
CharSequence buttonMessage, final Runnable buttonRunnable) {
dismissAll();
- mAlertDialog = (new AlertDialog.Builder(mActivity))
- .setTitle(title)
- .setMessage(message)
- .setNeutralButton(buttonMessage, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- buttonRunnable.run();
- }
- })
- .show();
+ mPanoFailedButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonRunnable.run();
+ mPanoFailedDialog.setVisibility(View.INVISIBLE);
+ }
+ });
+ mPanoFailedDialog.setVisibility(View.VISIBLE);
}
public void showWaitingDialog(CharSequence message) {
@@ -684,6 +684,7 @@ public class WideAnglePanoramaUI implements
lp.gravity = g;
button.setLayoutParams(lp);
mWaitingDialog.setRotation(-orientation);
+ mPanoFailedDialog.setRotation(-orientation);
mReview.setRotation(-orientation);
mTooFastPrompt.setRotation(-orientation);
mCameraControls.setOrientation(orientation, animation);