1
0
mirror of https://gitlab.shinice.net/pixeldroid/PixelDroid synced 2024-12-25 06:23:58 +01:00

add poll to prevent crashes with mastodon

This commit is contained in:
Matthieu 2020-11-01 19:57:56 +01:00
parent 2c1fef2a0a
commit 22b03fca54
5 changed files with 28 additions and 7 deletions

View File

@ -156,7 +156,7 @@ class NotificationsFragment : FeedFragment() {
}
}
private fun openPostFromNotifcation(notification: Notification) : Intent {
private fun openPostFromNotification(notification: Notification) : Intent {
val intent = Intent(context, PostActivity::class.java)
intent.putExtra(Status.POST_TAG, notification.status)
return intent
@ -165,11 +165,9 @@ class NotificationsFragment : FeedFragment() {
private fun openActivity(notification: Notification){
val intent: Intent
when (notification.type){
Notification.NotificationType.mention, Notification.NotificationType.favourite-> {
intent = openPostFromNotifcation(notification)
}
Notification.NotificationType.reblog-> {
intent = openPostFromNotifcation(notification)
Notification.NotificationType.mention, Notification.NotificationType.favourite,
Notification.NotificationType.poll, Notification.NotificationType.reblog -> {
intent = openPostFromNotification(notification)
}
Notification.NotificationType.follow -> {
intent = Intent(context, ProfileActivity::class.java)
@ -237,6 +235,9 @@ class NotificationsFragment : FeedFragment() {
Notification.NotificationType.favourite -> {
setNotificationTypeTextView(context, R.string.liked_notification, R.drawable.ic_like_full)
}
Notification.NotificationType.poll -> {
setNotificationTypeTextView(context, R.string.poll_notification, R.drawable.poll)
}
}
textView.text = format.format(username)
textView.setCompoundDrawablesWithIntrinsicBounds(

View File

@ -16,6 +16,6 @@ data class Notification(
val status: Status? = null
): FeedContent() {
enum class NotificationType {
follow, mention, reblog, favourite
follow, mention, reblog, favourite, poll
}
}

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM9,17L7,17v-7h2v7zM13,17h-2L11,7h2v10zM17,17h-2v-4h2v4z"
android:fillColor="#FFFFFF"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM9,17L7,17v-7h2v7zM13,17h-2L11,7h2v10zM17,17h-2v-4h2v4z"
android:fillColor="#000000"/>
</vector>

View File

@ -23,6 +23,8 @@
<string name="mention_notification">%1$s mentioned you</string>
<string name="shared_notification">%1$s shared your post</string>
<string name="liked_notification">%1$s liked your post</string>
<string name="poll_notification">"%1$s's poll has ended"</string>
<!-- Login page -->
<string name="whats_an_instance">"What's an instance?"</string>
<string name="domain_of_your_instance">Domain of your instance</string>