Add support for mystery items notifications

This commit is contained in:
Carl Vuorinen 2019-04-14 21:16:14 +03:00
parent 2cf3e29f4d
commit 81516734f5
8 changed files with 12 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -867,6 +867,7 @@
<string name="new_msg_guild"><![CDATA[<b>%1$s</b> has new posts]]></string>
<string name="new_msg_party"><![CDATA[Your Party, <b>%1$s</b>, has new posts]]></string>
<string name="unallocated_stats_points"><![CDATA[You have <b>%1$s unallocated Stat Points</b>]]></string>
<string name="new_subscriber_item"><![CDATA[You have new <b>Mystery Items</b>]]></string>
<string name="create">Create</string>
<string name="only_leader_create_challenge">Only leader can create Challenges</string>
<string name="create_party">Create Party</string>

View file

@ -7,6 +7,7 @@ import java.lang.reflect.Type
enum class NotificationType(val type: String) {
NEW_STUFF("NEW_STUFF"),
NEW_CHAT_MESSAGE("NEW_CHAT_MESSAGE"),
NEW_MYSTERY_ITEMS("NEW_MYSTERY_ITEMS"),
UNALLOCATED_STATS_POINTS("UNALLOCATED_STATS_POINTS");
companion object {

View file

@ -92,6 +92,7 @@ class NotificationsActivity : BaseActivity(), androidx.swiperefreshlayout.widget
NotificationType.NEW_CHAT_MESSAGE.type -> createNewChatMessageNotification(it)
NotificationType.NEW_STUFF.type -> createNewStuffNotification(it)
NotificationType.UNALLOCATED_STATS_POINTS.type -> createUnallocatedStatsNotification(it)
NotificationType.NEW_MYSTERY_ITEMS.type -> createMysteryItemsNotification(it)
//TODO rest of the notification types
else -> null
}
@ -143,6 +144,14 @@ class NotificationsActivity : BaseActivity(), androidx.swiperefreshlayout.widget
)
}
private fun createMysteryItemsNotification(notification: GlobalNotification): View? {
return createNotificationItem(
notification,
fromHtml(getString(R.string.new_subscriber_item)),
R.drawable.notification_mystery_item
)
}
private fun createNotificationItem(notification: GlobalNotification, messageText: CharSequence, imageResourceId: Int? = null): View? {
val item = inflater.inflate(R.layout.notification_item, notification_items, false)

View file

@ -61,4 +61,4 @@ open class NotificationsViewModel : BaseViewModel() {
//TODO("not implemented")
}
}
}