summaryrefslogtreecommitdiffstats
path: root/src/com/android/contacts/common/list/ContactListItemView.java
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-05-30 12:28:17 -0700
committerAndrew Lee <anwlee@google.com>2014-05-30 12:38:51 -0700
commit6fdf16941587a222f554482fb72531783a924b6e (patch)
tree55fba5f1949f7943752ccbbea06e78039be883ab /src/com/android/contacts/common/list/ContactListItemView.java
parent7a3f3a77dac05ed4135ab817e3ee7057aba1f182 (diff)
downloadandroid_packages_apps_ContactsCommon-6fdf16941587a222f554482fb72531783a924b6e.tar.gz
android_packages_apps_ContactsCommon-6fdf16941587a222f554482fb72531783a924b6e.tar.bz2
android_packages_apps_ContactsCommon-6fdf16941587a222f554482fb72531783a924b6e.zip
Match contact list items to redlines for Dialer.
- Add text offset top functionality in the pinned header and headers. In the pinned header this was done with padding, because the pinned header is a (assumeedly vertically centered) child and then the parent doesn't need to be privy to these details. - Update width and font size. I imagine we want these changes to be consistent between Dialer and Contacts, which is why this was done here instead of in Dialer. Bug: 15332945 Change-Id: If2ebf8117f528316b256a86ed9922f917e9c75ae
Diffstat (limited to 'src/com/android/contacts/common/list/ContactListItemView.java')
-rw-r--r--src/com/android/contacts/common/list/ContactListItemView.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/com/android/contacts/common/list/ContactListItemView.java b/src/com/android/contacts/common/list/ContactListItemView.java
index af094ebc..da452cf3 100644
--- a/src/com/android/contacts/common/list/ContactListItemView.java
+++ b/src/com/android/contacts/common/list/ContactListItemView.java
@@ -141,7 +141,6 @@ public class ContactListItemView extends ViewGroup
private PhotoPosition mPhotoPosition = getDefaultPhotoPosition(false /* normal/non opposite */);
// Header layout data
- private int mHeaderBackgroundHeight;
private TextView mHeaderTextView;
private boolean mIsSectionHeaderEnabled;
@@ -440,8 +439,7 @@ public class ContactListItemView extends ViewGroup
if (mHeaderTextView != null && mHeaderTextView.getVisibility() == VISIBLE) {
mHeaderTextView.measure(
MeasureSpec.makeMeasureSpec(mHeaderWidth, MeasureSpec.EXACTLY),
- MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
- mHeaderBackgroundHeight = Math.min(height, mHeaderTextView.getMeasuredHeight());
+ MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
}
setMeasuredDimension(specWidth, height);
@@ -463,11 +461,14 @@ public class ContactListItemView extends ViewGroup
// Put the section header on the left side of the contact view.
if (mIsSectionHeaderEnabled) {
if (mHeaderTextView != null) {
+ int headerHeight = mHeaderTextView.getMeasuredHeight();
+ int headerTopBound = (bottomBound + topBound - headerHeight) / 2 + mTextOffsetTop;
+
mHeaderTextView.layout(
isLayoutRtl ? rightBound - mHeaderWidth : leftBound,
- topBound,
+ headerTopBound,
isLayoutRtl ? rightBound : leftBound + mHeaderWidth,
- mHeaderBackgroundHeight);
+ headerTopBound + headerHeight);
}
if (isLayoutRtl) {
rightBound -= mHeaderWidth;
@@ -717,8 +718,8 @@ public class ContactListItemView extends ViewGroup
if (mHeaderTextView == null) {
mHeaderTextView = new TextView(getContext());
mHeaderTextView.setTextAppearance(getContext(), R.style.SectionHeaderStyle);
- mHeaderTextView.setGravity(Gravity.CENTER_VERTICAL |
- (ViewUtil.isViewLayoutRtl(this) ? Gravity.RIGHT : Gravity.LEFT));
+ mHeaderTextView.setGravity(
+ ViewUtil.isViewLayoutRtl(this) ? Gravity.RIGHT : Gravity.LEFT);
addView(mHeaderTextView);
}
setMarqueeText(mHeaderTextView, title);