Closed Bug 885821 Opened 11 years ago Closed 11 years ago

Top Bookmarks thumbnails should use a centerCrop scaling

Categories

(Firefox for Android Graveyard :: Theme and Visual Design, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 26

People

(Reporter: sriram, Assigned: sriram)

References

Details

Attachments

(1 file, 1 obsolete file)

The top bookmarks (added by bug 882365) should use a centerCrop scaling if there's a bitmap and a center scaling if we are showing an icon.
Blocks: 882365
Attached patch Patch (obsolete) — Splinter Review
This adds the CENTER scaleType while setting a favicon/"add bookmark" icon.

I somehow don't like this approach. To me, it's upto the BookmarkThumbnailView to decide on what scaling it should use. If it's going to show a dominant color background, it knows that the content doesn't fill its entire size, and hence use a CENTER scale. If not, it would be using the default CENTER_CROP style. My patch 3 in Bug 882365 uses this approach.
Attachment #766011 - Flags: review?(wjohnston)
Regarding using ThumbnailView as a parent class for BookmarkThumbnailView:

It's just extra work!
The ThumbnailHelper's width is set based on the width of BookmarkThumbnailView. The ThumbnailHelper's height and the height of this BookmarkThumbnailView are the same. This means that there isn't any need for complex matrix calculations done by ThumbnailView. The default ImageView takes care of scaling when set to centerCrop for this view.

In case of tabs tray, the thumbnail's width and height needn't be of same size as these thumbnails and ThumbnailHelper's. Hence there is a need to scale it and use a ThumbnailView. I am not doing extra work for this view unless there is a valid need for it.

Anyways, the above patch needs to be there immaterial of whether the parent of BookmarkThumbnailView or not.

Note: ThumbnailView doesn't care about scaling type while using a matrix. This will cause problems with favicons and other icons. That should be fixed before it is ever made a parent of BookmarkThumbnailView.
(In reply to Sriram Ramasubramanian [:sriram] from comment #2)
> In case of tabs tray, the thumbnail's width and height needn't be of same
> size as these thumbnails and ThumbnailHelper's. Hence there is a need to
> scale it and use a ThumbnailView. I am not doing extra work for this view
> unless there is a valid need for it.

I'd argue that 1.) This work is already being done (badly) by Android:
http://androidxref.com/2.2.3/xref/frameworks/base/core/java/android/widget/ImageView.java#774

We're just doing it correctly.

2.) It protects future devs from having to deal with these issues. For instace, you have one here that will show up on upgrade where the saved thumbnail aspect ratio != your new thumbnails aspect ratio. But even if it didn't, I'd still push to use our correct code here so that they were more resilient to future changes, strange device sizes where maybe we can't get thumbnails at the aspect ratio you want, or general other bugs.
Attached patch PatchSplinter Review
Had wrongly set CENTER to thumbnails while moving code from setBackgroundColor() in previous patch. Corrected it in this.
Attachment #766011 - Attachment is obsolete: true
Attachment #766011 - Flags: review?(wjohnston)
Attachment #766162 - Flags: review?(wjohnston)
Comment on attachment 766162 [details] [diff] [review]
Patch

Review of attachment 766162 [details] [diff] [review]:
-----------------------------------------------------------------

I'm filing a new bug about thumbnails being busted on upgrade.
Attachment #766162 - Flags: review?(wjohnston) → review+
https://hg.mozilla.org/mozilla-central/rev/ff8eb6acf9e5
Assignee: nobody → sriram
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 26
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: