Add comment notification type

This commit is contained in:
Matthieu 2021-08-19 14:36:39 +02:00
parent ebec547dd0
commit 649535f8fd
3 changed files with 20 additions and 14 deletions

View File

@ -87,7 +87,8 @@ class NotificationsFragment : CachedFeedFragment<Notification>() {
val intent: Intent =
when (type) {
Notification.NotificationType.mention, Notification.NotificationType.favourite,
Notification.NotificationType.poll, Notification.NotificationType.reblog -> {
Notification.NotificationType.poll, Notification.NotificationType.reblog,
Notification.NotificationType.comment -> {
openPostFromNotification()
}
Notification.NotificationType.follow -> {
@ -113,40 +114,39 @@ class NotificationsFragment : CachedFeedFragment<Notification>() {
) {
val context = textView.context
val (format: String, drawable: Drawable?) = when (type) {
Notification.NotificationType.follow -> {
Notification.NotificationType.follow ->
getStringAndDrawable(
context,
R.string.followed_notification,
R.drawable.ic_follow
)
}
Notification.NotificationType.mention -> {
Notification.NotificationType.mention ->
getStringAndDrawable(
context,
R.string.mention_notification,
R.drawable.mention_at_24dp
)
}
Notification.NotificationType.reblog -> {
Notification.NotificationType.comment ->
getStringAndDrawable(
context,
R.string.comment_notification,
R.drawable.ic_comment_empty
)
Notification.NotificationType.reblog ->
getStringAndDrawable(
context,
R.string.shared_notification,
R.drawable.ic_reblog_blue
)
}
Notification.NotificationType.favourite -> {
Notification.NotificationType.favourite ->
getStringAndDrawable(
context,
R.string.liked_notification,
R.drawable.ic_like_full
)
}
Notification.NotificationType.poll -> {
Notification.NotificationType.poll ->
getStringAndDrawable(context, R.string.poll_notification, R.drawable.poll)
}
}
textView.text = format.format(username)
textView.setCompoundDrawablesWithIntrinsicBounds(
drawable, null, null, null

View File

@ -38,6 +38,6 @@ data class Notification(
override var instance_uri: String,
): FeedContent, FeedContentDatabase {
enum class NotificationType: Serializable {
follow, mention, reblog, favourite, poll
follow, mention, reblog, favourite, poll, comment
}
}

View File

@ -50,6 +50,12 @@
<!-- Notifications: end of poll notification -->
<string name="poll_notification">"%1$s's poll has ended"</string>
<!-- Notifications: comment notification -->
<string name="comment_notification">%1$s commented on your post</string>
<!-- Notifications: other notification -->
<string name="other_notification">"Notification from %1$s"</string>
<!-- Login page -->
<string name="whats_an_instance">"What's an instance?"</string>
<string name="whats_an_instance_explanation">"You might be confused by the text field asking for the domain of your 'instance'.