OSDN Git Service

Render invocation lights as beziers, not circles
authorJames O'Leary <jamesoleary@google.com>
Fri, 21 Jun 2019 15:30:43 +0000 (15:30 +0000)
committerJames O'Leary <jamesoleary@google.com>
Sun, 23 Jun 2019 19:35:33 +0000 (19:35 +0000)
Test: Verify WAI
Bug: 135669903
Change-Id: I8dd9f96179264b5a44a9446977ada1ed4ea8e3c8

packages/SystemUI/src/com/android/systemui/assist/ui/InvocationLightsView.java

index 178f4c3..8ef7b6c 100644 (file)
@@ -92,15 +92,14 @@ public class InvocationLightsView extends View
         mPaint.setStrokeJoin(Paint.Join.MITER);
         mPaint.setAntiAlias(true);
 
-        int cornerRadiusBottom = DisplayUtils.getCornerRadiusBottom(context);
-        int cornerRadiusTop = DisplayUtils.getCornerRadiusTop(context);
+
         int displayWidth = DisplayUtils.getWidth(context);
         int displayHeight = DisplayUtils.getHeight(context);
-        CircularCornerPathRenderer cornerPathRenderer = new CircularCornerPathRenderer(
-                cornerRadiusBottom, cornerRadiusTop, displayWidth, displayHeight);
-        mGuide = new PerimeterPathGuide(context, cornerPathRenderer,
+        mGuide = new PerimeterPathGuide(context, createCornerPathRenderer(context),
                 mStrokeWidth / 2, displayWidth, displayHeight);
 
+        int cornerRadiusBottom = DisplayUtils.getCornerRadiusBottom(context);
+        int cornerRadiusTop = DisplayUtils.getCornerRadiusTop(context);
         mViewHeight = Math.max(cornerRadiusBottom, cornerRadiusTop);
 
         final int dualToneDarkTheme = Utils.getThemeAttr(mContext, R.attr.darkIconTheme);
@@ -243,6 +242,19 @@ public class InvocationLightsView extends View
     }
 
     /**
+     * Returns CornerPathRenderer to be used for rendering invocation lights.
+     *
+     * To render corners that aren't circular, override this method in a subclass.
+     */
+    protected CornerPathRenderer createCornerPathRenderer(Context context) {
+        int displayWidth = DisplayUtils.getWidth(context);
+        int displayHeight = DisplayUtils.getHeight(context);
+        int cornerRadiusBottom = DisplayUtils.getCornerRadiusBottom(context);
+        int cornerRadiusTop = DisplayUtils.getCornerRadiusTop(context);
+        return new CircularCornerPathRenderer(
+                cornerRadiusBottom, cornerRadiusTop, displayWidth, displayHeight);
+    }
+    /**
      * Receives an intensity from 0 (lightest) to 1 (darkest) and sets the handle color
      * appropriately. Intention is to match the home handle color.
      */