Fix #300 in manner suggested by dansup
"you should be using url if preview_url returns public/no-preview.png or stick with url. The issue is a race condition and caching"
This commit is contained in:
parent
6e7b1a63d7
commit
2e3d912cdc
@ -172,7 +172,7 @@ class NotificationsFragment : CachedFeedFragment<Notification>() {
|
||||
Glide.with(itemView).load(notification?.account?.anyAvatar()).circleCrop()
|
||||
.into(avatar)
|
||||
|
||||
val previewUrl = notification?.status?.media_attachments?.getOrNull(0)?.preview_url
|
||||
val previewUrl = notification?.status?.getPostPreviewURL()
|
||||
if (!previewUrl.isNullOrBlank()) {
|
||||
Glide.with(itemView).load(previewUrl)
|
||||
.placeholder(R.drawable.ic_picture_fallback).into(photoThumbnail)
|
||||
|
@ -121,7 +121,7 @@ class SearchDiscoverFragment : BaseFragment() {
|
||||
} else {
|
||||
holder.albumIcon.visibility = View.GONE
|
||||
}
|
||||
ImageConverter.setSquareImageFromURL(holder.postView, post?.media_attachments?.firstOrNull()?.preview_url, holder.postPreview, post?.media_attachments?.firstOrNull()?.blurhash)
|
||||
ImageConverter.setSquareImageFromURL(holder.postView, post?.getPostPreviewURL(), holder.postPreview, post?.media_attachments?.firstOrNull()?.blurhash)
|
||||
holder.postPreview.setOnClickListener {
|
||||
val intent = Intent(holder.postView.context, PostActivity::class.java)
|
||||
intent.putExtra(Status.POST_TAG, post)
|
||||
|
@ -38,4 +38,8 @@ data class Attachment(
|
||||
val aspect: Double?
|
||||
) : Serializable
|
||||
}
|
||||
|
||||
val previewNoPlaceholder: String?
|
||||
get() = if (preview_url?.contains(Regex("public/no-preview\\.(png|jpg|webp)")) == true) url else preview_url
|
||||
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ open class Status(
|
||||
|
||||
fun getPostUrl() : String? = media_attachments?.firstOrNull()?.url
|
||||
fun getProfilePicUrl() : String? = account?.anyAvatar()
|
||||
fun getPostPreviewURL() : String? = media_attachments?.firstOrNull()?.preview_url
|
||||
fun getPostPreviewURL() : String? = media_attachments?.firstOrNull()?.previewNoPlaceholder
|
||||
|
||||
|
||||
fun getNLikes(context: Context) : CharSequence {
|
||||
|
Loading…
x
Reference in New Issue
Block a user