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; | 5 package org.chromium.chrome.shell; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.res.Configuration; | 8 import android.content.res.Configuration; |
9 import android.graphics.drawable.ClipDrawable; | 9 import android.graphics.drawable.ClipDrawable; |
10 import android.util.AttributeSet; | 10 import android.util.AttributeSet; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 mUrlTextView.setOnFocusChangeListener(new OnFocusChangeListener() { | 133 mUrlTextView.setOnFocusChangeListener(new OnFocusChangeListener() { |
134 @Override | 134 @Override |
135 public void onFocusChange(View v, boolean hasFocus) { | 135 public void onFocusChange(View v, boolean hasFocus) { |
136 setKeyboardVisibilityForUrl(hasFocus); | 136 setKeyboardVisibilityForUrl(hasFocus); |
137 if (!hasFocus) { | 137 if (!hasFocus) { |
138 mUrlTextView.setText(mTab.getContentViewCore().getUrl()); | 138 mUrlTextView.setText(mTab.getContentViewCore().getUrl()); |
139 mSuggestionPopup.dismissPopup(); | 139 mSuggestionPopup.dismissPopup(); |
140 } | 140 } |
141 } | 141 } |
142 }); | 142 }); |
143 mUrlTextView.setOnKeyListener(new OnKeyListener() { | |
144 @Override | |
145 public boolean onKey(View v, int keyCode, KeyEvent event) { | |
146 if (event != null && keyCode == KeyEvent.KEYCODE_BACK) { | |
Bernhard Bauer
2014/08/26 07:46:10
Is this actually called with a null event?
ankit
2014/08/26 08:16:32
I did not encounter any scenario when it was getti
Bernhard Bauer
2014/08/26 08:20:43
I would rather not add it. Your assumption (and mi
| |
147 mUrlTextView.clearFocus(); | |
148 if (mTab != null) { | |
149 mTab.getView().requestFocus(); | |
150 } | |
151 return true; | |
152 } | |
153 return false; | |
154 } | |
155 }); | |
143 | 156 |
144 mSuggestionPopup = new SuggestionPopup(getContext(), mUrlTextView, this) ; | 157 mSuggestionPopup = new SuggestionPopup(getContext(), mUrlTextView, this) ; |
145 mUrlTextView.addTextChangedListener(mSuggestionPopup); | 158 mUrlTextView.addTextChangedListener(mSuggestionPopup); |
146 } | 159 } |
147 | 160 |
148 private void initializeMenuButton() { | 161 private void initializeMenuButton() { |
149 ImageButton menuButton = (ImageButton) findViewById(R.id.menu_button); | 162 ImageButton menuButton = (ImageButton) findViewById(R.id.menu_button); |
150 menuButton.setOnClickListener(new OnClickListener() { | 163 menuButton.setOnClickListener(new OnClickListener() { |
151 @Override | 164 @Override |
152 public void onClick(View view) { | 165 public void onClick(View view) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 public void onLoadProgressChanged(Tab tab, int progress) { | 206 public void onLoadProgressChanged(Tab tab, int progress) { |
194 if (tab == mTab) ChromeShellToolbar.this.onLoadProgressChanged(progr ess); | 207 if (tab == mTab) ChromeShellToolbar.this.onLoadProgressChanged(progr ess); |
195 } | 208 } |
196 | 209 |
197 @Override | 210 @Override |
198 public void onUpdateUrl(Tab tab, String url) { | 211 public void onUpdateUrl(Tab tab, String url) { |
199 if (tab == mTab) ChromeShellToolbar.this.onUpdateUrl(url); | 212 if (tab == mTab) ChromeShellToolbar.this.onUpdateUrl(url); |
200 } | 213 } |
201 } | 214 } |
202 } | 215 } |
OLD | NEW |