summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/dimens.xml4
-rw-r--r--src/com/android/contacts/widget/MultiShrinkScroller.java14
2 files changed, 14 insertions, 4 deletions
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 7ac050252..cb9f101b4 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -153,8 +153,10 @@
<dimen name="expanding_entry_card_marginEnd">8dp</dimen>
<dimen name="expanding_entry_card_marginBottom">8dp</dimen>
- <!-- Elevation of an ExpandingEntryCard -->
+ <!-- Elevation of an ExpandingEntryCard, for the sake of shadow casting -->
<dimen name="expanding_entry_card_elevation">2dp</dimen>
+ <!-- Elevation of the QuickContact's Toolbar, for the sake of shadow casting -->
+ <dimen name="quick_contact_toolbar_elevation">6dp</dimen>
<!-- Top margin for the communication card, used to add space from header. -->
<dimen name="communication_card_marginTop">8dp</dimen>
diff --git a/src/com/android/contacts/widget/MultiShrinkScroller.java b/src/com/android/contacts/widget/MultiShrinkScroller.java
index 00dc7b402..01aeb4e02 100644
--- a/src/com/android/contacts/widget/MultiShrinkScroller.java
+++ b/src/com/android/contacts/widget/MultiShrinkScroller.java
@@ -51,6 +51,7 @@ public class MultiShrinkScroller extends LinearLayout {
private View mScrollViewChild;
private View mToolbar;
private ImageView mPhotoView;
+ private View mPhotoViewContainer;
private MultiShrinkScrollerListener mListener;
private int mHeaderTintColor;
@@ -63,6 +64,7 @@ public class MultiShrinkScroller extends LinearLayout {
private final int mMinimumHeaderHeight;
private final int mTransparentStartHeight;
private final int mElasticScrollOverTopRegion;
+ private final float mToolbarElevation;
private final PorterDuffColorFilter mColorFilter
= new PorterDuffColorFilter(0, PorterDuff.Mode.SRC_ATOP);
@@ -118,6 +120,8 @@ public class MultiShrinkScroller extends LinearLayout {
R.dimen.quickcontact_elastic_scroll_over_top_region);
mHeaderTintColor = mContext.getResources().getColor(
R.color.actionbar_background_color);
+ mToolbarElevation = (float) mContext.getResources().getDimension(
+ R.dimen.quick_contact_toolbar_elevation);
}
/**
@@ -128,6 +132,7 @@ public class MultiShrinkScroller extends LinearLayout {
mScrollViewChild = findViewById(R.id.card_container);
mToolbar = findViewById(R.id.toolbar_parent);
mPhotoView = (ImageView) findViewById(R.id.photo);
+ mPhotoViewContainer = findViewById(R.id.toolbar_parent);
mListener = listener;
}
@@ -225,7 +230,7 @@ public class MultiShrinkScroller extends LinearLayout {
public void setHeaderTintColor(int color) {
mHeaderTintColor = color;
- updatePhotoTint();
+ updatePhotoTintAndDropShadow();
}
private void startDrag() {
@@ -303,7 +308,7 @@ public class MultiShrinkScroller extends LinearLayout {
} else {
scrollDown(delta);
}
- updatePhotoTint();
+ updatePhotoTintAndDropShadow();
final boolean isFullscreen = getScrollNeededToBeFullScreen() <= 0;
if (mListener != null) {
if (wasFullscreen && !isFullscreen) {
@@ -461,19 +466,22 @@ public class MultiShrinkScroller extends LinearLayout {
}
}
- private void updatePhotoTint() {
+ private void updatePhotoTintAndDropShadow() {
// We need to use toolbarLayoutParams to determine the height, since the layout
// params can be updated before the height change is reflected inside the View#getHeight().
final int toolbarHeight = mToolbar.getLayoutParams().height;
// Reuse an existing mColorFilter (to avoid GC pauses) to change the photo's tint.
mPhotoView.clearColorFilter();
if (toolbarHeight >= mMaximumHeaderHeight) {
+ mPhotoViewContainer.setElevation(0);
return;
}
if (toolbarHeight <= mMinimumHeaderHeight) {
mColorFilter.setColor(mHeaderTintColor);
mPhotoView.setColorFilter(mColorFilter);
+ mPhotoViewContainer.setElevation(mToolbarElevation);
} else {
+ mPhotoViewContainer.setElevation(0);
final int alphaBits = 0xff - 0xff * (mToolbar.getHeight() - mMinimumHeaderHeight)
/ (mMaximumHeaderHeight - mMinimumHeaderHeight);
final int color = alphaBits << 24 | (mHeaderTintColor & 0xffffff);