Fix a problem that the suggestion popup does not disappear when initiating navigation.

Steps to reproduce:
1. Type some keys in |mUrlTextView| to show some suggestions.
2. Press "Go" button.

What heppended:
The url loading starts but the suggestions does not disappear.

BUG=none

Review URL: https://codereview.chromium.org/312673007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274575 0039d316-1c4b-4281-b951-d872f2087c98
parent 288b44de
...@@ -47,6 +47,8 @@ public class ChromeShellToolbar extends LinearLayout { ...@@ -47,6 +47,8 @@ public class ChromeShellToolbar extends LinearLayout {
private AppMenuHandler mMenuHandler; private AppMenuHandler mMenuHandler;
private AppMenuButtonHelper mAppMenuButtonHelper; private AppMenuButtonHelper mAppMenuButtonHelper;
private SuggestionPopup mSuggestionPopup;
/** /**
* @param context The Context the view is running in. * @param context The Context the view is running in.
* @param attrs The attributes of the XML tag that is inflating the view. * @param attrs The attributes of the XML tag that is inflating the view.
...@@ -102,6 +104,7 @@ public class ChromeShellToolbar extends LinearLayout { ...@@ -102,6 +104,7 @@ public class ChromeShellToolbar extends LinearLayout {
return false; return false;
} }
mSuggestionPopup.dismissPopup();
mTab.loadUrlWithSanitization(mUrlTextView.getText().toString()); mTab.loadUrlWithSanitization(mUrlTextView.getText().toString());
mUrlTextView.clearFocus(); mUrlTextView.clearFocus();
setKeyboardVisibilityForUrl(false); setKeyboardVisibilityForUrl(false);
...@@ -118,7 +121,9 @@ public class ChromeShellToolbar extends LinearLayout { ...@@ -118,7 +121,9 @@ public class ChromeShellToolbar extends LinearLayout {
} }
} }
}); });
mUrlTextView.addTextChangedListener(new SuggestionPopup(getContext(), mUrlTextView, this));
mSuggestionPopup = new SuggestionPopup(getContext(), mUrlTextView, this);
mUrlTextView.addTextChangedListener(mSuggestionPopup);
} }
private void initializeMenuButton() { private void initializeMenuButton() {
......
...@@ -61,7 +61,7 @@ public class SuggestionPopup implements OnSuggestionsReceivedListener, TextWatch ...@@ -61,7 +61,7 @@ public class SuggestionPopup implements OnSuggestionsReceivedListener, TextWatch
dismissPopup(); dismissPopup();
} }
private void dismissPopup() { public void dismissPopup() {
if (mSuggestionsPopup != null) { if (mSuggestionsPopup != null) {
mSuggestionsPopup.dismiss(); mSuggestionsPopup.dismiss();
mSuggestionsPopup = null; mSuggestionsPopup = null;
......
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