Merge "Allow call reveal from touch point in contacts" into lmp-dev
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 6439c1d..0a5403b 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -144,6 +144,8 @@
<dimen name="expanding_entry_card_title_text_size">16sp</dimen>
<!-- Padding for the title text for a ExpandingEntryCardView -->
<dimen name="expanding_entry_card_title_padding">16dp</dimen>
+ <!-- Extra top padding if the title is set to null -->
+ <dimen name="expanding_entry_card_null_title_top_extra_padding">2dp</dimen>
<!-- Height of the separator between entries in an ExpandingEntryCardView -->
<dimen name="expanding_entry_card_item_separator_height">1dp</dimen>
diff --git a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
index 9891a8f..7501bb8 100644
--- a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
+++ b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
@@ -353,6 +353,15 @@
}
private void addEntry(View entry) {
+ // If no title and the first entry in the group, add extra padding
+ if (TextUtils.isEmpty(mTitleTextView.getText()) &&
+ mEntriesViewGroup.getChildCount() == 0) {
+ entry.setPadding(entry.getPaddingLeft(),
+ entry.getPaddingTop() + getResources().getDimensionPixelSize(
+ R.dimen.expanding_entry_card_null_title_top_extra_padding),
+ entry.getPaddingRight(),
+ entry.getPaddingBottom());
+ }
mEntriesViewGroup.addView(entry);
}
@@ -786,13 +795,30 @@
if (mTitleTextView == null) {
Log.e(TAG, "mTitleTextView is null");
}
- if (title == null) {
- mTitleTextView.setVisibility(View.GONE);
- findViewById(R.id.title_separator).setVisibility(View.GONE);
- }
mTitleTextView.setText(title);
- mTitleTextView.setVisibility(View.VISIBLE);
- findViewById(R.id.title_separator).setVisibility(View.VISIBLE);
+ mTitleTextView.setVisibility(TextUtils.isEmpty(title) ? View.GONE : View.VISIBLE);
+ findViewById(R.id.title_separator).setVisibility(TextUtils.isEmpty(title) ?
+ View.GONE : View.VISIBLE);
+ // If the title is set after children have been added, reset the top entry's padding to
+ // the default. Else if the title is cleared after children have been added, set
+ // the extra top padding
+ if (!TextUtils.isEmpty(title) && mEntriesViewGroup.getChildCount() > 0) {
+ View firstEntry = mEntriesViewGroup.getChildAt(0);
+ firstEntry.setPadding(firstEntry.getPaddingLeft(),
+ getResources().getDimensionPixelSize(
+ R.dimen.expanding_entry_card_item_padding_top),
+ firstEntry.getPaddingRight(),
+ firstEntry.getPaddingBottom());
+ } else if (!TextUtils.isEmpty(title) && mEntriesViewGroup.getChildCount() > 0) {
+ View firstEntry = mEntriesViewGroup.getChildAt(0);
+ firstEntry.setPadding(firstEntry.getPaddingLeft(),
+ getResources().getDimensionPixelSize(
+ R.dimen.expanding_entry_card_item_padding_top) +
+ getResources().getDimensionPixelSize(
+ R.dimen.expanding_entry_card_null_title_top_extra_padding),
+ firstEntry.getPaddingRight(),
+ firstEntry.getPaddingBottom());
+ }
}
public boolean shouldShow() {
diff --git a/src/com/android/contacts/widget/MultiShrinkScroller.java b/src/com/android/contacts/widget/MultiShrinkScroller.java
index ff84b2f..faa7e41 100644
--- a/src/com/android/contacts/widget/MultiShrinkScroller.java
+++ b/src/com/android/contacts/widget/MultiShrinkScroller.java
@@ -954,10 +954,14 @@
// How offset the title should be from the bottom of the toolbar
final int pretendBottomMargin = (int) (mCollapsedTitleBottomMargin * (1 - x)
+ mMaximumTitleMargin * x) ;
- // Calculate how offset the title should be from the top of the screen.
+ // Calculate how offset the title should be from the top of the screen. Instead of
+ // calling mLargeTextView.getHeight() use the mMaximumHeaderTextSize for this calculation.
+ // The getHeight() value acts unexpectedly when mLargeTextView is partially clipped by
+ // its parent.
titleLayoutParams.topMargin = getTransparentViewHeight()
+ toolbarLayoutParams.height - pretendBottomMargin
- - mLargeTextView.getHeight();
+ - mMaximumHeaderTextSize;
+ titleLayoutParams.bottomMargin = 0;
mLargeTextView.setLayoutParams(titleLayoutParams);
}