| 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.os.Build; | 8 import android.os.Build; |
| 9 import android.os.Bundle; | 9 import android.os.Bundle; |
| 10 import android.os.Handler; | 10 import android.os.Handler; |
| 11 import android.support.v7.app.ActionBar.OnMenuVisibilityListener; | 11 import android.support.v7.app.ActionBar.OnMenuVisibilityListener; |
| 12 import android.support.v7.app.AppCompatActivity; | 12 import android.support.v7.app.AppCompatActivity; |
| 13 import android.support.v7.widget.Toolbar; | 13 import android.support.v7.widget.Toolbar; |
| 14 import android.view.KeyEvent; | 14 import android.view.KeyEvent; |
| 15 import android.view.Menu; | 15 import android.view.Menu; |
| 16 import android.view.MenuItem; | 16 import android.view.MenuItem; |
| 17 import android.view.MotionEvent; | 17 import android.view.MotionEvent; |
| 18 import android.view.View; | 18 import android.view.View; |
| 19 import android.view.View.OnLayoutChangeListener; | 19 import android.view.View.OnLayoutChangeListener; |
| 20 import android.view.View.OnTouchListener; | 20 import android.view.View.OnTouchListener; |
| 21 import android.view.ViewGroup; | |
| 22 import android.view.inputmethod.InputMethodManager; | 21 import android.view.inputmethod.InputMethodManager; |
| 23 | 22 |
| 24 import org.chromium.chromoting.help.HelpContext; | 23 import org.chromium.chromoting.help.HelpContext; |
| 25 import org.chromium.chromoting.help.HelpSingleton; | 24 import org.chromium.chromoting.help.HelpSingleton; |
| 26 import org.chromium.chromoting.jni.Client; | 25 import org.chromium.chromoting.jni.Client; |
| 27 | 26 |
| 28 import java.util.List; | 27 import java.util.List; |
| 29 | 28 |
| 30 /** | 29 /** |
| 31 * A simple screen that does nothing except display a DesktopView and notify it
of rotations. | 30 * A simple screen that does nothing except display a DesktopView and notify it
of rotations. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 public void onCreate(Bundle savedInstanceState) { | 81 public void onCreate(Bundle savedInstanceState) { |
| 83 super.onCreate(savedInstanceState); | 82 super.onCreate(savedInstanceState); |
| 84 setContentView(R.layout.desktop); | 83 setContentView(R.layout.desktop); |
| 85 | 84 |
| 86 mClient = Client.getInstance(); | 85 mClient = Client.getInstance(); |
| 87 mInjector = new InputEventSender(mClient); | 86 mInjector = new InputEventSender(mClient); |
| 88 | 87 |
| 89 mToolbar = (Toolbar) findViewById(R.id.toolbar); | 88 mToolbar = (Toolbar) findViewById(R.id.toolbar); |
| 90 setSupportActionBar(mToolbar); | 89 setSupportActionBar(mToolbar); |
| 91 | 90 |
| 92 DesktopView remoteHostDesktop = mClient.createDesktopView(this, mClient)
; | 91 DesktopView remoteHostDesktop = (DesktopView) findViewById(R.id.desktop_
view); |
| 93 remoteHostDesktop.setLayoutParams(new ViewGroup.LayoutParams( | 92 remoteHostDesktop.init(this); |
| 94 ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATC
H_PARENT)); | 93 mClient.getRenderController().reset(this, remoteHostDesktop); |
| 95 ((ViewGroup) findViewById(R.id.desktop_view_placeholder)).addView(remote
HostDesktop); | |
| 96 | 94 |
| 97 getSupportActionBar().setDisplayShowTitleEnabled(false); | 95 getSupportActionBar().setDisplayShowTitleEnabled(false); |
| 98 getSupportActionBar().setDisplayHomeAsUpEnabled(true); | 96 getSupportActionBar().setDisplayHomeAsUpEnabled(true); |
| 99 | 97 |
| 100 // For this Activity, the home button in the action bar acts as a Discon
nect button, so | 98 // For this Activity, the home button in the action bar acts as a Discon
nect button, so |
| 101 // set the description for accessibility/screen readers. | 99 // set the description for accessibility/screen readers. |
| 102 getSupportActionBar().setHomeActionContentDescription(R.string.disconnec
t_myself_button); | 100 getSupportActionBar().setHomeActionContentDescription(R.string.disconnec
t_myself_button); |
| 103 | 101 |
| 104 // The action bar is already shown when the activity is started however
calling the | 102 // The action bar is already shown when the activity is started however
calling the |
| 105 // function below will set our preferred system UI flags which will adju
st the layout | 103 // function below will set our preferred system UI flags which will adju
st the layout |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 @Override | 531 @Override |
| 534 public boolean dispatchKeyEvent(KeyEvent event) { | 532 public boolean dispatchKeyEvent(KeyEvent event) { |
| 535 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { | 533 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { |
| 536 mClient.destroy(); | 534 mClient.destroy(); |
| 537 return super.dispatchKeyEvent(event); | 535 return super.dispatchKeyEvent(event); |
| 538 } | 536 } |
| 539 | 537 |
| 540 return mInjector.sendKeyEvent(event); | 538 return mInjector.sendKeyEvent(event); |
| 541 } | 539 } |
| 542 } | 540 } |
| OLD | NEW |