clock: fix widget
- Commit
7a17e134a36c9e27bbf8b9a05c516ee13c643b71- Author
- Vayun Mathur <[email protected]>
- When
- 2026-07-06 19:12 UTC (5 months ago)
- Parents
07af77f
Diff
clock/src/main/res/drawable/analog_clock_dial.xml
diff --git a/clock/src/main/res/drawable/analog_clock_dial.xml b/clock/src/main/res/drawable/analog_clock_dial.xmlindex 4953c823e5..c2e1631e43 100644--- a/clock/src/main/res/drawable/analog_clock_dial.xml+++ b/clock/src/main/res/drawable/analog_clock_dial.xml@@ -1,23 +1,12 @@ <?xml version="1.0" encoding="utf-8"?>-<!-- Clock face: 12 subtle Material You tick dots. Also defines the clock's- intrinsic size so AnalogClock scales the hands to match. -->+<!-- Clock face: intentionally blank. This vector only defines the clock's intrinsic size+ (200x200) so AnalogClock scales the hands to match; the tick dots have been removed. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="200dp" android:height="200dp" android:viewportWidth="200" android:viewportHeight="200"> <path- android:fillColor="@android:color/system_neutral1_400"- android:pathData="M97,12 a3,3 0 1,0 6,0 a3,3 0 1,0 -6,0- M141,23.8 a3,3 0 1,0 6,0 a3,3 0 1,0 -6,0- M173.2,56 a3,3 0 1,0 6,0 a3,3 0 1,0 -6,0- M185,100 a3,3 0 1,0 6,0 a3,3 0 1,0 -6,0- M173.2,144 a3,3 0 1,0 6,0 a3,3 0 1,0 -6,0- M141,176.2 a3,3 0 1,0 6,0 a3,3 0 1,0 -6,0- M97,188 a3,3 0 1,0 6,0 a3,3 0 1,0 -6,0- M53,176.2 a3,3 0 1,0 6,0 a3,3 0 1,0 -6,0- M20.8,144 a3,3 0 1,0 6,0 a3,3 0 1,0 -6,0- M9,100 a3,3 0 1,0 6,0 a3,3 0 1,0 -6,0- M20.8,56 a3,3 0 1,0 6,0 a3,3 0 1,0 -6,0- M53,23.8 a3,3 0 1,0 6,0 a3,3 0 1,0 -6,0" />+ android:fillColor="#00000000"+ android:pathData="M0,0 L200,0 L200,200 L0,200 Z" /> </vector>
clock/src/main/res/drawable/analog_clock_hand_hour.xml
diff --git a/clock/src/main/res/drawable/analog_clock_hand_hour.xml b/clock/src/main/res/drawable/analog_clock_hand_hour.xmlindex bd113200bd..f1105fb99e 100644--- a/clock/src/main/res/drawable/analog_clock_hand_hour.xml+++ b/clock/src/main/res/drawable/analog_clock_hand_hour.xml@@ -7,7 +7,7 @@ android:viewportHeight="200"> <path android:strokeColor="@android:color/system_accent1_100"- android:strokeWidth="16"+ android:strokeWidth="12" android:strokeLineCap="round"- android:pathData="M100,114 L100,64" />+ android:pathData="M100,100 L100,64" /> </vector>
clock/src/main/res/drawable/analog_clock_hand_minute.xml
diff --git a/clock/src/main/res/drawable/analog_clock_hand_minute.xml b/clock/src/main/res/drawable/analog_clock_hand_minute.xmlindex 360bdc3fa4..0b5ea14478 100644--- a/clock/src/main/res/drawable/analog_clock_hand_minute.xml+++ b/clock/src/main/res/drawable/analog_clock_hand_minute.xml@@ -9,5 +9,5 @@ android:strokeColor="@android:color/system_accent1_200" android:strokeWidth="12" android:strokeLineCap="round"- android:pathData="M100,120 L100,40" />+ android:pathData="M100,100 L100,40" /> </vector>
clock/src/main/res/drawable/analog_clock_widget_background.xml
diff --git a/clock/src/main/res/drawable/analog_clock_widget_background.xml b/clock/src/main/res/drawable/analog_clock_widget_background.xmlindex 39cb3a7e21..3eaec8ecc2 100644--- a/clock/src/main/res/drawable/analog_clock_widget_background.xml+++ b/clock/src/main/res/drawable/analog_clock_widget_background.xml@@ -1,5 +1,9 @@ <?xml version="1.0" encoding="utf-8"?>-<!-- Material You rounded "blob" container for the analog clock widget. -->+<!-- 12-leaf clover blob for the analog clock widget: analogous to Material 3+ MaterialShapes.Clover8Leaf (round petal tips, sharp valleys; same dA/dB and tip-rounding+ proportions) but with 12 petals whose tips sit on the 12 hour marks. Kept 1:1 (square)+ so it always renders as a blob; the layout scales it with fitCenter to stay centered+ and as large as possible in any widget size. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="120dp" android:height="120dp"@@ -7,9 +11,41 @@ android:viewportHeight="100"> <path android:fillColor="@android:color/system_neutral1_800"- android:pathData="M50,2- C78,2 98,22 98,50- C98,78 78,98 50,98- C22,98 2,78 2,50- C2,22 22,2 50,2 Z" />+ android:pathData="M40.01,7.25+ A11.57,11.57 0 0,1 59.99,7.25+ L61,8.96+ L62.72,7.98+ A11.57,11.57 0 0,1 80.03,17.97+ L80.04,19.96+ L82.03,19.97+ A11.57,11.57 0 0,1 92.02,37.28+ L91.04,39+ L92.75,40.01+ A11.57,11.57 0 0,1 92.75,59.99+ L91.04,61+ L92.02,62.72+ A11.57,11.57 0 0,1 82.03,80.03+ L80.04,80.04+ L80.03,82.03+ A11.57,11.57 0 0,1 62.72,92.02+ L61,91.04+ L59.99,92.75+ A11.57,11.57 0 0,1 40.01,92.75+ L39,91.04+ L37.28,92.02+ A11.57,11.57 0 0,1 19.97,82.03+ L19.96,80.04+ L17.97,80.03+ A11.57,11.57 0 0,1 7.98,62.72+ L8.96,61+ L7.25,59.99+ A11.57,11.57 0 0,1 7.25,40.01+ L8.96,39+ L7.98,37.28+ A11.57,11.57 0 0,1 17.97,19.97+ L19.96,19.96+ L19.97,17.97+ A11.57,11.57 0 0,1 37.28,7.98+ L39,8.96+ Z" /> </vector>
clock/src/main/res/layout/analog_clock_widget.xml
diff --git a/clock/src/main/res/layout/analog_clock_widget.xml b/clock/src/main/res/layout/analog_clock_widget.xmlindex ef06dbd730..82d09f2bd7 100644--- a/clock/src/main/res/layout/analog_clock_widget.xml+++ b/clock/src/main/res/layout/analog_clock_widget.xml@@ -1,11 +1,21 @@ <?xml version="1.0" encoding="utf-8"?>+<!-- The blob background is drawn by an ImageView with scaleType="fitCenter" (instead of+ as the root's stretchable background) so it always stays a centered 1:1 blob, as large+ as possible, even when the widget is resized into a non-square rectangle. The framework+ AnalogClock likewise scales its square dial centered, so the two stay aligned. --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/analog_clock_widget_root" android:layout_width="match_parent" android:layout_height="match_parent"- android:background="@drawable/analog_clock_widget_background" android:padding="10dp"> + <ImageView+ android:layout_width="match_parent"+ android:layout_height="match_parent"+ android:src="@drawable/analog_clock_widget_background"+ android:scaleType="fitCenter"+ android:contentDescription="@null" />+ <AnalogClock android:layout_width="match_parent" android:layout_height="match_parent"