mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-29 22:11:02 +00:00
feat: banner and cover for airing notifications
This commit is contained in:
@@ -235,6 +235,8 @@ class NotificationActivity : AppCompatActivity() {
|
||||
notificationType = it.type,
|
||||
context = it.title + ": " + it.content,
|
||||
createdAt = (it.time / 1000L).toInt(),
|
||||
image = it.image,
|
||||
banner = it.banner
|
||||
)
|
||||
newNotifications += notification
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ class NotificationItem(
|
||||
return ItemNotificationBinding.bind(view)
|
||||
}
|
||||
|
||||
private fun image(user: Boolean = false, commentNotification: Boolean = false) {
|
||||
private fun image(user: Boolean = false, commentNotification: Boolean = false, newRelease: Boolean = false) {
|
||||
|
||||
val cover = if (user) notification.user?.bannerImage
|
||||
?: notification.user?.avatar?.medium else notification.media?.bannerImage
|
||||
?: notification.media?.coverImage?.large
|
||||
blurImage(binding.notificationBannerImage, cover)
|
||||
blurImage(binding.notificationBannerImage, if (newRelease) notification.banner else cover)
|
||||
|
||||
val defaultHeight = 153.toPx
|
||||
|
||||
@@ -64,7 +64,7 @@ class NotificationItem(
|
||||
binding.notificationCover.visibility = View.VISIBLE
|
||||
binding.notificationCoverUser.visibility = View.VISIBLE
|
||||
binding.notificationCoverUserContainer.visibility = View.GONE
|
||||
binding.notificationCover.loadImage(notification.media?.coverImage?.large)
|
||||
binding.notificationCover.loadImage(if (newRelease) notification.image else notification.media?.coverImage?.large)
|
||||
binding.notificationBannerImage.layoutParams.height = defaultHeight
|
||||
binding.notificationGradiant.layoutParams.height = defaultHeight
|
||||
(binding.notificationTextContainer.layoutParams as ViewGroup.MarginLayoutParams).marginStart =
|
||||
@@ -334,7 +334,7 @@ class NotificationItem(
|
||||
}
|
||||
|
||||
NotificationType.SUBSCRIPTION -> {
|
||||
image(user = true, commentNotification = true)
|
||||
image(newRelease = true)
|
||||
binding.notificationCoverUser.setOnClickListener {
|
||||
clickCallback(
|
||||
notification.mediaId ?: 0, null, NotificationClickType.MEDIA
|
||||
|
||||
Reference in New Issue
Block a user