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

Unified 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 side-by-side diff with in-line comments
Download patch
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);
}
}

Powered by Google App Engine
This is Rietveld 408576698