diff options
Diffstat (limited to 'android')
| -rw-r--r-- | android/app/src/main/java/org/terst/doot/widget/ui/DootWidget.kt | 60 |
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 + ) + } } } |
