Skip to content

Commit a973218

Browse files
minaripenguinMocaRafee
authored andcommitted
Launcher3: Remove AOSP's headercolor protection paint on scroll offset
Ref: RisingTechOSS/android_packages_apps_Launcher@360add89
1 parent aa0c803 commit a973218

1 file changed

Lines changed: 2 additions & 73 deletions

File tree

src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java

Lines changed: 2 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
156156
private boolean mHasWorkApps;
157157
private float[] mBottomSheetCornerRadii;
158158
private ScrimView mScrimView;
159-
private int mHeaderColor;
160159
private int mBottomSheetBackgroundColor;
161160
private int mTabsProtectionAlpha;
162161
@Nullable private AllAppsTransitionController mAllAppsTransitionController;
@@ -618,13 +617,11 @@ void setupHeader() {
618617
protected void updateHeaderScroll(int scrolledOffset) {
619618
getSearchView().setBackgroundResource(R.drawable.bg_all_apps_searchbox_google_themed);
620619
float prog1 = Utilities.boundToRange((float) scrolledOffset / mHeaderThreshold, 0f, 1f);
621-
int headerColor = getHeaderColor(prog1);
622620
int tabsAlpha = mHeader.getPeripheralProtectionHeight() == 0 ? 0
623621
: (int) (Utilities.boundToRange(
624622
(scrolledOffset + mHeader.mSnappedScrolledY) / mHeaderThreshold, 0f, 1f)
625623
* 255);
626-
if (headerColor != mHeaderColor || mTabsProtectionAlpha != tabsAlpha) {
627-
mHeaderColor = headerColor;
624+
if (mTabsProtectionAlpha != tabsAlpha) {
628625
mTabsProtectionAlpha = tabsAlpha;
629626
invalidateHeader();
630627
}
@@ -642,12 +639,6 @@ protected void updateHeaderScroll(int scrolledOffset) {
642639
mSearchUiManager.setBackgroundVisibility(bgVisible, 1 - prog);
643640
}
644641

645-
protected int getHeaderColor(float blendRatio) {
646-
return ColorUtils.setAlphaComponent(
647-
ColorUtils.blendARGB(mScrimColor, mHeaderProtectionColor, blendRatio),
648-
(int) (mSearchContainer.getAlpha() * 255));
649-
}
650-
651642
/**
652643
* It is up to the search container view created by {@link #inflateSearchBox()} to use the
653644
* floating search bar flag to move itself to the bottom of this container. This method checks
@@ -1160,69 +1151,7 @@ public void drawOnScrimWithScale(Canvas canvas, float scale) {
11601151
canvas.drawPath(mTmpPath, mHeaderPaint);
11611152
}
11621153

1163-
if (DEBUG_HEADER_PROTECTION) {
1164-
mHeaderPaint.setColor(Color.MAGENTA);
1165-
mHeaderPaint.setAlpha(255);
1166-
} else {
1167-
mHeaderPaint.setColor(mHeaderColor);
1168-
mHeaderPaint.setAlpha((int) (getAlpha() * Color.alpha(mHeaderColor)));
1169-
}
1170-
if (mHeaderPaint.getColor() == mScrimColor || mHeaderPaint.getColor() == 0) {
1171-
return;
1172-
}
1173-
1174-
// Draw header on background panel
1175-
final float headerBottomNoScale =
1176-
getHeaderBottom() + getVisibleContainerView().getPaddingTop();
1177-
final float headerHeightNoScale = headerBottomNoScale - topNoScale;
1178-
final float headerBottomWithScaleOnTablet = topWithScale + headerHeightNoScale * scale;
1179-
final float headerBottomOffset = (getVisibleContainerView().getHeight() * (1 - scale) / 2);
1180-
final float headerBottomWithScaleOnPhone = headerBottomNoScale * scale + headerBottomOffset;
1181-
final FloatingHeaderView headerView = getFloatingHeaderView();
1182-
if (isTablet) {
1183-
// Start adding header protection if search bar or tabs will attach to the top.
1184-
if (!FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() || mUsingTabs) {
1185-
mTmpRectF.set(
1186-
leftWithScale,
1187-
topWithScale,
1188-
rightWithScale,
1189-
headerBottomWithScaleOnTablet);
1190-
mTmpPath.reset();
1191-
mTmpPath.addRoundRect(mTmpRectF, mBottomSheetCornerRadii, Direction.CW);
1192-
canvas.drawPath(mTmpPath, mHeaderPaint);
1193-
}
1194-
} else {
1195-
canvas.drawRect(0, 0, canvas.getWidth(), headerBottomWithScaleOnPhone, mHeaderPaint);
1196-
}
1197-
1198-
// If tab exist (such as work profile), extend header with tab height
1199-
final int tabsHeight = headerView.getPeripheralProtectionHeight();
1200-
if (mTabsProtectionAlpha > 0 && tabsHeight != 0) {
1201-
if (DEBUG_HEADER_PROTECTION) {
1202-
mHeaderPaint.setColor(Color.BLUE);
1203-
mHeaderPaint.setAlpha(255);
1204-
} else {
1205-
mHeaderPaint.setAlpha((int) (getAlpha() * mTabsProtectionAlpha));
1206-
}
1207-
float left = 0f;
1208-
float right = canvas.getWidth();
1209-
if (isTablet) {
1210-
left = mBottomSheetBackground.getLeft() + horizontalScaleOffset;
1211-
right = mBottomSheetBackground.getRight() - horizontalScaleOffset;
1212-
}
1213-
1214-
final float tabTopWithScale = isTablet
1215-
? headerBottomWithScaleOnTablet
1216-
: headerBottomWithScaleOnPhone;
1217-
final float tabBottomWithScale = tabTopWithScale + tabsHeight * scale;
1218-
1219-
canvas.drawRect(
1220-
left,
1221-
tabTopWithScale,
1222-
right,
1223-
tabBottomWithScale,
1224-
mHeaderPaint);
1225-
}
1154+
mHeaderPaint.setColor(mHeaderProtectionColor);
12261155
}
12271156

12281157
/**

0 commit comments

Comments
 (0)