Commit 4a7b8ad1 authored by Tomasz Wiszkowski's avatar Tomasz Wiszkowski Committed by Commit Bot

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: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarFilip Gorski <fgorski@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805957}
parent 10d5bf98
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment