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

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

Issue 11299196: Handle the 'enter' key with the action 'ACTION_DOWN' (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/android/testshell/java/src/org/chromium/chrome/testshell/TestShellToolbar.java ('k') | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 initializeNavigationButtons(); 102 initializeNavigationButtons();
103 } 103 }
104 104
105 private void initializeUrlField() { 105 private void initializeUrlField() {
106 mUrlTextView = (EditText) findViewById(R.id.url); 106 mUrlTextView = (EditText) findViewById(R.id.url);
107 mUrlTextView.setOnEditorActionListener(new OnEditorActionListener() { 107 mUrlTextView.setOnEditorActionListener(new OnEditorActionListener() {
108 @Override 108 @Override
109 public boolean onEditorAction(TextView v, int actionId, KeyEvent eve nt) { 109 public boolean onEditorAction(TextView v, int actionId, KeyEvent eve nt) {
110 if ((actionId != EditorInfo.IME_ACTION_GO) && (event == null || 110 if ((actionId != EditorInfo.IME_ACTION_GO) && (event == null ||
111 event.getKeyCode() != KeyEvent.KEYCODE_ENTER || 111 event.getKeyCode() != KeyEvent.KEYCODE_ENTER ||
112 event.getAction() != KeyEvent.ACTION_UP)) { 112 event.getAction() != KeyEvent.ACTION_DOWN)) {
113 return false; 113 return false;
114 } 114 }
115 loadUrl(mUrlTextView.getText().toString()); 115 loadUrl(mUrlTextView.getText().toString());
116 setKeyboardVisibilityForUrl(false); 116 setKeyboardVisibilityForUrl(false);
117 mContentView.requestFocus(); 117 mContentView.requestFocus();
118 return true; 118 return true;
119 } 119 }
120 }); 120 });
121 mUrlTextView.setOnFocusChangeListener(new OnFocusChangeListener() { 121 mUrlTextView.setOnFocusChangeListener(new OnFocusChangeListener() {
122 @Override 122 @Override
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 private void setKeyboardVisibilityForUrl(boolean visible) { 234 private void setKeyboardVisibilityForUrl(boolean visible) {
235 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ ice( 235 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ ice(
236 Context.INPUT_METHOD_SERVICE); 236 Context.INPUT_METHOD_SERVICE);
237 if (visible) { 237 if (visible) {
238 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); 238 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT);
239 } else { 239 } else {
240 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); 240 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0);
241 } 241 }
242 } 242 }
243 } 243 }
OLDNEW
« no previous file with comments | « chrome/android/testshell/java/src/org/chromium/chrome/testshell/TestShellToolbar.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698