зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1534213 - Reduce the number of WebpageItemRow layout refreshes; r=JanH
Previously, WebpageItemRow's layout would be updated everytime a new Tab for it's url would be ADDED/CLOSED/LOCATION_CHANGED to force a recheck of the need to show the "Switch to tab hint". To prevent multiple layout refreshes for every such event we will check the current display status of the "Switch to tab hint" against the newly computed value after an ADDED/CLOSED/LOCATION_CHANGED event was received. Eagerly changing the value for 'switchToTabHintShown' along with informing about the need for layout refresh to prevent any race conditions between receiving more events and actualy refreshing the layout. (In my tests I saw ADDED/LOCATION_CHANGE refreshing the same layout needlessly) Differential Revision: https://phabricator.services.mozilla.com/D24013 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d5b1e90c82
Коммит
bee3c060d4
|
@ -40,6 +40,7 @@ public class WebpageItemRow extends StreamViewHolder implements Tabs.OnTabsChang
|
|||
private WebpageRowModel webpageModel;
|
||||
private OnContentChangedListener contentChangedListener;
|
||||
private int position;
|
||||
private boolean switchToTabHintShown;
|
||||
|
||||
private final StreamOverridablePageIconLayout pageIconLayout;
|
||||
private final TextView pageDomainView;
|
||||
|
@ -95,8 +96,8 @@ public class WebpageItemRow extends StreamViewHolder implements Tabs.OnTabsChang
|
|||
updatePageDomain();
|
||||
pageIconLayout.updateIcon(model.getUrl(), model.getImageUrl());
|
||||
|
||||
final boolean isTabOpenedForItem = isTabOpenedForItem();
|
||||
switchToTabHint.setVisibility(isTabOpenedForItem ? View.VISIBLE : View.GONE);
|
||||
switchToTabHintShown = isTabOpenedForItem();
|
||||
switchToTabHint.setVisibility(switchToTabHintShown ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
public void initResources() {
|
||||
|
@ -218,7 +219,9 @@ public class WebpageItemRow extends StreamViewHolder implements Tabs.OnTabsChang
|
|||
// because they can be about:reader URLs if the current or old tab page was a reader view
|
||||
final String tabUrl = ReaderModeUtils.stripAboutReaderUrl(tab.getURL());
|
||||
final String previousTabUrl = ReaderModeUtils.stripAboutReaderUrl(data);
|
||||
if (itemUrl.equals(tabUrl) || itemUrl.equals(previousTabUrl)) {
|
||||
if ((itemUrl.equals(tabUrl) || itemUrl.equals(previousTabUrl)) &&
|
||||
(switchToTabHintShown != isTabOpenedForItem())) {
|
||||
switchToTabHintShown = !switchToTabHintShown;
|
||||
notifyListenerAboutContentChange();
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче