From efa3f22e42b31bfcf916610e01efe0bdc4940080 Mon Sep 17 00:00:00 2001 From: Angus Kong Date: Sat, 18 Feb 2012 06:04:50 +0800 Subject: Fix the share popup. DO NOT MERGE Fix the share popup to comply with the new design: 1. Black background. 2. Image is centered. 3. Share popup won't rotate automatically. bug:6031042 Change-Id: I86b15a19bc8f7598d444cd9032960ea02e251668 --- res/layout-sw600dp/share_popup.xml | 6 ++++-- res/layout/share_popup.xml | 5 +++-- res/values/colors.xml | 2 +- src/com/android/camera/ui/SharePopup.java | 34 +------------------------------ 4 files changed, 9 insertions(+), 38 deletions(-) diff --git a/res/layout-sw600dp/share_popup.xml b/res/layout-sw600dp/share_popup.xml index 96b39e1..e12f521 100644 --- a/res/layout-sw600dp/share_popup.xml +++ b/res/layout-sw600dp/share_popup.xml @@ -25,12 +25,14 @@ + android:layout_gravity="left|center" + android:background="@color/share_popup_blackout"> + android:layout_alignParentRight="true" + android:layout_gravity="center"> + android:layout_gravity="top|center" + android:background="@color/share_popup_blackout"> + android:layout_gravity="center"> #FFC5C5C5 #151515 #DA000000 - #ff222222 + #ff090909 #80000000 #40000000 #ff33b5e5 diff --git a/src/com/android/camera/ui/SharePopup.java b/src/com/android/camera/ui/SharePopup.java index 43f3ae8..5032651 100644 --- a/src/com/android/camera/ui/SharePopup.java +++ b/src/com/android/camera/ui/SharePopup.java @@ -31,7 +31,6 @@ import android.graphics.Bitmap; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; -import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; @@ -39,7 +38,6 @@ import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.WindowManager; import android.widget.AdapterView; -import android.widget.FrameLayout; import android.widget.GridView; import android.widget.ImageView; import android.widget.PopupWindow; @@ -159,38 +157,10 @@ public class SharePopup extends PopupWindow implements View.OnClickListener, setFocusable(true); setAnimationStyle(R.style.AnimationPopup); createShareMenu(); - - adjustThumbnailPosition(); - } - - private void adjustThumbnailPosition() { - FrameLayout.LayoutParams lpOld = - (FrameLayout.LayoutParams) mThumbnailRotateLayout.getLayoutParams(); - FrameLayout.LayoutParams lpNew = - new FrameLayout.LayoutParams(lpOld.width, lpOld.height); - - mRootView.setBackgroundDrawable(null); - if (mBitmapWidth > mBitmapHeight * 2 || mBitmapHeight > mBitmapWidth * 2) { - // panorama image - lpNew.gravity = Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL; - - // panorama images block the preview from showing in the background - // use a special color here for that. - mRootView.setBackgroundColor( - mContext.getResources().getColor(R.color.share_popup_blackout)); - } else { - // landscape or portrait image - if (mActivityOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { - lpNew.gravity = Gravity.BOTTOM; - } else { - lpNew.gravity = Gravity.RIGHT; - } - } - - mThumbnailRotateLayout.setLayoutParams(lpNew); } public void setOrientation(int orientation) { + if (isShowing()) return; mOrientation = orientation; int hPaddingRootView = mRootView.getPaddingLeft() + mRootView.getPaddingRight(); @@ -236,8 +206,6 @@ public class SharePopup extends PopupWindow implements View.OnClickListener, } mGotoGalleryRotate.setOrientation(orientation); - - adjustThumbnailPosition(); } @Override -- cgit v1.1