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.res.Configuration; | 8 import android.content.res.Configuration; |
9 import android.os.Bundle; | 9 import android.os.Bundle; |
10 import android.view.KeyEvent; | 10 import android.view.KeyEvent; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 /** Called whenever an action bar button is pressed. */ | 53 /** Called whenever an action bar button is pressed. */ |
54 @Override | 54 @Override |
55 public boolean onOptionsItemSelected(MenuItem item) { | 55 public boolean onOptionsItemSelected(MenuItem item) { |
56 switch (item.getItemId()) { | 56 switch (item.getItemId()) { |
57 case R.id.actionbar_keyboard: | 57 case R.id.actionbar_keyboard: |
58 ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).tog
gleSoftInput(0, 0); | 58 ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).tog
gleSoftInput(0, 0); |
59 return true; | 59 return true; |
60 case R.id.actionbar_hide: | 60 case R.id.actionbar_hide: |
61 getActionBar().hide(); | 61 getActionBar().hide(); |
62 return true; | 62 return true; |
| 63 case R.id.actionbar_disconnect: |
| 64 JniInterface.disconnectFromHost(); |
| 65 return true; |
63 default: | 66 default: |
64 return super.onOptionsItemSelected(item); | 67 return super.onOptionsItemSelected(item); |
65 } | 68 } |
66 } | 69 } |
67 | 70 |
68 /** | 71 /** |
69 * Called once when a keyboard key is pressed, then again when that same key
is released. This | 72 * Called once when a keyboard key is pressed, then again when that same key
is released. This |
70 * is not guaranteed to be notified of all soft keyboard events: certian key
boards might not | 73 * is not guaranteed to be notified of all soft keyboard events: certian key
boards might not |
71 * call it at all, while others might skip it in certain situations (e.g. sw
ipe input). | 74 * call it at all, while others might skip it in certain situations (e.g. sw
ipe input). |
72 */ | 75 */ |
(...skipping 19 matching lines...) Expand all Loading... |
92 JniInterface.keyboardAction(KeyEvent.KEYCODE_EQUALS, depressed); | 95 JniInterface.keyboardAction(KeyEvent.KEYCODE_EQUALS, depressed); |
93 break; | 96 break; |
94 default: | 97 default: |
95 // We try to send all other key codes to the host directly. | 98 // We try to send all other key codes to the host directly. |
96 JniInterface.keyboardAction(event.getKeyCode(), depressed); | 99 JniInterface.keyboardAction(event.getKeyCode(), depressed); |
97 } | 100 } |
98 | 101 |
99 return super.dispatchKeyEvent(event); | 102 return super.dispatchKeyEvent(event); |
100 } | 103 } |
101 } | 104 } |
OLD | NEW |