Fix header protection interactions

Bug: 184711608
Bug: 187790639
Preview: https://drive.google.com/file/d/1MDh71t8DQn0SxTQY3-GZTfIlGECQs_Kn/view?usp=sharing&resourcekey=0-ep9C3q9Meo8cQShVJqnKEw
Test: Manual
Change-Id: I9c939a894adc3e9cd1ed1beb7c11f9c2dd673824
This commit is contained in:
Samuel Fufa
2021-05-17 09:23:04 -05:00
parent ca65ca4538
commit 0a709374ae
5 changed files with 53 additions and 36 deletions

View File

@@ -720,7 +720,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
mHeaderPaint.setColor(mHeaderColor);
mHeaderPaint.setAlpha((int) (getAlpha() * Color.alpha(mHeaderColor)));
if (mHeaderPaint.getColor() != mScrimColor && mHeaderPaint.getColor() != 0) {
canvas.drawRect(0, 0, getWidth(), mHeaderTopPadding + getTranslationY(),
canvas.drawRect(0, 0, getWidth(), mSearchContainer.getTop() + getTranslationY(),
mHeaderPaint);
}
}
@@ -830,10 +830,13 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
protected void updateHeaderScroll(int scrolledOffset) {
float prog = Math.max(0, Math.min(1, (float) scrolledOffset / mHeaderThreshold));
int headerColor = ColorUtils.setAlphaComponent(mHeaderProtectionColor, (int) (prog * 255));
int viewBG = ColorUtils.blendARGB(mScrimColor, mHeaderProtectionColor, prog);
int headerColor = ColorUtils.setAlphaComponent(viewBG,
(int) (getSearchView().getAlpha() * 255));
if (headerColor != mHeaderColor) {
mHeaderColor = headerColor;
getSearchView().setBackgroundColor(mHeaderColor);
getSearchView().setBackgroundColor(viewBG);
getFloatingHeaderView().setHeaderColor(viewBG);
invalidateHeader();
}
}