From 3d6c2d9bc0ff94c6ce34c3741d99fdae6e2148ba Mon Sep 17 00:00:00 2001 From: helencheuk Date: Tue, 23 Jan 2024 15:08:15 +0000 Subject: [PATCH] Draw outline inside the view so it would not be cut off Before: https://screenshot.googleplex.com/C2iwZxYV3KocTQq After: https://screenshot.googleplex.com/BC9YYtm8GngssNF Bug: 310953377 Test: Manual, navigate to the folder icon by keyboard, press enter to open and go to the bottom row app icon Flag: ACONFIG com.android.launcher3.enable_focus_outline Staging Change-Id: Iad5a081ef3838d2728f8845c4fa2ef726b2c781b --- .../launcher3/keyboard/FocusIndicatorHelper.java | 13 +------------ .../keyboard/ItemFocusIndicatorHelper.java | 7 +++++++ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/com/android/launcher3/keyboard/FocusIndicatorHelper.java b/src/com/android/launcher3/keyboard/FocusIndicatorHelper.java index c36f4552e3..3e320bdb35 100644 --- a/src/com/android/launcher3/keyboard/FocusIndicatorHelper.java +++ b/src/com/android/launcher3/keyboard/FocusIndicatorHelper.java @@ -57,18 +57,7 @@ public abstract class FocusIndicatorHelper extends ItemFocusIndicatorHelper implements AnimatorUpdateListe Rect newRect = getDrawRect(); if (newRect != null) { + if (Flags.enableFocusOutline()) { + // Stroke is drawn with half outside and half inside the view. Inset by half + // stroke width to move the whole stroke inside the view and avoid other views + // occluding it + int halfStrokeWidth = (int) mPaint.getStrokeWidth() / 2; + newRect.inset(halfStrokeWidth, halfStrokeWidth); + } mDirtyRect.set(newRect); c.drawRoundRect((float) mDirtyRect.left, (float) mDirtyRect.top, (float) mDirtyRect.right, (float) mDirtyRect.bottom,