summaryrefslogtreecommitdiff
path: root/android/app/src/main/java/org/terst/doot/widget
diff options
context:
space:
mode:
authorClaudomator Agent <agent@claudomator.local>2026-07-06 00:03:07 +0000
committerClaudomator Agent <agent@claudomator.local>2026-07-06 00:03:07 +0000
commit73fbd05a1230552bcef9834d3ee999ef19957693 (patch)
tree50f6980cb31568ed41519e36e3de75442a194d2f /android/app/src/main/java/org/terst/doot/widget
parent945c34590677e161a711ccaff0e1077197b1b178 (diff)
fix(widget): separate checkbox and row clickables to fix completeTask tap
In Glance 1.1.0 (RemoteViews), a parent Row with .clickable() silently overrides any nested child .clickable() — tapping the checkbox fired the detail-open action instead of CompleteTaskAction, producing no visible effect. Fix by splitting TaskRow into two sibling Boxes: a 24dp tap target wrapping the checkbox icon (routes to CompleteTaskAction) and a defaultWeight Box for the title (routes to actionStartActivity). No nesting, so both actions are independently reachable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'android/app/src/main/java/org/terst/doot/widget')
-rw-r--r--android/app/src/main/java/org/terst/doot/widget/ui/DootWidget.kt60
1 files changed, 38 insertions, 22 deletions
diff --git a/android/app/src/main/java/org/terst/doot/widget/ui/DootWidget.kt b/android/app/src/main/java/org/terst/doot/widget/ui/DootWidget.kt
index 0331928..d8f1140 100644
--- a/android/app/src/main/java/org/terst/doot/widget/ui/DootWidget.kt
+++ b/android/app/src/main/java/org/terst/doot/widget/ui/DootWidget.kt
@@ -226,27 +226,36 @@ fun TaskRow(task: WidgetItem) {
putExtra(TaskDetailActivity.EXTRA_COMPLETABLE, task.completable)
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
+ // Split into two sibling clickable regions to avoid the Glance/RemoteViews limitation
+ // where a parent clickable silently overrides a nested child clickable. The checkbox
+ // gets its own non-overlapping Box; the title region handles the detail-open action.
Row(
modifier = GlanceModifier
.fillMaxWidth()
- .padding(horizontal = 8.dp, vertical = 5.dp)
- .clickable(actionStartActivity(detailIntent)),
+ .padding(horizontal = 8.dp, vertical = 5.dp),
verticalAlignment = Alignment.CenterVertically
) {
if (task.completable) {
- Image(
- provider = ImageProvider(org.terst.doot.widget.R.drawable.ic_checkbox_empty),
- contentDescription = "Complete ${task.title}",
- colorFilter = ColorFilter.tint(ColorProvider(sourceColor(task.source))),
- modifier = GlanceModifier.size(14.dp).clickable(
- actionRunCallback<CompleteTaskAction>(
- actionParametersOf(
- CompleteTaskAction.idKey to task.id,
- CompleteTaskAction.sourceKey to task.source
+ Box(
+ modifier = GlanceModifier
+ .size(24.dp)
+ .clickable(
+ actionRunCallback<CompleteTaskAction>(
+ actionParametersOf(
+ CompleteTaskAction.idKey to task.id,
+ CompleteTaskAction.sourceKey to task.source
+ )
)
- )
+ ),
+ contentAlignment = Alignment.Center
+ ) {
+ Image(
+ provider = ImageProvider(org.terst.doot.widget.R.drawable.ic_checkbox_empty),
+ contentDescription = "Complete ${task.title}",
+ colorFilter = ColorFilter.tint(ColorProvider(sourceColor(task.source))),
+ modifier = GlanceModifier.size(14.dp)
)
- )
+ }
} else {
Box(
modifier = GlanceModifier
@@ -255,15 +264,22 @@ fun TaskRow(task: WidgetItem) {
) {}
}
- Text(
- text = task.title,
- style = TextStyle(
- color = ColorProvider(Color(0xFFDDDDDD.toInt())),
- fontSize = 14.sp
- ),
- modifier = GlanceModifier.padding(start = 8.dp),
- maxLines = 1
- )
+ Box(
+ modifier = GlanceModifier
+ .defaultWeight()
+ .clickable(actionStartActivity(detailIntent))
+ .padding(start = 8.dp),
+ contentAlignment = Alignment.CenterStart
+ ) {
+ Text(
+ text = task.title,
+ style = TextStyle(
+ color = ColorProvider(Color(0xFFDDDDDD.toInt())),
+ fontSize = 14.sp
+ ),
+ maxLines = 1
+ )
+ }
}
}