Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f72f513e authored by Hyunyoung Song's avatar Hyunyoung Song
Browse files

Fix AA+ decorator drawing out of bounds issue / Make AA+ opaque

Bug: 182425322
Bug: 182305279

Test: manual

Change-Id: Ib9fbd09613e8e1c50a9d75fb2ab9546d2f5230b7
parent 43b93101
Loading
Loading
Loading
Loading
+5 −19
Original line number Diff line number Diff line
@@ -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);
        }

+1 −8
Original line number Diff line number Diff line
@@ -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<T extends Launcher> 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<T extends Launcher> 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;