Closed Bug 1400072 Opened 7 years ago Closed 7 years ago

Starting Fennec in landscape and rotating to portrait causes top site overlap

Categories

(Firefox for Android Graveyard :: Awesomescreen, defect, P1)

All
Android
defect

Tracking

(firefox57 verified)

VERIFIED FIXED
Firefox 57
Tracking Status
firefox57 --- verified

People

(Reporter: mcomella, Assigned: mcomella)

References

Details

(Whiteboard: [mobileAS])

Attachments

(7 files)

Attached image Screenshot
I'm guessing we're not updating our margin, or desired tile size values in our calculations. Or perhaps we are, but we never actually refresh the tile sizes (because it's set once in onCreateViewHolder? [1]).

(Note: my screenshot has a patch applied that changes the margin calculations but I can reproduce on my Nightly build)

[1]: http://searchfox.org/mozilla-central/rev/2c9a5993ac40ec1db8450e3e0a85702fa291b9e2/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/topsites/TopSitesPageAdapter.java#96
Here's a crappy WIP patch that solves the problem but needs to be cleaned up. My high level concern is that I find the ownership of measurements to be wacky and unclear, e.g. the ActivityStreamPanel makes the measurements for the top sites items so we can calculate it once and pass it to all the pages. However, each view in the way caches it's own copy of these measurements (which is why this bug exists – one of these did not get updated) and has it's own way of being set and passing it to the child views/adapters/whatever. It'd be great if we could pass this in just in time for the methods that actually need it, e.g. bind & swapCursors, rather than caching it long term.

It really doesn't help that this code is poorly named (TopSitesPageAdapter & TopSitesPagerAdapter) and heavily nested in unexpected ways (RecyclerView contains a ViewPager contains RecyclerViews for each page?).
Working on this now because it simplifies bug 1400014.
Assignee: nobody → michael.l.comella
Blocks: 1400014
tracking-fennec: ? → ---
Iteration: --- → 1.30
Priority: -- → P1
Comment on attachment 8908422 [details]
Bug 1400072: Move TOP_SITE_COLUMNS/ROWS -> TopSitesPage.

https://reviewboard.mozilla.org/r/180056/#review185644

Glad you split out this change from everything else.
Attachment #8908422 - Flags: review?(liuche) → review+
Comment on attachment 8908806 [details]
Bug 1400072: Make num tiles a constant.

https://reviewboard.mozilla.org/r/180422/#review185646

Seems reasonable, changing a constant value to explicitly be a constant.
Attachment #8908806 - Flags: review?(liuche) → review+
Comment on attachment 8908807 [details]
Bug 1400072: Pass in tilesSize when needed, rather than caching.

https://reviewboard.mozilla.org/r/180424/#review185648
Attachment #8908807 - Flags: review?(liuche) → review+
Comment on attachment 8908808 [details]
Bug 1400072: Cache tilesSize in swapCursor.

https://reviewboard.mozilla.org/r/180426/#review185652
Attachment #8908808 - Flags: review?(liuche) → review+
Comment on attachment 8908809 [details]
Bug 1400072: Rm unused variable tilesMargin.

https://reviewboard.mozilla.org/r/180428/#review185654

Not the last reference to this value so won't cause any lint errors, r+.
Attachment #8908809 - Flags: review?(liuche) → review+
Comment on attachment 8908810 [details]
Bug 1400072: Specify card size in onBind instead of onCreate.

https://reviewboard.mozilla.org/r/180430/#review185656

I assume that this was put in onCreate as an optimization so it only had to be called once instead of every time the view was bound, but this is fine to move because it seems like the assumption that it would only need to be bound on creation is incorrect.
Attachment #8908810 - Flags: review?(liuche) → review+
Pushed by michael.l.comella@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/c710d47517a2
Move TOP_SITE_COLUMNS/ROWS -> TopSitesPage. r=liuche
https://hg.mozilla.org/integration/autoland/rev/fea444196dee
Make num tiles a constant. r=liuche
https://hg.mozilla.org/integration/autoland/rev/ec4dcc7799ad
Pass in tilesSize when needed, rather than caching. r=liuche
https://hg.mozilla.org/integration/autoland/rev/45f33d2b5722
Cache tilesSize in swapCursor. r=liuche
https://hg.mozilla.org/integration/autoland/rev/cd4c24e98e04
Rm unused variable tilesMargin. r=liuche
https://hg.mozilla.org/integration/autoland/rev/62f03c05db78
Specify card size in onBind instead of onCreate. r=liuche
Devices:
 - Asus ZenPad 8.0 Z380KL (Android 6.0.1);
 - Nexus 5 (Android 6.0.1);
 - HTC 10 (Android 7.0);
 - Note 4 (Android 5.0.1).

This issue was not reproducible on any of the devices I've tested on. Marking as verified.
Status: RESOLVED → VERIFIED
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: