summaryrefslogtreecommitdiff
path: root/android/app/src/main/java/org/terst/doot/widget/ui/DootWidget.kt
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-12 11:18:37 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-12 11:18:37 +0000
commit4126fe4f56a6eb9703a084d4793a597f37bf2867 (patch)
treeb2b7c07ed7376a5c31495d37bd35dfece3e2643c /android/app/src/main/java/org/terst/doot/widget/ui/DootWidget.kt
parent6fdd09bfe030ce91ee188f18c198fd6a57c7b42f (diff)
feat(widget): add event detail popup showing recurrence scheduleHEADmaster
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VTUSAEKfsPc6WGDq45yPHD
Diffstat (limited to 'android/app/src/main/java/org/terst/doot/widget/ui/DootWidget.kt')
-rw-r--r--android/app/src/main/java/org/terst/doot/widget/ui/DootWidget.kt31
1 files changed, 27 insertions, 4 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 e326537..2dbc96b 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
@@ -2,7 +2,6 @@ package org.terst.doot.widget.ui
import android.content.Context
import android.content.Intent
-import android.net.Uri
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
@@ -140,12 +139,20 @@ fun WidgetRoot(items: List<WidgetItem>, now: Instant, isRefreshing: Boolean) {
@Composable
fun AllDayRow(event: WidgetItem) {
+ val context = LocalContext.current
+ val detailIntent = Intent(context, EventDetailActivity::class.java).apply {
+ putExtra(EventDetailActivity.EXTRA_TITLE, event.title)
+ putExtra(EventDetailActivity.EXTRA_SOURCE, event.source)
+ putExtra(EventDetailActivity.EXTRA_URL, event.url)
+ putExtra(EventDetailActivity.EXTRA_RECURRING_EVENT_ID, event.recurringEventId)
+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ }
val color = sourceColor(event.source)
Row(
modifier = GlanceModifier
.fillMaxWidth()
.padding(vertical = 3.dp)
- .clickable(actionStartActivity(Intent(Intent.ACTION_VIEW, Uri.parse(event.url.ifEmpty { "https://calendar.google.com" })))),
+ .clickable(actionStartActivity(detailIntent)),
verticalAlignment = Alignment.CenterVertically
) {
Box(modifier = GlanceModifier.width(3.dp).height(16.dp).background(color)) {}
@@ -260,13 +267,21 @@ fun HourRow(
@Composable
fun EventBlock(event: WidgetItem, isPast: Boolean) {
+ val context = LocalContext.current
+ val detailIntent = Intent(context, EventDetailActivity::class.java).apply {
+ putExtra(EventDetailActivity.EXTRA_TITLE, event.title)
+ putExtra(EventDetailActivity.EXTRA_SOURCE, event.source)
+ putExtra(EventDetailActivity.EXTRA_URL, event.url)
+ putExtra(EventDetailActivity.EXTRA_RECURRING_EVENT_ID, event.recurringEventId)
+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ }
val color = sourceColor(event.source)
val alpha = if (isPast) 0.5f else 1f
Row(
modifier = GlanceModifier
.fillMaxWidth()
.padding(vertical = 4.dp)
- .clickable(actionStartActivity(Intent(Intent.ACTION_VIEW, Uri.parse(event.url.ifEmpty { "https://calendar.google.com" })))),
+ .clickable(actionStartActivity(detailIntent)),
verticalAlignment = Alignment.CenterVertically
) {
Box(
@@ -412,6 +427,14 @@ fun TomorrowSection(items: List<WidgetItem>, fragments: List<TaskFragment>, allD
@Composable
fun TomorrowEventRow(event: WidgetItem, zone: ZoneId) {
+ val context = LocalContext.current
+ val detailIntent = Intent(context, EventDetailActivity::class.java).apply {
+ putExtra(EventDetailActivity.EXTRA_TITLE, event.title)
+ putExtra(EventDetailActivity.EXTRA_SOURCE, event.source)
+ putExtra(EventDetailActivity.EXTRA_URL, event.url)
+ putExtra(EventDetailActivity.EXTRA_RECURRING_EVENT_ID, event.recurringEventId)
+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ }
val color = sourceColor(event.source)
val timeLabel = event.start?.let {
val t = Instant.parse(it).atZone(zone)
@@ -421,7 +444,7 @@ fun TomorrowEventRow(event: WidgetItem, zone: ZoneId) {
modifier = GlanceModifier
.fillMaxWidth()
.padding(vertical = 3.dp)
- .clickable(actionStartActivity(Intent(Intent.ACTION_VIEW, android.net.Uri.parse(event.url.ifEmpty { "https://calendar.google.com" })))),
+ .clickable(actionStartActivity(detailIntent)),
verticalAlignment = Alignment.CenterVertically
) {
Text(