0

Clear recycler view on URL focus clear.

This change ensures that the RecyclerView clears the view pool
when the user ends interaction with the Omnibox.

Bug: 1075602
Change-Id: Iacd36ade19e67144421674cc85c05b750bd0b7b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404390
Commit-Queue: Tomasz Wiszkowski <ender@google.com>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Filip Gorski <fgorski@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805957}
This commit is contained in:
Tomasz Wiszkowski
2020-09-10 22:54:22 +00:00
committed by Commit Bot
parent 10d5bf9896
commit 4a7b8ad183
4 changed files with 17 additions and 1 deletions

@ -61,6 +61,9 @@ public interface OmniboxSuggestionsDropdown {
/** Show (and properly size) the suggestions list. */
void show();
/** Hide the suggestions list and release any cached resources. */
void hide();
/**
* Sets the embedder for the list view.
* @param embedder the embedder of this list.

@ -87,6 +87,12 @@ public class OmniboxSuggestionsList
if (getSelectedItemPosition() != 0) setSelection(0);
}
@Override
public void hide() {
if (getVisibility() != VISIBLE) return;
setVisibility(GONE);
}
@Override
public void refreshPopupBackground(boolean isIncognito) {
setBackground(mDropdownDelegate.getPopupBackground(isIncognito));

@ -150,6 +150,13 @@ public class OmniboxSuggestionsRecyclerView
}
}
@Override
public void hide() {
if (getVisibility() != VISIBLE) return;
setVisibility(GONE);
getRecycledViewPool().clear();
}
@Override
public void refreshPopupBackground(boolean isIncognito) {
setBackground(mDropdownDelegate.getPopupBackground(isIncognito));

@ -45,7 +45,7 @@ class SuggestionListViewBinder {
if (dropdownView.getParent() == null) view.container.addView(dropdownView);
view.dropdown.show();
} else {
dropdownView.setVisibility(View.GONE);
view.dropdown.hide();
UiUtils.removeViewFromParent(dropdownView);
view.container.setVisibility(View.INVISIBLE);
}