OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.chromoting; | 5 package org.chromium.chromoting; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Intent; |
8 import android.content.res.Configuration; | 9 import android.content.res.Configuration; |
| 10 import android.net.Uri; |
9 import android.os.Bundle; | 11 import android.os.Bundle; |
10 import android.view.KeyEvent; | 12 import android.view.KeyEvent; |
11 import android.view.Menu; | 13 import android.view.Menu; |
12 import android.view.MenuItem; | 14 import android.view.MenuItem; |
13 import android.view.View; | 15 import android.view.View; |
14 import android.view.inputmethod.InputMethodManager; | 16 import android.view.inputmethod.InputMethodManager; |
15 import android.widget.ImageButton; | 17 import android.widget.ImageButton; |
16 | 18 |
17 import org.chromium.chromoting.jni.JniInterface; | 19 import org.chromium.chromoting.jni.JniInterface; |
18 | 20 |
19 /** | 21 /** |
20 * A simple screen that does nothing except display a DesktopView and notify it
of rotations. | 22 * A simple screen that does nothing except display a DesktopView and notify it
of rotations. |
21 */ | 23 */ |
22 public class Desktop extends Activity { | 24 public class Desktop extends Activity { |
| 25 /** Web page to be displayed in the Help screen when launched from this acti
vity. */ |
| 26 private static final String HELP_URL = |
| 27 "http://support.google.com/chrome/?p=mobile_crd_connecthost"; |
| 28 |
23 /** The surface that displays the remote host's desktop feed. */ | 29 /** The surface that displays the remote host's desktop feed. */ |
24 private DesktopView mRemoteHostDesktop; | 30 private DesktopView mRemoteHostDesktop; |
25 | 31 |
26 /** The button used to show the action bar. */ | 32 /** The button used to show the action bar. */ |
27 private ImageButton mOverlayButton; | 33 private ImageButton mOverlayButton; |
28 | 34 |
29 /** Called when the activity is first created. */ | 35 /** Called when the activity is first created. */ |
30 @Override | 36 @Override |
31 public void onCreate(Bundle savedInstanceState) { | 37 public void onCreate(Bundle savedInstanceState) { |
32 super.onCreate(savedInstanceState); | 38 super.onCreate(savedInstanceState); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 }; | 106 }; |
101 for (int key : keys) { | 107 for (int key : keys) { |
102 JniInterface.keyboardAction(key, true); | 108 JniInterface.keyboardAction(key, true); |
103 } | 109 } |
104 for (int key : keys) { | 110 for (int key : keys) { |
105 JniInterface.keyboardAction(key, false); | 111 JniInterface.keyboardAction(key, false); |
106 } | 112 } |
107 } | 113 } |
108 return true; | 114 return true; |
109 | 115 |
| 116 case R.id.actionbar_help: |
| 117 { |
| 118 Intent intent = new Intent(this, HelpActivity.class); |
| 119 intent.setData(Uri.parse(HELP_URL)); |
| 120 startActivity(intent); |
| 121 } |
| 122 return true; |
| 123 |
110 default: | 124 default: |
111 return super.onOptionsItemSelected(item); | 125 return super.onOptionsItemSelected(item); |
112 } | 126 } |
113 } | 127 } |
114 | 128 |
115 /** | 129 /** |
116 * Called once when a keyboard key is pressed, then again when that same key
is released. This | 130 * Called once when a keyboard key is pressed, then again when that same key
is released. This |
117 * is not guaranteed to be notified of all soft keyboard events: certian key
boards might not | 131 * is not guaranteed to be notified of all soft keyboard events: certian key
boards might not |
118 * call it at all, while others might skip it in certain situations (e.g. sw
ipe input). | 132 * call it at all, while others might skip it in certain situations (e.g. sw
ipe input). |
119 */ | 133 */ |
(...skipping 23 matching lines...) Expand all Loading... |
143 break; | 157 break; |
144 | 158 |
145 default: | 159 default: |
146 // We try to send all other key codes to the host directly. | 160 // We try to send all other key codes to the host directly. |
147 JniInterface.keyboardAction(event.getKeyCode(), depressed); | 161 JniInterface.keyboardAction(event.getKeyCode(), depressed); |
148 } | 162 } |
149 | 163 |
150 return super.dispatchKeyEvent(event); | 164 return super.dispatchKeyEvent(event); |
151 } | 165 } |
152 } | 166 } |
OLD | NEW |