feat(notifications): Add view button

This commit is contained in:
Peter Vacho 2025-01-04 12:44:03 +01:00
parent dbbbfee769
commit 4ca096df1c
Signed by: school
GPG key ID: 8CFC3837052871B4
3 changed files with 19 additions and 1 deletions

View file

@ -72,6 +72,9 @@ class NotificationsActivity : AppCompatActivity() {
NotificationAdapter.Action.DECLINE -> {
//TODO("Handle decline action")
}
NotificationAdapter.Action.VIEW_EVENT -> {
//TODO("Handle viewing the event")
}
}
}

View file

@ -3,6 +3,7 @@ package com.p_vacho.neat_calendar.adapters
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.ImageButton
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
@ -16,13 +17,14 @@ class NotificationAdapter(
) : RecyclerView.Adapter<NotificationAdapter.NotificationViewHolder>() {
enum class Action {
ACCEPT, DECLINE
ACCEPT, DECLINE, VIEW_EVENT
}
inner class NotificationViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val message: TextView = view.findViewById(R.id.notificationMessage)
val acceptButton: ImageButton = view.findViewById(R.id.acceptButton)
val declineButton: ImageButton = view.findViewById(R.id.declineButton)
val viewEventButton: ImageButton = view.findViewById(R.id.viewEventButton)
val invitationActions: View = view.findViewById(R.id.invitationActions)
val unreadIndicator: View = view.findViewById(R.id.notificationIndicator)
}
@ -50,6 +52,9 @@ class NotificationAdapter(
holder.declineButton.setOnClickListener {
onActionClick(notification, Action.DECLINE, position)
}
holder.viewEventButton.setOnClickListener {
onActionClick(notification, Action.VIEW_EVENT, position)
}
} else {
holder.invitationActions.visibility = View.GONE
}

View file

@ -66,5 +66,15 @@
android:src="@drawable/ic_close"
android:contentDescription="@string/decline"
app:tint="@android:color/holo_red_dark" />
<ImageButton
android:id="@+id/viewEventButton"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="8dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_visibility"
android:contentDescription="@string/view_event"
app:tint="@android:color/holo_blue_dark" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>