Chromium Code Reviews| 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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.res.Configuration; | 8 import android.content.res.Configuration; |
| 9 import android.os.Build; | 9 import android.os.Build; |
| 10 import android.os.Bundle; | 10 import android.os.Bundle; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 } | 63 } |
| 64 | 64 |
| 65 @Override | 65 @Override |
| 66 protected void onStart() { | 66 protected void onStart() { |
| 67 super.onStart(); | 67 super.onStart(); |
| 68 mActivityLifecycleListener.onActivityStarted(this); | 68 mActivityLifecycleListener.onActivityStarted(this); |
| 69 } | 69 } |
| 70 | 70 |
| 71 @Override | 71 @Override |
| 72 protected void onPause() { | 72 protected void onPause() { |
| 73 if (isFinishing()) { | 73 if (isFinishing()) { |
| 74 mActivityLifecycleListener.onActivityPaused(this); | 74 mActivityLifecycleListener.onActivityPaused(this); |
|
whywhat
2014/10/15 23:12:38
nit: fits on one line I think?
aurimas (slooooooooow)
2014/10/15 23:29:48
Done.
| |
| 75 } | 75 } |
| 76 super.onPause(); | 76 super.onPause(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 @Override | 79 @Override |
| 80 public void onResume() { | 80 public void onResume() { |
| 81 super.onResume(); | 81 super.onResume(); |
| 82 mActivityLifecycleListener.onActivityResumed(this); | 82 mActivityLifecycleListener.onActivityResumed(this); |
| 83 } | 83 } |
| 84 | 84 |
| 85 @Override | 85 @Override |
| 86 protected void onStop() { | 86 protected void onStop() { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 boolean pressed = event.getAction() == KeyEvent.ACTION_DOWN; | 245 boolean pressed = event.getAction() == KeyEvent.ACTION_DOWN; |
| 246 | 246 |
| 247 // For Enter getUnicodeChar() returns 10 (line feed), but we still | 247 // For Enter getUnicodeChar() returns 10 (line feed), but we still |
| 248 // want to send it as KeyEvent. | 248 // want to send it as KeyEvent. |
| 249 int unicode = keyCode != KeyEvent.KEYCODE_ENTER ? event.getUnicodeChar() : 0; | 249 int unicode = keyCode != KeyEvent.KEYCODE_ENTER ? event.getUnicodeChar() : 0; |
| 250 | 250 |
| 251 boolean no_modifiers = !event.isAltPressed() && | 251 boolean no_modifiers = !event.isAltPressed() && |
| 252 !event.isCtrlPressed() && !event.isMetaPressed(); | 252 !event.isCtrlPressed() && !event.isMetaPressed(); |
| 253 | 253 |
| 254 if (event.getDeviceId() == KeyCharacterMap.VIRTUAL_KEYBOARD && | 254 if (event.getDeviceId() == KeyCharacterMap.VIRTUAL_KEYBOARD && |
| 255 pressed && unicode != 0 && no_modifiers) { | 255 pressed && unicode != 0 && no_modifiers) { |
| 256 mPressedTextKeys.add(keyCode); | 256 mPressedTextKeys.add(keyCode); |
| 257 int[] codePoints = { unicode }; | 257 int[] codePoints = { unicode }; |
| 258 JniInterface.sendTextEvent(new String(codePoints, 0, 1)); | 258 JniInterface.sendTextEvent(new String(codePoints, 0, 1)); |
| 259 return true; | 259 return true; |
| 260 } | 260 } |
| 261 | 261 |
| 262 if (!pressed && mPressedTextKeys.contains(keyCode)) { | 262 if (!pressed && mPressedTextKeys.contains(keyCode)) { |
| 263 mPressedTextKeys.remove(keyCode); | 263 mPressedTextKeys.remove(keyCode); |
| 264 return true; | 264 return true; |
| 265 } | 265 } |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 284 JniInterface.sendKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT, pressed); | 284 JniInterface.sendKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT, pressed); |
| 285 JniInterface.sendKeyEvent(KeyEvent.KEYCODE_EQUALS, pressed); | 285 JniInterface.sendKeyEvent(KeyEvent.KEYCODE_EQUALS, pressed); |
| 286 return true; | 286 return true; |
| 287 | 287 |
| 288 default: | 288 default: |
| 289 // We try to send all other key codes to the host directly. | 289 // We try to send all other key codes to the host directly. |
| 290 return JniInterface.sendKeyEvent(keyCode, pressed); | 290 return JniInterface.sendKeyEvent(keyCode, pressed); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 } | 293 } |
| OLD | NEW |