diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5083ccb..8d7245b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -16,6 +16,9 @@
android:supportsRtl="true"
android:theme="@style/Theme.NeatCalendar"
tools:targetApi="31">
+
diff --git a/app/src/main/java/com/p_vacho/neat_calendar/activities/EventDetailsActivity.kt b/app/src/main/java/com/p_vacho/neat_calendar/activities/EventDetailsActivity.kt
new file mode 100644
index 0000000..5699e2f
--- /dev/null
+++ b/app/src/main/java/com/p_vacho/neat_calendar/activities/EventDetailsActivity.kt
@@ -0,0 +1,27 @@
+package com.p_vacho.neat_calendar.activities
+
+import android.os.Bundle
+import androidx.activity.enableEdgeToEdge
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.view.ViewCompat
+import androidx.core.view.WindowInsetsCompat
+import com.p_vacho.neat_calendar.R
+import com.p_vacho.neat_calendar.api.models.EventResponse
+
+class EventDetailsActivity : AppCompatActivity() {
+ private lateinit var event: EventResponse
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ enableEdgeToEdge()
+ setContentView(R.layout.activity_event_details)
+ ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
+ val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
+ v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
+ insets
+ }
+
+ @Suppress("DEPRECATION")
+ event = intent.getParcelableExtra("event")!!
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/p_vacho/neat_calendar/activities/NotificationsActivity.kt b/app/src/main/java/com/p_vacho/neat_calendar/activities/NotificationsActivity.kt
index 4af0f35..8bb1c37 100644
--- a/app/src/main/java/com/p_vacho/neat_calendar/activities/NotificationsActivity.kt
+++ b/app/src/main/java/com/p_vacho/neat_calendar/activities/NotificationsActivity.kt
@@ -1,5 +1,6 @@
package com.p_vacho.neat_calendar.activities
+import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.View
@@ -283,12 +284,28 @@ class NotificationsActivity : AppCompatActivity() {
}
}
NotificationAdapter.Action.VIEW_EVENT -> {
- // TODO: Handle viewing the event
+ val invitation = invitations[notification.data]!!
+ val event = events[invitation.event_id]!!
+
+ navigateToEventDetails(event)
+
+ // Also mark the notification as read after the interaction
if (!notification.read) handleNotificationClick(notification, position, false)
}
}
}
+ /**
+ * Navigate to the event details activity, passing it over the event data to show.
+ *
+ * This is used to allow user to preview the event they were invited to.
+ */
+ private fun navigateToEventDetails(event: EventResponse) {
+ val intent = Intent(this, EventDetailsActivity::class.java)
+ intent.putExtra("event", event)
+ startActivity(intent)
+ }
+
/**
* A callback function passed to the Notification Adapter, triggered by clicking on the notification
* itself. This should mark the notification as read.
diff --git a/app/src/main/res/layout/activity_event_details.xml b/app/src/main/res/layout/activity_event_details.xml
new file mode 100644
index 0000000..828f689
--- /dev/null
+++ b/app/src/main/res/layout/activity_event_details.xml
@@ -0,0 +1,10 @@
+
+
+
+
\ No newline at end of file