Enlarge the icons on wide widgets

* Also move the case details to the centre and separate the text a little

Signed-off-by: Ricky Cheung <rcheung844@gmail.com>
This commit is contained in:
Ricky Cheung
2024-06-26 12:41:24 +02:00
committed by Matthias Urhahn
parent 7b474fb0e1
commit bbfb735124
3 changed files with 42 additions and 33 deletions
@@ -135,13 +135,13 @@ class WidgetProvider : AppWidgetProvider() {
.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH) .getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH)
val columns = getCellsForSize(minWidth) val columns = getCellsForSize(minWidth)
/* Enable wide widgets only when we are provided with 4 or /* Enable wide widgets only when we are provided with 5 or
* more columns of space. * more columns of space.
* Although the minimum size is only 2x1, the safeguards are * Although the minimum size is only 2x1, the safeguards are
* added if these restrictions will ever be loosened in the future. * added if these restrictions will ever be loosened in the future.
*/ */
val layout = when (columns) { val layout = when (columns) {
in 1 .. 3 -> R.layout.widget_pod_dual_compact_layout in 1 .. 4 -> R.layout.widget_pod_dual_compact_layout
else -> R.layout.widget_pod_dual_wide_layout else -> R.layout.widget_pod_dual_wide_layout
} }
@@ -14,12 +14,13 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginEnd="24dp" android:layout_marginEnd="12dp"
android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/pod_left_icon" android:id="@+id/pod_left_icon"
style="@style/PodInfoItemIcon.Notification" style="@style/PodInfoItemIcon.Notification.Large"
android:src="@drawable/devic_airpods_pro2_left" android:src="@drawable/devic_airpods_pro2_left"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
@@ -49,12 +50,41 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginEnd="24dp" android:layout_marginEnd="12dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/pod_case_icon"
style="@style/PodInfoItemIcon.Notification.Large"
android:src="@drawable/devic_airpods_gen1_case"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/pod_case_label"
style="@style/PodInfoItemText.Notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="4dp"
tools:text="100%" />
<ImageView
android:id="@+id/pod_case_charging"
style="@style/PodInfoItemIcon.Notification"
android:src="@drawable/ic_baseline_power_24" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/pod_right_icon" android:id="@+id/pod_right_icon"
style="@style/PodInfoItemIcon.Notification" style="@style/PodInfoItemIcon.Notification.Large"
android:src="@drawable/devic_airpods_pro2_right" android:src="@drawable/devic_airpods_pro2_right"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
@@ -80,33 +110,6 @@
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/pod_case_icon"
style="@style/PodInfoItemIcon.Notification"
android:src="@drawable/devic_airpods_gen1_case"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/pod_case_label"
style="@style/PodInfoItemText.Notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="4dp"
tools:text="100%" />
<ImageView
android:id="@+id/pod_case_charging"
style="@style/PodInfoItemIcon.Notification"
android:src="@drawable/ic_baseline_power_24" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<TextView <TextView
@@ -115,6 +118,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="8dp"
android:gravity="center" android:gravity="center"
android:textSize="12sp" android:textSize="12sp"
android:textStyle="bold" android:textStyle="bold"
+5
View File
@@ -24,6 +24,11 @@
<item name="tint">?android:attr/colorAccent</item> <item name="tint">?android:attr/colorAccent</item>
</style> </style>
<style name="PodInfoItemIcon.Notification.Large" parent="PodInfoItemIcon.Notification">
<item name="android:layout_height">40dp</item>
<item name="android:layout_width">40dp</item>
</style>
<style name="PodInfoItemText.Notification" parent="TextAppearance.Compat.Notification.Title"> <style name="PodInfoItemText.Notification" parent="TextAppearance.Compat.Notification.Title">
<item name="android:singleLine">true</item> <item name="android:singleLine">true</item>
<item name="android:ellipsize">end</item> <item name="android:ellipsize">end</item>