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 29 matching lines...) Expand all Loading... |
40 private Set<Integer> mPressedTextKeys = new TreeSet<Integer>(); | 40 private Set<Integer> mPressedTextKeys = new TreeSet<Integer>(); |
41 | 41 |
42 private ActivityLifecycleListener mActivityLifecycleListener; | 42 private ActivityLifecycleListener mActivityLifecycleListener; |
43 | 43 |
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 // Ensure the button is initially hidden. |
55 showActionBar(); | 55 showActionBar(); |
56 | 56 |
57 View decorView = getWindow().getDecorView(); | 57 View decorView = getWindow().getDecorView(); |
58 decorView.setOnSystemUiVisibilityChangeListener(this); | 58 decorView.setOnSystemUiVisibilityChangeListener(this); |
59 | 59 |
60 mActivityLifecycleListener = CapabilityManager.getInstance() | 60 mActivityLifecycleListener = CapabilityManager.getInstance() |
61 .onActivityAcceptingListener(this, Capabilities.CAST_CAPABILITY); | 61 .onActivityAcceptingListener(this, Capabilities.CAST_CAPABILITY); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 } | 177 } |
178 | 178 |
179 /** Called whenever an action bar button is pressed. */ | 179 /** Called whenever an action bar button is pressed. */ |
180 @Override | 180 @Override |
181 public boolean onOptionsItemSelected(MenuItem item) { | 181 public boolean onOptionsItemSelected(MenuItem item) { |
182 int id = item.getItemId(); | 182 int id = item.getItemId(); |
183 | 183 |
184 mActivityLifecycleListener.onActivityOptionsItemSelected(this, item); | 184 mActivityLifecycleListener.onActivityOptionsItemSelected(this, item); |
185 | 185 |
186 if (id == R.id.actionbar_keyboard) { | 186 if (id == R.id.actionbar_keyboard) { |
187 ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).toggleS
oftInput(0, 0); | 187 ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).toggle
SoftInput(0, 0); |
188 return true; | 188 return true; |
189 } | 189 } |
190 if (id == R.id.actionbar_hide) { | 190 if (id == R.id.actionbar_hide) { |
191 hideActionBar(); | 191 hideActionBar(); |
192 return true; | 192 return true; |
193 } | 193 } |
194 if (id == R.id.actionbar_disconnect) { | 194 if (id == R.id.actionbar_disconnect) { |
195 JniInterface.disconnectFromHost(); | 195 JniInterface.disconnectFromHost(); |
196 return true; | 196 return true; |
197 } | 197 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |