feat(notifications): Add view button
This commit is contained in:
parent
dbbbfee769
commit
4ca096df1c
|
@ -72,6 +72,9 @@ class NotificationsActivity : AppCompatActivity() {
|
|||
NotificationAdapter.Action.DECLINE -> {
|
||||
//TODO("Handle decline action")
|
||||
}
|
||||
NotificationAdapter.Action.VIEW_EVENT -> {
|
||||
//TODO("Handle viewing the event")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue