Chromium Code Reviews| Index: remoting/android/java/src/org/chromium/chromoting/Desktop.java |
| diff --git a/remoting/android/java/src/org/chromium/chromoting/Desktop.java b/remoting/android/java/src/org/chromium/chromoting/Desktop.java |
| index 8e0117aaf7b6fd4901d5e810f2a2ecf7e68f2e6b..91c9f4cdcbb5b1907e0c671294c8a22214258497 100644 |
| --- a/remoting/android/java/src/org/chromium/chromoting/Desktop.java |
| +++ b/remoting/android/java/src/org/chromium/chromoting/Desktop.java |
| @@ -18,7 +18,6 @@ import android.view.MotionEvent; |
| import android.view.View; |
| import android.view.View.OnLayoutChangeListener; |
| import android.view.View.OnTouchListener; |
| -import android.view.ViewGroup; |
| import android.view.inputmethod.InputMethodManager; |
| import org.chromium.chromoting.help.HelpContext; |
| @@ -29,6 +28,8 @@ import java.util.List; |
| /** |
| * A simple screen that does nothing except display a DesktopView and notify it of rotations. |
| + * It may be recreated for multiple times when the screen is rotated or the app is brought to the |
| + * background. |
|
joedow
2016/09/13 00:08:50
Since you removed the attach/detach methods and th
Yuwei
2016/09/13 01:42:26
Removed.
Actually this is the activity class...
|
| */ |
| public class Desktop |
| extends AppCompatActivity implements View.OnSystemUiVisibilityChangeListener, |
| @@ -77,6 +78,8 @@ public class Desktop |
| private CapabilityManager.HostCapability mHostTouchCapability = |
| CapabilityManager.HostCapability.UNKNOWN; |
| + private DesktopView mRemoteHostDesktop; |
| + |
| /** Called when the activity is first created. */ |
| @Override |
| public void onCreate(Bundle savedInstanceState) { |
| @@ -86,13 +89,13 @@ public class Desktop |
| mClient = Client.getInstance(); |
| mInjector = new InputEventSender(mClient); |
| + Preconditions.notNull(mClient); |
| + |
| mToolbar = (Toolbar) findViewById(R.id.toolbar); |
| setSupportActionBar(mToolbar); |
| - DesktopView remoteHostDesktop = mClient.createDesktopView(this, mClient); |
| - remoteHostDesktop.setLayoutParams(new ViewGroup.LayoutParams( |
| - ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); |
| - ((ViewGroup) findViewById(R.id.desktop_view_placeholder)).addView(remoteHostDesktop); |
| + mRemoteHostDesktop = (DesktopView) findViewById(R.id.desktop_view); |
| + mRemoteHostDesktop.init(mClient, this, mClient.getRenderStub()); |
| getSupportActionBar().setDisplayShowTitleEnabled(false); |
| getSupportActionBar().setDisplayHomeAsUpEnabled(true); |
| @@ -140,7 +143,7 @@ public class Desktop |
| } |
| }); |
| } else { |
| - remoteHostDesktop.setFitsSystemWindows(true); |
| + mRemoteHostDesktop.setFitsSystemWindows(true); |
| } |
| } |