This code was being mistakenly activated when getting top sites for Activity
Stream.
This is the first removal of old top sites code and will mean we can't go back
to old top sites by flipping the `ActivityStream.isEnabled` flag. Since we're
planning to ship AS, this shouldn't matter.
MozReview-Commit-ID: 9VB0RqNHmE0
After speaking with liuche, we decided it'd be better to add a bit to determine
this rather than combining it with the isPocketEnabled field (which would be
loss of data) or cross-referencing the locale of the submitted event when
checking the Pocket value during telemetry analysis (which is hard to get right
and likely to get out of date).
MozReview-Commit-ID: JKFrdEsEbyp
Ideally, we'd centralize all queries as to which options are user specified.
However, I wanted to do the smallest change so we can uplift so I filed
bug 1405161 for this centralization.
I opted not to include the "de" locale that is included on desktop because it
does not appear we ever get the "de" locale on Firefox for Android [1].
I tested this patch by changing the system locale between locales with Pocket
on my device (en-US, en-GB, de-DE) and locales without Pocket (ko-KR). The
locale switching system makes this refresh automatically without extra code.
I also intend to test via the in-app locale switcher but that will take time
because I can't do artifact builds with multi-locale so I'm pushing this for
review before I'm finished.
Follow-up changes:
- Add to telemetry
- Hiding the preference in the undesired locales.
- A test for isPocketEnabledByLocaleInner (useful to document how this is
intended to work for locales with variants, different scripts, etc.)
[1]: https://sql.telemetry.mozilla.org/queries/4613#table
MozReview-Commit-ID: 7AVQ8fWub8I
When page option 'add page shortcut' is clicked, creating a shortcut(not PWA) on launcher.
Also make sure that heavy tasks are executed in background thread.
MozReview-Commit-ID: 8KtwdXENtEd
To be honest, I'm not sure why this works. onSizeChanged seems to be a callback
to notify the user that your layout has completed and not a place to update
layout params. However, it makes *slightly* more sense that you could update
your children's layout from this view, which is what this patch changes the
code to do.
I think I could figure out why this works if I dug further into [1] but I have
other things to focus on.
I don't think this is the most correct solution, but it is likely the smallest
and least risky change we can make to fix this issue, which is ideal because
we'd like to uplift this to the 57 Beta.
A more correct solution would override the Activity Stream RecyclerView and
provide different desired measurements to its parent so that the new size is
set *during* layout rather than after it, which would make the layout process
more efficient. However, this type of code is less commonly written day-to-day
by developers so it's harder to write, harder to maintain, and I'd have to read
a lot of [1] in order to write it. :)
[1]: https://developer.android.com/guide/topics/ui/how-android-draws.html
MozReview-Commit-ID: AceUvDYGWCR
Unfortunately, I can't reproduce so I'm unable to verify this fix works for
sure. However, I verified the behavior of the StreamOverridablePageIconLayout
remained the same after these changes.
As per my bug comments, using the new version of onCreateView may fix this
problem and is "more correct" than this fix but it's speculative and it's too
dangerous to make speculative fixes this close to the 57 merge. Instead, we do
this surefire fix and lose a little correctness.
The onCreateView fix moved to bug 1401779.
MozReview-Commit-ID: DSq9jEgz6gL
Icons apparently doesn't fade images, however, so it looks bad. Also, we try to
request the image each time we bind, so scrolling up and down will create
additional pop-in, which also sucks.
MozReview-Commit-ID: 246pokTMFl7
I believe this doesn't affect this bug because I think the ViewHolders are
recreated on rotation but for any other type of change, only bind will be
called so for correctness, we should update the size in bind.
MozReview-Commit-ID: 3ojO4TF89i4
In this sense, it acts as a refresh function, binding all of our UI state at
the same time, helping to prevent bugs where the UI gets out of sync.
For example, this fixes this bug because now the tileSize gets updated when we
swap the cursor, not just when we the page is initially constructed.
MozReview-Commit-ID: 7V2gFyiOJ1R
Since it's a constant, there's no reason to keep passing it around everywhere.
Also, the code that relied on it being a dynamic value is probably broken so
there's no reason to continue passing it around.
That being said, there is bug 1397854, which would have TopSites be 4 rows with
no pages, but this code is quite messy so I think it'd be worth trying to
refactor this code further before trying to implement that.
MozReview-Commit-ID: IoMNHVt67c4
I don't scale the pin size/margins based on the dynamic tile size. This could
mean we get into situations where the pin crowds out the top site tile but I
don't know if this would happen in practice.
MozReview-Commit-ID: Ct8EP3dPr6N
I tested this through the unit tests I added.
In theory, we could also validate URLs to make sure they're valid but users
should see 404s if they're not valid so this seems like unnecessary code.
MozReview-Commit-ID: 3XqsMawLabj
This is the desired behavior but as per comment 8, it breaks a few existing
distributions' titles so we'll display two lines for those distributions in
the upcoming changesets.
MozReview-Commit-ID: CKFbHXbs3HT
Unlike the previous changeset, we don't strip common subdomains because
"m.youtube.com" and "www.mozilla.org" can be informative and don't look bad
when you have a tld.
MozReview-Commit-ID: BOPH73pzAfh