Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java

Issue 500043002: Added code to dismiss url suggestion popup on back key press. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified code as suggested Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 (keyCode == KeyEvent.KEYCODE_BACK) {
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698