Change compact contact edtior photo aspect ratio
To less severe 360:184/width:height
Change-Id: I72e65bd921f271cc74b8b13b27b3b99932f1beb4
Screenshots: https://docs.google.com/drawings/d/1rHxAfZg46OKhit0ccAZkxnS4QipiG_1wKZIUIcQeLyM/edit
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 0d40982..2214215 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -33,6 +33,9 @@
snaps to the top of the window. -->
<dimen name="quickcontact_snap_to_top_slop_height">33dp</dimen>
+ <!-- The ratio of width:height (360:184) for the compact editor contact photo in portrait -->
+ <item name="editor_portrait_photo_ratio" type="dimen" format="float">1.96</item>
+
<!-- Padding of the rounded plus/minus/expand/collapse buttons in the editor -->
<dimen name="editor_round_button_padding_left">16dip</dimen>
<dimen name="editor_round_button_padding_right">16dip</dimen>
diff --git a/src/com/android/contacts/editor/CompactPhotoEditorView.java b/src/com/android/contacts/editor/CompactPhotoEditorView.java
index 3481a33..6c8670d 100644
--- a/src/com/android/contacts/editor/CompactPhotoEditorView.java
+++ b/src/com/android/contacts/editor/CompactPhotoEditorView.java
@@ -57,6 +57,7 @@
private PhotoHandler mPhotoHandler;
private final float mLandscapePhotoRatio;
+ private final float mPortraitPhotoRatio;
private final boolean mIsTwoPanel;
private ValuesDelta mValuesDelta;
@@ -73,6 +74,7 @@
public CompactPhotoEditorView(Context context, AttributeSet attrs) {
super(context, attrs);
mLandscapePhotoRatio = getTypedFloat(R.dimen.quickcontact_landscape_photo_ratio);
+ mPortraitPhotoRatio = getTypedFloat(R.dimen.editor_portrait_photo_ratio);
mIsTwoPanel = getResources().getBoolean(R.bool.quickcontact_two_panel);
}
@@ -145,9 +147,9 @@
photoHeight = getHeight();
photoWidth = (int) (photoHeight * mLandscapePhotoRatio);
} else {
- // Make the photo a square
+ // Make the photo slightly shorter that it is wide
photoWidth = getWidth();
- photoHeight = photoWidth;
+ photoHeight = (int) (photoWidth / mPortraitPhotoRatio);
}
final ViewGroup.LayoutParams layoutParams = getLayoutParams();
layoutParams.height = photoHeight;