-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Issue/6279 post list missing featured image #6369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue/6279 post list missing featured image #6369
Conversation
…ss-Android into issue/6279-post-list-missing-featured-image
imgFeatured.setVisibility(View.VISIBLE); | ||
imgFeatured.setImageUrl(photonUrl, WPNetworkImageView.ImageType.PHOTO); | ||
} else { | ||
Bitmap bmp = fastResizeBitmap(imageUrl, mPhotonWidth); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to not use Bitmap bmp = ImageUtils.getWPImageSpanThumbnailFromFilePath(context, imageUrl, mPhotonWidth);
that is well tested and used in the app?
The actual implementation doesn't take in consideration orientation of the pictures, resulting in pictures turned 90° on some devices, and doesn't show the "poster" picture for videos.
if (imageUrl == null) { | ||
imgFeatured.setVisibility(View.GONE); | ||
} else if (imageUrl.startsWith("http")) { | ||
String photonUrl = ReaderUtils.getResizedImageUrl(imageUrl, mPhotonWidth, mPhotonHeight, mSite.isPrivate()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of mSite.isPrivate()
should we use SiteUtils.isPhotonCapable(mSite)
?
Otherwise self hosted sites can get redirected to Photon.
@daniloercoli You're right, I should've stuck with the existing image resize. My concern was that since the resizing occurs on the main thread I wanted it to be as fast as possible, and our existing code could be faster. But that's something we should address separately rather than in this PR. I've updated this PR in 6541dd6 to use the existing method and also switched to using |
imageUrl = scanner.getLargestImage(); | ||
} else { | ||
imageUrl = null; | ||
imageUrl = new ReaderImageScanner(post.getContent(), mSite.isPrivate()).getLargestImage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed this in the first pass. Should we use SiteUtils.isPhotonCapable(mSite)
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 50f8a8c
|
Fixes #6279 - the problem was due to choosing a featured image from the post content when the image is still uploading. This resulted in choosing a local file (ex:
/storage/emulated/0/Download/IMG_q5m29m.jpg
) as a featured image, and the post adapter didn't support displaying device images.This PR corrects this by supporting device images, and also fixes a few problems in the existing featured image code.
Note: As part of this PR, I added this routine to load resized bitmaps more efficiently than similar routines in ImageUtils. At some point we'll want to move that routine to
ImageUtils
, but for now I'd like to keep it insidePostListAdapter
.