Twelve: Use system provided corners for widgets
Change-Id: I3251d3fd5f4fa686307df655b28c756ae88cbd31
diff --git a/app/src/main/res/drawable/bg_app_widget.xml b/app/src/main/res/drawable/bg_app_widget.xml
new file mode 100644
index 0000000..a6c498b
--- /dev/null
+++ b/app/src/main/res/drawable/bg_app_widget.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ SPDX-FileCopyrightText: 2024 The LineageOS Project
+ SPDX-License-Identifier: Apache-2.0
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+
+ <corners android:radius="?attr/appWidgetRadius" />
+</shape>
diff --git a/app/src/main/res/layout/app_widget_now_playing.xml b/app/src/main/res/layout/app_widget_now_playing.xml
index 9eaf8fb..44426f0 100644
--- a/app/src/main/res/layout/app_widget_now_playing.xml
+++ b/app/src/main/res/layout/app_widget_now_playing.xml
@@ -8,20 +8,23 @@
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="?attr/colorSurface"
+ android:background="@drawable/bg_app_widget"
+ android:backgroundTint="?attr/colorSurface"
android:baselineAligned="false"
+ android:clipToOutline="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="16dp"
- android:theme="@style/Theme.Material3.DynamicColors.DayNight">
+ android:theme="@style/Theme.Twelve.AppWidgetContainer"
+ tools:targetApi="s">
<ImageView
android:id="@+id/thumbnailImageView"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
android:background="@drawable/bg_app_widget_round_view"
android:backgroundTint="?attr/colorSecondaryContainer"
android:clipToOutline="true"
- android:layout_width="60dp"
- android:layout_height="60dp"
android:src="@drawable/ic_music_note"
tools:targetApi="s" />
diff --git a/app/src/main/res/values-v31/themes.xml b/app/src/main/res/values-v31/themes.xml
new file mode 100644
index 0000000..c98aa66
--- /dev/null
+++ b/app/src/main/res/values-v31/themes.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ SPDX-FileCopyrightText: 2024 The LineageOS Project
+ SPDX-License-Identifier: Apache-2.0
+-->
+<resources>
+ <!-- App widget -->
+ <style name="Theme.Twelve.AppWidgetContainer" parent="Theme.Material3.DynamicColors.DayNight">
+ <item name="appWidgetRadius">@android:dimen/system_app_widget_background_radius</item>
+ </style>
+</resources>
diff --git a/app/src/main/res/values/attrs_AppWidget.xml b/app/src/main/res/values/attrs_AppWidget.xml
new file mode 100644
index 0000000..eb10073
--- /dev/null
+++ b/app/src/main/res/values/attrs_AppWidget.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ SPDX-FileCopyrightText: 2024 The LineageOS Project
+ SPDX-License-Identifier: Apache-2.0
+-->
+<resources>
+ <declare-styleable name="AppWidget">
+ <attr name="appWidgetRadius" format="dimension" />
+ </declare-styleable>
+</resources>
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index f8fb2e9..ca225a2 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -105,4 +105,9 @@
<item name="android:visibility">gone</item>
<item name="tint">?attr/colorOnSecondaryContainer</item>
</style>
+
+ <!-- App widget -->
+ <style name="Theme.Twelve.AppWidgetContainer" parent="Theme.Material3.DynamicColors.DayNight">
+ <item name="appWidgetRadius">28dp</item>
+ </style>
</resources>