OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.shell.omnibox; | 5 package org.chromium.chrome.shell.omnibox; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.graphics.Rect; | 8 import android.graphics.Rect; |
9 import android.os.Handler; | 9 import android.os.Handler; |
10 import android.text.Editable; | 10 import android.text.Editable; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 public SuggestionPopup(Context context, EditText urlField, ChromeShellToolba
r toolbar) { | 52 public SuggestionPopup(Context context, EditText urlField, ChromeShellToolba
r toolbar) { |
53 mContext = context; | 53 mContext = context; |
54 mUrlField = urlField; | 54 mUrlField = urlField; |
55 mToolbar = toolbar; | 55 mToolbar = toolbar; |
56 mAutocomplete = new AutocompleteController(this); | 56 mAutocomplete = new AutocompleteController(this); |
57 OnLayoutChangeListener listener = new OnLayoutChangeListener() { | 57 OnLayoutChangeListener listener = new OnLayoutChangeListener() { |
58 @Override | 58 @Override |
59 public void onLayoutChange(View v, int left, int top, int right, int
bottom, | 59 public void onLayoutChange(View v, int left, int top, int right, int
bottom, |
60 int oldLeft, int oldTop, int oldRight, int oldBottom) { | 60 int oldLeft, int oldTop, int oldRight, int oldBottom) { |
61 if (mSuggestionsPopup == null || !mSuggestionsPopup.isShowing())
return; | 61 if (mSuggestionsPopup == null || !mSuggestionsPopup.isShowing())
return; |
62 mSuggestionsPopup.setWidth(mUrlField.getWidth()); | 62 mSuggestionsPopup.setWidth(mToolbar.getWidth()); |
63 mSuggestionsPopup.setHeight(getSuggestionPopupHeight()); | 63 mSuggestionsPopup.setHeight(getSuggestionPopupHeight()); |
64 mSuggestionsPopup.show(); | 64 mSuggestionsPopup.show(); |
65 } | 65 } |
66 }; | 66 }; |
67 mUrlField.addOnLayoutChangeListener(listener); | 67 mUrlField.addOnLayoutChangeListener(listener); |
68 } | 68 } |
69 | 69 |
70 private void navigateToSuggestion(int position) { | 70 private void navigateToSuggestion(int position) { |
71 mToolbar.getCurrentTab().loadUrlWithSanitization( | 71 mToolbar.getCurrentTab().loadUrlWithSanitization( |
72 mSuggestionArrayAdapter.getItem(position).getUrl()); | 72 mSuggestionArrayAdapter.getItem(position).getUrl()); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 @Override | 187 @Override |
188 public void beforeTextChanged(CharSequence s, int start, int count, int afte
r) { | 188 public void beforeTextChanged(CharSequence s, int start, int count, int afte
r) { |
189 mRequestSuggestions = null; | 189 mRequestSuggestions = null; |
190 } | 190 } |
191 | 191 |
192 @Override | 192 @Override |
193 public void onTextChanged(CharSequence s, int start, int before, int count)
{ | 193 public void onTextChanged(CharSequence s, int start, int before, int count)
{ |
194 } | 194 } |
195 } | 195 } |
OLD | NEW |