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

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

Issue 10823051: ContentShell rendering support on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address jam's comments Created 8 years, 4 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 | Annotate | Revision Log
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 28 matching lines...) Expand all
39 }; 39 };
40 40
41 // TODO(jrg): a mContentView.destroy() call is needed, both upstream and dow nstream. 41 // TODO(jrg): a mContentView.destroy() call is needed, both upstream and dow nstream.
42 private ContentView mContentView; 42 private ContentView mContentView;
43 private EditText mUrlTextView; 43 private EditText mUrlTextView;
44 private ImageButton mPrevButton; 44 private ImageButton mPrevButton;
45 private ImageButton mNextButton; 45 private ImageButton mNextButton;
46 46
47 private ClipDrawable mProgressDrawable; 47 private ClipDrawable mProgressDrawable;
48 48
49 private View mSurfaceView;
50
49 /** 51 /**
50 * Constructor for inflating via XML. 52 * Constructor for inflating via XML.
51 */ 53 */
52 public Shell(Context context, AttributeSet attrs) { 54 public Shell(Context context, AttributeSet attrs) {
53 super(context, attrs); 55 super(context, attrs);
54 } 56 }
55 57
58 /**
59 * Set the SurfaceView being renderered to as soon as it is available.
60 */
61 public void setSurfaceView(View surfaceView) {
62 mSurfaceView = surfaceView;
63 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mSurfaceVi ew,
64 new FrameLayout.LayoutParams(
65 FrameLayout.LayoutParams.MATCH_PARENT,
66 FrameLayout.LayoutParams.MATCH_PARENT));
67 }
68
56 @Override 69 @Override
57 protected void onFinishInflate() { 70 protected void onFinishInflate() {
58 super.onFinishInflate(); 71 super.onFinishInflate();
59 72
60 mProgressDrawable = (ClipDrawable) findViewById(R.id.toolbar).getBackgro und(); 73 mProgressDrawable = (ClipDrawable) findViewById(R.id.toolbar).getBackgro und();
61 74 initializeUrlField();
62 initilizeUrlField();
63 initializeNavigationButtons(); 75 initializeNavigationButtons();
64 } 76 }
65 77
66 private void initilizeUrlField() { 78 private void initializeUrlField() {
67 mUrlTextView = (EditText) findViewById(R.id.url); 79 mUrlTextView = (EditText) findViewById(R.id.url);
68 mUrlTextView.setOnEditorActionListener(new OnEditorActionListener() { 80 mUrlTextView.setOnEditorActionListener(new OnEditorActionListener() {
69 @Override 81 @Override
70 public boolean onEditorAction(TextView v, int actionId, KeyEvent eve nt) { 82 public boolean onEditorAction(TextView v, int actionId, KeyEvent eve nt) {
71 if ((actionId != EditorInfo.IME_ACTION_GO) && (event == null || 83 if ((actionId != EditorInfo.IME_ACTION_GO) && (event == null ||
72 event.getKeyCode() != KeyEvent.KEYCODE_ENTER || 84 event.getKeyCode() != KeyEvent.KEYCODE_ENTER ||
73 event.getAction() != KeyEvent.ACTION_UP)) { 85 event.getAction() != KeyEvent.ACTION_UP)) {
74 return false; 86 return false;
75 } 87 }
76 loadUrl(mUrlTextView.getText().toString()); 88 loadUrl(mUrlTextView.getText().toString());
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 private void setKeyboardVisibilityForUrl(boolean visible) { 191 private void setKeyboardVisibilityForUrl(boolean visible) {
180 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ ice( 192 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ ice(
181 Context.INPUT_METHOD_SERVICE); 193 Context.INPUT_METHOD_SERVICE);
182 if (visible) { 194 if (visible) {
183 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); 195 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT);
184 } else { 196 } else {
185 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); 197 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0);
186 } 198 }
187 } 199 }
188 } 200 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698