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

View File

@ -38,6 +38,6 @@ data class Notification(
override var instance_uri: String, override var instance_uri: String,
): FeedContent, FeedContentDatabase { ): FeedContent, FeedContentDatabase {
enum class NotificationType: Serializable { 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 --> <!-- Notifications: end of poll notification -->
<string name="poll_notification">"%1$s's poll has ended"</string> <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 --> <!-- Login page -->
<string name="whats_an_instance">"What's an instance?"</string> <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'. <string name="whats_an_instance_explanation">"You might be confused by the text field asking for the domain of your 'instance'.