Skip to content

Feature/reader full post refresh featured image#4652

Merged
khaykov merged 4 commits intofeature/reader-full-post-refresh-masterfrom
feature/reader-full-post-refresh-featured-image
Oct 19, 2016
Merged

Feature/reader full post refresh featured image#4652
khaykov merged 4 commits intofeature/reader-full-post-refresh-masterfrom
feature/reader-full-post-refresh-featured-image

Conversation

@nbradbury
Copy link
Copy Markdown
Contributor

Fixes #4640 - in #4626 we redesigned how related posts appear in the reader detail, but featured images on those related posts were stretched rather than cropped. This PR corrects that problem.

Before & after pics below:
before-and-after

@khaykov khaykov self-assigned this Oct 19, 2016
Copy link
Copy Markdown
Contributor

@khaykov khaykov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Just have one suggestion about coping.

* crops the passed bitmap to fit the passed width/height - bitmap will be resized if
* necessary to ensure it fills the desired size before cropping
*/
private static Bitmap cropBitmap(Bitmap bitmap, int newWidth, int newHeight) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a ThumbnailUtils helper in Android, that's supposed to handle cropping in situations like this, so maybe we could replace call to this method with ThumbnailUtils.extractThumbnail(bitmap, mCropWidth, mCropHeight); ?

They produce really similar results:
crop_comp

@nbradbury
Copy link
Copy Markdown
Contributor Author

There is a ThumbnailUtils helper in Android, that's supposed to handle cropping in situations like this

I had completely forgotten about ThumbnailUtills - thanks for the reminder! I made this change in 89bdf94.

Copy link
Copy Markdown
Contributor

@khaykov khaykov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! :shipit:

@khaykov khaykov merged commit 2de8946 into feature/reader-full-post-refresh-master Oct 19, 2016
@khaykov khaykov deleted the feature/reader-full-post-refresh-featured-image branch October 19, 2016 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants