Merge "Fix AA+ decorator drawing out of bounds issue / Make AA+ opaque" into sc-dev

This commit is contained in:
Hyunyoung Song authored and Android (Google) Code Review committed 2021-03-15 18:18:21 +00:00
commit 1b56eb4e6f
2 files changed
+6 -27

No files matched your search

@@ -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);
}
@@ -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;