| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 /** Called when the activity is first created. */ | 45 /** Called when the activity is first created. */ |
| 46 @Override | 46 @Override |
| 47 public void onCreate(Bundle savedInstanceState) { | 47 public void onCreate(Bundle savedInstanceState) { |
| 48 super.onCreate(savedInstanceState); | 48 super.onCreate(savedInstanceState); |
| 49 setContentView(R.layout.desktop); | 49 setContentView(R.layout.desktop); |
| 50 mRemoteHostDesktop = (DesktopView) findViewById(R.id.desktop_view); | 50 mRemoteHostDesktop = (DesktopView) findViewById(R.id.desktop_view); |
| 51 mOverlayButton = (ImageButton) findViewById(R.id.desktop_overlay_button)
; | 51 mOverlayButton = (ImageButton) findViewById(R.id.desktop_overlay_button)
; |
| 52 mRemoteHostDesktop.setDesktop(this); | 52 mRemoteHostDesktop.setDesktop(this); |
| 53 | 53 |
| 54 // Ensure the button is initially hidden. | 54 // For this Activity, the home button in the action bar acts as a Discon
nect button, so |
| 55 // set the description for accessibility/screen readers. |
| 56 getSupportActionBar().setHomeActionContentDescription(R.string.disconnec
t_myself_button); |
| 57 |
| 58 // Ensure the overlay button is initially hidden. |
| 55 showActionBar(); | 59 showActionBar(); |
| 56 | 60 |
| 57 View decorView = getWindow().getDecorView(); | 61 View decorView = getWindow().getDecorView(); |
| 58 decorView.setOnSystemUiVisibilityChangeListener(this); | 62 decorView.setOnSystemUiVisibilityChangeListener(this); |
| 59 | 63 |
| 60 mActivityLifecycleListener = CapabilityManager.getInstance() | 64 mActivityLifecycleListener = CapabilityManager.getInstance() |
| 61 .onActivityAcceptingListener(this, Capabilities.CAST_CAPABILITY); | 65 .onActivityAcceptingListener(this, Capabilities.CAST_CAPABILITY); |
| 62 mActivityLifecycleListener.onActivityCreated(this, savedInstanceState); | 66 mActivityLifecycleListener.onActivityCreated(this, savedInstanceState); |
| 63 } | 67 } |
| 64 | 68 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 mActivityLifecycleListener.onActivityOptionsItemSelected(this, item); | 190 mActivityLifecycleListener.onActivityOptionsItemSelected(this, item); |
| 187 | 191 |
| 188 if (id == R.id.actionbar_keyboard) { | 192 if (id == R.id.actionbar_keyboard) { |
| 189 ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).toggle
SoftInput(0, 0); | 193 ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).toggle
SoftInput(0, 0); |
| 190 return true; | 194 return true; |
| 191 } | 195 } |
| 192 if (id == R.id.actionbar_hide) { | 196 if (id == R.id.actionbar_hide) { |
| 193 hideActionBar(); | 197 hideActionBar(); |
| 194 return true; | 198 return true; |
| 195 } | 199 } |
| 196 if (id == R.id.actionbar_disconnect) { | 200 if (id == R.id.actionbar_disconnect || id == android.R.id.home) { |
| 197 JniInterface.disconnectFromHost(); | 201 JniInterface.disconnectFromHost(); |
| 198 return true; | 202 return true; |
| 199 } | 203 } |
| 200 if (id == R.id.actionbar_send_ctrl_alt_del) { | 204 if (id == R.id.actionbar_send_ctrl_alt_del) { |
| 201 int[] keys = { | 205 int[] keys = { |
| 202 KeyEvent.KEYCODE_CTRL_LEFT, | 206 KeyEvent.KEYCODE_CTRL_LEFT, |
| 203 KeyEvent.KEYCODE_ALT_LEFT, | 207 KeyEvent.KEYCODE_ALT_LEFT, |
| 204 KeyEvent.KEYCODE_FORWARD_DEL, | 208 KeyEvent.KEYCODE_FORWARD_DEL, |
| 205 }; | 209 }; |
| 206 for (int key : keys) { | 210 for (int key : keys) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 JniInterface.sendKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT, pressed); | 290 JniInterface.sendKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT, pressed); |
| 287 JniInterface.sendKeyEvent(KeyEvent.KEYCODE_EQUALS, pressed); | 291 JniInterface.sendKeyEvent(KeyEvent.KEYCODE_EQUALS, pressed); |
| 288 return true; | 292 return true; |
| 289 | 293 |
| 290 default: | 294 default: |
| 291 // We try to send all other key codes to the host directly. | 295 // We try to send all other key codes to the host directly. |
| 292 return JniInterface.sendKeyEvent(keyCode, pressed); | 296 return JniInterface.sendKeyEvent(keyCode, pressed); |
| 293 } | 297 } |
| 294 } | 298 } |
| 295 } | 299 } |
| OLD | NEW |