Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/Desktop.java

Issue 2322623002: [Remoting Android] Refactor GlDesktopView (Closed)
Patch Set: Reviewer's Feedback Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 /** The Toolbar instance backing our SupportActionBar. */ 69 /** The Toolbar instance backing our SupportActionBar. */
71 private Toolbar mToolbar; 70 private Toolbar mToolbar;
72 71
73 /** Tracks the current input mode (e.g. trackpad/touch). */ 72 /** Tracks the current input mode (e.g. trackpad/touch). */
74 private InputMode mInputMode = InputMode.UNKNOWN; 73 private InputMode mInputMode = InputMode.UNKNOWN;
75 74
76 /** Indicates whether the remote host supports touch injection. */ 75 /** Indicates whether the remote host supports touch injection. */
77 private CapabilityManager.HostCapability mHostTouchCapability = 76 private CapabilityManager.HostCapability mHostTouchCapability =
78 CapabilityManager.HostCapability.UNKNOWN; 77 CapabilityManager.HostCapability.UNKNOWN;
79 78
79 private DesktopView mRemoteHostDesktop;
80
80 /** Called when the activity is first created. */ 81 /** Called when the activity is first created. */
81 @Override 82 @Override
82 public void onCreate(Bundle savedInstanceState) { 83 public void onCreate(Bundle savedInstanceState) {
83 super.onCreate(savedInstanceState); 84 super.onCreate(savedInstanceState);
84 setContentView(R.layout.desktop); 85 setContentView(R.layout.desktop);
85 86
86 mClient = Client.getInstance(); 87 mClient = Client.getInstance();
87 mInjector = new InputEventSender(mClient); 88 mInjector = new InputEventSender(mClient);
88 89
90 Preconditions.notNull(mClient);
91
89 mToolbar = (Toolbar) findViewById(R.id.toolbar); 92 mToolbar = (Toolbar) findViewById(R.id.toolbar);
90 setSupportActionBar(mToolbar); 93 setSupportActionBar(mToolbar);
91 94
92 DesktopView remoteHostDesktop = mClient.createDesktopView(this, mClient) ; 95 mRemoteHostDesktop = (DesktopView) findViewById(R.id.desktop_view);
93 remoteHostDesktop.setLayoutParams(new ViewGroup.LayoutParams( 96 mRemoteHostDesktop.init(mClient, this, mClient.getRenderStub());
94 ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATC H_PARENT));
95 ((ViewGroup) findViewById(R.id.desktop_view_placeholder)).addView(remote HostDesktop);
96 97
97 getSupportActionBar().setDisplayShowTitleEnabled(false); 98 getSupportActionBar().setDisplayShowTitleEnabled(false);
98 getSupportActionBar().setDisplayHomeAsUpEnabled(true); 99 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
99 100
100 // For this Activity, the home button in the action bar acts as a Discon nect button, so 101 // 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. 102 // set the description for accessibility/screen readers.
102 getSupportActionBar().setHomeActionContentDescription(R.string.disconnec t_myself_button); 103 getSupportActionBar().setHomeActionContentDescription(R.string.disconnec t_myself_button);
103 104
104 // The action bar is already shown when the activity is started however calling the 105 // 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 106 // function below will set our preferred system UI flags which will adju st the layout
(...skipping 27 matching lines...) Expand all
133 getSupportActionBar().addOnMenuVisibilityListener(new OnMenuVisibili tyListener() { 134 getSupportActionBar().addOnMenuVisibilityListener(new OnMenuVisibili tyListener() {
134 public void onMenuVisibilityChanged(boolean isVisible) { 135 public void onMenuVisibilityChanged(boolean isVisible) {
135 if (isVisible) { 136 if (isVisible) {
136 stopActionBarAutoHideTimer(); 137 stopActionBarAutoHideTimer();
137 } else { 138 } else {
138 startActionBarAutoHideTimer(); 139 startActionBarAutoHideTimer();
139 } 140 }
140 } 141 }
141 }); 142 });
142 } else { 143 } else {
143 remoteHostDesktop.setFitsSystemWindows(true); 144 mRemoteHostDesktop.setFitsSystemWindows(true);
144 } 145 }
145 } 146 }
146 147
147 @Override 148 @Override
148 protected void onStart() { 149 protected void onStart() {
149 super.onStart(); 150 super.onStart();
150 mActivityLifecycleListener.onActivityStarted(this); 151 mActivityLifecycleListener.onActivityStarted(this);
151 mClient.enableVideoChannel(true); 152 mClient.enableVideoChannel(true);
152 mClient.getCapabilityManager().addListener(this); 153 mClient.getCapabilityManager().addListener(this);
153 } 154 }
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 @Override 534 @Override
534 public boolean dispatchKeyEvent(KeyEvent event) { 535 public boolean dispatchKeyEvent(KeyEvent event) {
535 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { 536 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
536 mClient.destroy(); 537 mClient.destroy();
537 return super.dispatchKeyEvent(event); 538 return super.dispatchKeyEvent(event);
538 } 539 }
539 540
540 return mInjector.sendKeyEvent(event); 541 return mInjector.sendKeyEvent(event);
541 } 542 }
542 } 543 }
OLDNEW
« no previous file with comments | « remoting/android/java/res/layout/desktop.xml ('k') | remoting/android/java/src/org/chromium/chromoting/DesktopCanvas.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698