feat: Add category details activity
This commit is contained in:
parent
15576b6c39
commit
e5ae396476
|
@ -16,6 +16,9 @@
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.NeatCalendar"
|
android:theme="@style/Theme.NeatCalendar"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
|
<activity
|
||||||
|
android:name=".activities.EventDetailsActivity"
|
||||||
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.CreateCategoryActivity"
|
android:name=".activities.CreateCategoryActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
|
@ -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<EventResponse>("event")!!
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package com.p_vacho.neat_calendar.activities
|
package com.p_vacho.neat_calendar.activities
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -283,12 +284,28 @@ class NotificationsActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NotificationAdapter.Action.VIEW_EVENT -> {
|
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)
|
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
|
* A callback function passed to the Notification Adapter, triggered by clicking on the notification
|
||||||
* itself. This should mark the notification as read.
|
* itself. This should mark the notification as read.
|
||||||
|
|
10
app/src/main/res/layout/activity_event_details.xml
Normal file
10
app/src/main/res/layout/activity_event_details.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activities.EventDetailsActivity">
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in a new issue