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
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 @@
<FrameLayout android:id="@+id/root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="left|center">
+ android:layout_gravity="left|center"
+ android:background="@color/share_popup_blackout">
<com.android.camera.ui.RotateLayout
android:id="@+id/thumbnail_rotate_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentRight="true">
+ android:layout_alignParentRight="true"
+ android:layout_gravity="center">
<!-- The size of the thumbnail is calculated in SharePopup.java -->
<FrameLayout
android:layout_width="wrap_content"
diff --git a/res/layout/share_popup.xml b/res/layout/share_popup.xml
index 087d8c7..f8cb5e5 100644
--- a/res/layout/share_popup.xml
+++ b/res/layout/share_popup.xml
@@ -25,12 +25,13 @@
<FrameLayout android:id="@+id/root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="top|center">
+ android:layout_gravity="top|center"
+ android:background="@color/share_popup_blackout">
<com.android.camera.ui.RotateLayout
android:id="@+id/thumbnail_rotate_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="bottom">
+ android:layout_gravity="center">
<!-- The size of the thumbnail is calculated in SharePopup.java -->
<FrameLayout
android:layout_width="wrap_content"
diff --git a/res/values/colors.xml b/res/values/colors.xml
index d595c60..6085301 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -27,7 +27,7 @@
<color name="time_lapse_arc">#FFC5C5C5</color>
<color name="dark_gray">#151515</color>
<color name="share_popup_background">#DA000000</color>
- <color name="share_popup_blackout">#ff222222</color>
+ <color name="share_popup_blackout">#ff090909</color>
<color name="share_icon_background">#80000000</color>
<color name="indicator_background">#40000000</color>
<color name="popup_title_color">#ff33b5e5</color>
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.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.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 @@
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 @@
}
mGotoGalleryRotate.setOrientation(orientation);
-
- adjustThumbnailPosition();
}
@Override