OLD | NEW |
---|---|
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 Loading... | |
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 public void setSurfaceView(View surfaceView) { | |
Ted C
2012/07/27 20:31:15
javadoc for these public methods...even if it simp
no sievers
2012/07/31 01:28:44
Done.
| |
59 mSurfaceView = surfaceView; | |
60 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mSurfaceVi ew, | |
61 new FrameLayout.LayoutParams( | |
62 FrameLayout.LayoutParams.MATCH_PARENT, | |
63 FrameLayout.LayoutParams.MATCH_PARENT)); | |
64 } | |
65 | |
56 @Override | 66 @Override |
57 protected void onFinishInflate() { | 67 protected void onFinishInflate() { |
58 super.onFinishInflate(); | 68 super.onFinishInflate(); |
59 | 69 |
60 mProgressDrawable = (ClipDrawable) findViewById(R.id.toolbar).getBackgro und(); | 70 mProgressDrawable = (ClipDrawable) findViewById(R.id.toolbar).getBackgro und(); |
61 | 71 |
62 initilizeUrlField(); | |
klobag.chromium
2012/07/27 19:42:22
I don't think we need to move this line as it just
no sievers
2012/07/31 01:28:44
Done.
| |
63 initializeNavigationButtons(); | 72 initializeNavigationButtons(); |
64 } | 73 } |
65 | 74 |
66 private void initilizeUrlField() { | 75 public void onSurfaceCreated() { |
76 initializeUrlField(); | |
77 loadUrl("http://www.google.com"); | |
Satish
2012/07/27 09:49:24
is this required or was it test code to be removed
klobag.chromium
2012/07/27 19:42:22
You may not want to do it for every onSurfaceCreat
Ted C
2012/07/27 20:31:15
loadUrl happens as part of shell creation during s
no sievers
2012/07/31 01:28:44
Required for now since we have to create the UI gr
| |
78 } | |
79 | |
80 private void initializeUrlField() { | |
67 mUrlTextView = (EditText) findViewById(R.id.url); | 81 mUrlTextView = (EditText) findViewById(R.id.url); |
68 mUrlTextView.setOnEditorActionListener(new OnEditorActionListener() { | 82 mUrlTextView.setOnEditorActionListener(new OnEditorActionListener() { |
69 @Override | 83 @Override |
70 public boolean onEditorAction(TextView v, int actionId, KeyEvent eve nt) { | 84 public boolean onEditorAction(TextView v, int actionId, KeyEvent eve nt) { |
71 if ((actionId != EditorInfo.IME_ACTION_GO) && (event == null || | 85 if ((actionId != EditorInfo.IME_ACTION_GO) && (event == null || |
72 event.getKeyCode() != KeyEvent.KEYCODE_ENTER || | 86 event.getKeyCode() != KeyEvent.KEYCODE_ENTER || |
73 event.getAction() != KeyEvent.ACTION_UP)) { | 87 event.getAction() != KeyEvent.ACTION_UP)) { |
74 return false; | 88 return false; |
75 } | 89 } |
76 loadUrl(mUrlTextView.getText().toString()); | 90 loadUrl(mUrlTextView.getText().toString()); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 private void setKeyboardVisibilityForUrl(boolean visible) { | 192 private void setKeyboardVisibilityForUrl(boolean visible) { |
179 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ ice( | 193 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ ice( |
180 Context.INPUT_METHOD_SERVICE); | 194 Context.INPUT_METHOD_SERVICE); |
181 if (visible) { | 195 if (visible) { |
182 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 196 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
183 } else { | 197 } else { |
184 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 198 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
185 } | 199 } |
186 } | 200 } |
187 } | 201 } |
OLD | NEW |