OLD | NEW |
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 mProgressDrawable = (ClipDrawable) findViewById(R.id.toolbar).getBackgro
und(); | 141 mProgressDrawable = (ClipDrawable) findViewById(R.id.toolbar).getBackgro
und(); |
142 initializeUrlField(); | 142 initializeUrlField(); |
143 initializeNavigationButtons(); | 143 initializeNavigationButtons(); |
144 } | 144 } |
145 | 145 |
146 private void initializeUrlField() { | 146 private void initializeUrlField() { |
147 mUrlTextView = (EditText) findViewById(R.id.url); | 147 mUrlTextView = (EditText) findViewById(R.id.url); |
148 mUrlTextView.setOnEditorActionListener(new OnEditorActionListener() { | 148 mUrlTextView.setOnEditorActionListener(new OnEditorActionListener() { |
149 @Override | 149 @Override |
150 public boolean onEditorAction(TextView v, int actionId, KeyEvent eve
nt) { | 150 public boolean onEditorAction(TextView v, int actionId, KeyEvent eve
nt) { |
151 if ((actionId != EditorInfo.IME_ACTION_GO) && (event == null || | 151 if ((actionId != EditorInfo.IME_ACTION_GO) && (event == null |
152 event.getKeyCode() != KeyEvent.KEYCODE_ENTER || | 152 || event.getKeyCode() != KeyEvent.KEYCODE_ENTER |
153 event.getAction() != KeyEvent.ACTION_DOWN)) { | 153 || event.getAction() != KeyEvent.ACTION_DOWN)) { |
154 return false; | 154 return false; |
155 } | 155 } |
156 loadUrl(mUrlTextView.getText().toString()); | 156 loadUrl(mUrlTextView.getText().toString()); |
157 setKeyboardVisibilityForUrl(false); | 157 setKeyboardVisibilityForUrl(false); |
158 mContentViewCore.getContainerView().requestFocus(); | 158 mContentViewCore.getContainerView().requestFocus(); |
159 return true; | 159 return true; |
160 } | 160 } |
161 }); | 161 }); |
162 mUrlTextView.setOnFocusChangeListener(new OnFocusChangeListener() { | 162 mUrlTextView.setOnFocusChangeListener(new OnFocusChangeListener() { |
163 @Override | 163 @Override |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 Context.INPUT_METHOD_SERVICE); | 342 Context.INPUT_METHOD_SERVICE); |
343 if (visible) { | 343 if (visible) { |
344 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 344 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
345 } else { | 345 } else { |
346 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 346 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
347 } | 347 } |
348 } | 348 } |
349 | 349 |
350 private static native void nativeCloseShell(long shellPtr); | 350 private static native void nativeCloseShell(long shellPtr); |
351 } | 351 } |
OLD | NEW |