photos: one file per widget
- Commit
c649198df26fe60e6efb9728e5a866e229dcf46c- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-19 03:44 UTC (17 days ago)
- Parents
4726e73
What: merge PhotoGlanceWidgetReceiver into PhotoGlanceWidget.kt, which declares the PhotoGlanceWidget MaWidget subclass. Same class name, same com.vayunmathur.photos.widget package; the receiver file is deleted. Why: owner mandate that each home-screen widget lives in exactly one file under widget/ declaring its MaWidget subclass, with its receiver in the same file (docs/package-structure.md). No behaviour changes: the manifest receiver entry .widget.PhotoGlanceWidgetReceiver keeps resolving. Verification: ./gradlew :photos:lintDev -- BUILD SUCCESSFUL (lint green). ./gradlew :photos:testDevUnitTest -- 790 tests, 1 failed (GalleryViewModelRealRepoTest peopleProjectionGroupsFacesAndNamesPerson, face-clustering assertion unrelated to the widget merge); that single test passes in isolation on rerun, so it is flaky under the full parallel suite, not a regression from this change.
Diff
photos/src/main/java/com/vayunmathur/photos/widget/PhotoGlanceWidget.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/widget/PhotoGlanceWidget.kt b/photos/src/main/java/com/vayunmathur/photos/widget/PhotoGlanceWidget.ktindex f3fea3acec..d728af4665 100644--- a/photos/src/main/java/com/vayunmathur/photos/widget/PhotoGlanceWidget.kt+++ b/photos/src/main/java/com/vayunmathur/photos/widget/PhotoGlanceWidget.kt@@ -28,6 +28,7 @@ import com.vayunmathur.photos.data.PhotoScanRepository import java.io.IOException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext+import com.vayunmathur.library.widgets.MaWidgetReceiver /** Photo Glance Widget: a ma widget implementation for photo glance widget. */ class PhotoGlanceWidget : MaWidget<List<String>>() {@@ -126,3 +127,10 @@ private fun calculateInSampleSize(options: BitmapFactory.Options, reqWidth: Int, } return inSampleSize }++/** Photo Glance Widget Receiver: a ma widget receiver implementation for photo glance widget receiver. */+class PhotoGlanceWidgetReceiver : MaWidgetReceiver<PhotoGlanceWidget>(+ widgetClass = PhotoGlanceWidget::class,+ receiverClass = PhotoGlanceWidgetReceiver::class,+ widgetFactory = ::PhotoGlanceWidget,+)
photos/src/main/java/com/vayunmathur/photos/widget/PhotoGlanceWidgetReceiver.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/widget/PhotoGlanceWidgetReceiver.kt b/photos/src/main/java/com/vayunmathur/photos/widget/PhotoGlanceWidgetReceiver.ktdeleted file mode 100644index 8991f2c581..0000000000--- a/photos/src/main/java/com/vayunmathur/photos/widget/PhotoGlanceWidgetReceiver.kt+++ /dev/null@@ -1,10 +0,0 @@-package com.vayunmathur.photos.widget--import com.vayunmathur.library.widgets.MaWidgetReceiver--/** Photo Glance Widget Receiver: a ma widget receiver implementation for photo glance widget receiver. */-class PhotoGlanceWidgetReceiver : MaWidgetReceiver<PhotoGlanceWidget>(- widgetClass = PhotoGlanceWidget::class,- receiverClass = PhotoGlanceWidgetReceiver::class,- widgetFactory = ::PhotoGlanceWidget,-)