feat(mobile): add random 4x2 flex window widget

This commit is contained in:
Ptit légume 2026-08-09 01:21:51 +02:00
parent bab2621bff
commit e0caaf39b2
5 changed files with 40 additions and 0 deletions

View file

@ -224,6 +224,21 @@
android:resource="@xml/samsung_appwidget_sub_screen" />
</receiver>
<receiver
android:name=".widget.RandomReceiverFlex4x2"
android:exported="true"
android:label="@string/random_widget_flex_4x2_title">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/random_widget_flex_4x2" />
<meta-data
android:name="com.samsung.android.appwidget.provider"
android:resource="@xml/samsung_appwidget_sub_screen" />
</receiver>
<activity android:name=".widget.configure.RandomConfigure"
android:exported="true"
android:theme="@style/Theme.Material3.DayNight.NoActionBar">

View file

@ -7,3 +7,5 @@ class MemoryReceiverFlex2x2 : MemoryReceiver()
class MemoryReceiverFlex4x2 : MemoryReceiver()
class RandomReceiverFlex2x2 : RandomReceiver()
class RandomReceiverFlex4x2 : RandomReceiver()

View file

@ -6,6 +6,7 @@
<string name="memory_widget_flex_2x2_title">Memories (2x2)</string>
<string name="memory_widget_flex_4x2_title">Memories (4x2)</string>
<string name="random_widget_flex_2x2_title">Random (2x2)</string>
<string name="random_widget_flex_4x2_title">Random (4x2)</string>
<string name="memory_widget_description">See memories from Immich.</string>
<string name="random_widget_description">View a random image from your library or a specific album.</string>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Random widget for the Samsung Flex Window cover screen, full width of its 4x2 grid. -->
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:initialLayout="@layout/glance_default_loading_layout"
android:minWidth="304dp"
android:minHeight="128dp"
android:targetCellWidth="4"
android:targetCellHeight="2"
android:resizeMode="none"
android:widgetCategory="keyguard"
android:updatePeriodMillis="1200000"
android:configure="app.alextran.immich.widget.configure.RandomConfigure"
android:widgetFeatures="reconfigurable|configuration_optional"
app:targetHost="4"
app:widgetSize="16"
tools:targetApi="31"
android:description="@string/random_widget_description"
android:previewImage="@drawable/random_preview"
/>

View file

@ -44,6 +44,7 @@ const List<(String, String)> kWidgetNames = [
('com.immich.widget.memory', 'app.alextran.immich.widget.MemoryReceiverFlex2x2'),
('com.immich.widget.memory', 'app.alextran.immich.widget.MemoryReceiverFlex4x2'),
('com.immich.widget.random', 'app.alextran.immich.widget.RandomReceiverFlex2x2'),
('com.immich.widget.random', 'app.alextran.immich.widget.RandomReceiverFlex4x2'),
];
const int kMinMonthsToEnableScrubberSnap = 12;