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

Side by Side Diff: content/shell/android/java/src/org/chromium/content_shell/Shell.java

Issue 540853002: Remove focus on back key press if focus is on url bar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.content_shell; 5 package org.chromium.content_shell;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.graphics.drawable.ClipDrawable; 8 import android.graphics.drawable.ClipDrawable;
9 import android.text.TextUtils; 9 import android.text.TextUtils;
10 import android.util.AttributeSet; 10 import android.util.AttributeSet;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 @Override 159 @Override
160 public void onFocusChange(View v, boolean hasFocus) { 160 public void onFocusChange(View v, boolean hasFocus) {
161 setKeyboardVisibilityForUrl(hasFocus); 161 setKeyboardVisibilityForUrl(hasFocus);
162 mNextButton.setVisibility(hasFocus ? GONE : VISIBLE); 162 mNextButton.setVisibility(hasFocus ? GONE : VISIBLE);
163 mPrevButton.setVisibility(hasFocus ? GONE : VISIBLE); 163 mPrevButton.setVisibility(hasFocus ? GONE : VISIBLE);
164 if (!hasFocus) { 164 if (!hasFocus) {
165 mUrlTextView.setText(mContentViewCore.getUrl()); 165 mUrlTextView.setText(mContentViewCore.getUrl());
166 } 166 }
167 } 167 }
168 }); 168 });
169 mUrlTextView.setOnKeyListener(new OnKeyListener() {
170 @Override
171 public boolean onKey(View v, int keyCode, KeyEvent event) {
172 if (keyCode == KeyEvent.KEYCODE_BACK) {
173 mUrlTextView.clearFocus();
174 mContentViewCore.getContainerView().requestFocus();
Ted C 2014/09/08 15:47:55 Is the above line necessary with this line? By re
ankit 2014/09/09 10:28:35 Done. Above line not required.
175 return true;
176 }
177 return false;
178 }
179 });
169 } 180 }
170 181
171 /** 182 /**
172 * Loads an URL. This will perform minimal amounts of sanitizing of the URL to attempt to 183 * Loads an URL. This will perform minimal amounts of sanitizing of the URL to attempt to
173 * make it valid. 184 * make it valid.
174 * 185 *
175 * @param url The URL to be loaded by the shell. 186 * @param url The URL to be loaded by the shell.
176 */ 187 */
177 public void loadUrl(String url) { 188 public void loadUrl(String url) {
178 if (url == null) return; 189 if (url == null) return;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 Context.INPUT_METHOD_SERVICE); 329 Context.INPUT_METHOD_SERVICE);
319 if (visible) { 330 if (visible) {
320 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); 331 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT);
321 } else { 332 } else {
322 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); 333 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0);
323 } 334 }
324 } 335 }
325 336
326 private static native void nativeCloseShell(long shellPtr); 337 private static native void nativeCloseShell(long shellPtr);
327 } 338 }
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