Skip to content

Commit

Permalink
Enlarge the icons on wide widgets
Browse files Browse the repository at this point in the history
* Also move the case details to the centre and separate the text a little

Signed-off-by: Ricky Cheung <[email protected]>
  • Loading branch information
Ricky Cheung authored and d4rken committed Jun 26, 2024
1 parent 7b474fb commit bbfb735
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ class WidgetProvider : AppWidgetProvider() {
.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH)
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.
* Although the minimum size is only 2x1, the safeguards are
* added if these restrictions will ever be loosened in the future.
*/
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
}

Expand Down
48 changes: 26 additions & 22 deletions app/src/main/res/layout/widget_pod_dual_wide_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="24dp"
android:layout_marginEnd="12dp"
android:gravity="center_vertical"
android:orientation="horizontal">

<ImageView
android:id="@+id/pod_left_icon"
style="@style/PodInfoItemIcon.Notification"
style="@style/PodInfoItemIcon.Notification.Large"
android:src="@drawable/devic_airpods_pro2_left"
tools:ignore="ContentDescription" />

Expand Down Expand Up @@ -49,17 +50,18 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="24dp"
android:layout_marginEnd="12dp"
android:gravity="center_vertical"
android:orientation="horizontal">

<ImageView
android:id="@+id/pod_right_icon"
style="@style/PodInfoItemIcon.Notification"
android:src="@drawable/devic_airpods_pro2_right"
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_right_label"
android:id="@+id/pod_case_label"
style="@style/PodInfoItemText.Notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -68,32 +70,26 @@
tools:text="100%" />

<ImageView
android:id="@+id/pod_right_charging"
style="@style/PodInfoItemIcon.Notification"
android:src="@drawable/ic_baseline_power_24"
tools:ignore="ContentDescription" />

<ImageView
android:id="@+id/pod_right_ear"
android:id="@+id/pod_case_charging"
style="@style/PodInfoItemIcon.Notification"
android:src="@drawable/ic_baseline_hearing_24"
tools:ignore="ContentDescription" />
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">

<ImageView
android:id="@+id/pod_case_icon"
style="@style/PodInfoItemIcon.Notification"
android:src="@drawable/devic_airpods_gen1_case"
android:id="@+id/pod_right_icon"
style="@style/PodInfoItemIcon.Notification.Large"
android:src="@drawable/devic_airpods_pro2_right"
tools:ignore="ContentDescription" />

<TextView
android:id="@+id/pod_case_label"
android:id="@+id/pod_right_label"
style="@style/PodInfoItemText.Notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -102,9 +98,16 @@
tools:text="100%" />

<ImageView
android:id="@+id/pod_case_charging"
android:id="@+id/pod_right_charging"
style="@style/PodInfoItemIcon.Notification"
android:src="@drawable/ic_baseline_power_24" />
android:src="@drawable/ic_baseline_power_24"
tools:ignore="ContentDescription" />

<ImageView
android:id="@+id/pod_right_ear"
style="@style/PodInfoItemIcon.Notification"
android:src="@drawable/ic_baseline_hearing_24"
tools:ignore="ContentDescription" />
</LinearLayout>

</LinearLayout>
Expand All @@ -115,6 +118,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:gravity="center"
android:textSize="12sp"
android:textStyle="bold"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
<item name="tint">?android:attr/colorAccent</item>
</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">
<item name="android:singleLine">true</item>
<item name="android:ellipsize">end</item>
Expand Down

0 comments on commit bbfb735

Please sign in to comment.