From f72f513e6c049f4b40f7a6bb30ae0e3d8a0567a0 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Thu, 11 Mar 2021 20:48:25 -0800 Subject: [PATCH] Fix AA+ decorator drawing out of bounds issue / Make AA+ opaque Bug: 182425322 Bug: 182305279 Test: manual Change-Id: Ib9fbd09613e8e1c50a9d75fb2ab9546d2f5230b7 --- .../allapps/AllAppsSectionDecorator.java | 24 ++++--------------- .../android/launcher3/views/ScrimView.java | 9 +------ 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/com/android/launcher3/allapps/AllAppsSectionDecorator.java b/src/com/android/launcher3/allapps/AllAppsSectionDecorator.java index f4d735e1da..269e3905c8 100644 --- a/src/com/android/launcher3/allapps/AllAppsSectionDecorator.java +++ b/src/com/android/launcher3/allapps/AllAppsSectionDecorator.java @@ -56,11 +56,10 @@ public class AllAppsSectionDecorator extends RecyclerView.ItemDecoration { SectionDecorationInfo sectionInfo = adapterItem.sectionDecorationInfo; SectionDecorationHandler decorationHandler = sectionInfo.getDecorationHandler(); if (decorationHandler != null) { - decorationHandler.extendBounds(view); if (sectionInfo.isFocusedView()) { decorationHandler.onFocusDraw(c, view); } else { - decorationHandler.onGroupDraw(c); + decorationHandler.onGroupDraw(c, view); } } } @@ -130,27 +129,14 @@ public class AllAppsSectionDecorator extends RecyclerView.ItemDecoration { } - /** - * Extends current bounds to include the view. - */ - public void extendBounds(View view) { - if (mBounds.isEmpty()) { - mBounds.set(view.getLeft(), view.getTop(), view.getRight(), view.getBottom()); - } else { - mBounds.set( - Math.min(mBounds.left, view.getLeft()), - Math.min(mBounds.top, view.getTop()), - Math.max(mBounds.right, view.getRight()), - Math.max(mBounds.bottom, view.getBottom()) - ); - } - } - /** * Draw bounds onto canvas. */ - public void onGroupDraw(Canvas canvas) { + public void onGroupDraw(Canvas canvas, View view) { + if (view == null) return; + mPaint.setColor(mFillcolor); + mBounds.set(view.getLeft(), view.getTop(), view.getRight(), view.getBottom()); onDraw(canvas); } diff --git a/src/com/android/launcher3/views/ScrimView.java b/src/com/android/launcher3/views/ScrimView.java index c9bd2840d8..7f0765becd 100644 --- a/src/com/android/launcher3/views/ScrimView.java +++ b/src/com/android/launcher3/views/ScrimView.java @@ -32,7 +32,6 @@ import androidx.core.graphics.ColorUtils; import com.android.launcher3.Insettable; import com.android.launcher3.Launcher; import com.android.launcher3.R; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.uioverrides.WallpaperColorInfo; import com.android.launcher3.uioverrides.WallpaperColorInfo.OnChangeListener; import com.android.launcher3.util.Themes; @@ -42,7 +41,6 @@ import com.android.launcher3.util.Themes; */ public class ScrimView extends View implements Insettable, OnChangeListener { - private static final float SCRIM_ALPHA = .95f; protected final T mLauncher; private final WallpaperColorInfo mWallpaperColorInfo; protected final int mEndScrim; @@ -61,12 +59,7 @@ public class ScrimView extends View implements Insettable, O super(context, attrs); mLauncher = Launcher.cast(Launcher.getLauncher(context)); mWallpaperColorInfo = WallpaperColorInfo.INSTANCE.get(context); - int endScrim = Themes.getAttrColor(context, R.attr.allAppsScrimColor); - if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) { - endScrim = Themes.getColorBackgroundFloating(context); - endScrim = ColorUtils.setAlphaComponent(endScrim, (int) (255 * SCRIM_ALPHA)); - } - mEndScrim = endScrim; + mEndScrim = Themes.getAttrColor(context, R.attr.allAppsScrimColor); mIsScrimDark = ColorUtils.calculateLuminance(mEndScrim) < 0.5f; mMaxScrimAlpha = 0.7f;