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

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

Issue 451973002: Capabilities + Extensions + Cast Host Extension Support for Android client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor Fix Created 6 years, 4 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 f40469f8360370d89d2e31dbd06ea44449602078..f6b4d2605d06e035729f2f986196708d2e3d597c 100644
--- a/remoting/android/java/src/org/chromium/chromoting/Desktop.java
+++ b/remoting/android/java/src/org/chromium/chromoting/Desktop.java
@@ -5,10 +5,10 @@
package org.chromium.chromoting;
import android.annotation.SuppressLint;
-import android.app.Activity;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
+import android.support.v7.app.ActionBarActivity;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.Menu;
@@ -25,7 +25,7 @@ import java.util.TreeSet;
/**
* A simple screen that does nothing except display a DesktopView and notify it of rotations.
*/
-public class Desktop extends Activity implements View.OnSystemUiVisibilityChangeListener {
+public class Desktop extends ActionBarActivity implements View.OnSystemUiVisibilityChangeListener {
/** Web page to be displayed in the Help screen when launched from this activity. */
private static final String HELP_URL =
"http://support.google.com/chrome/?p=mobile_crd_connecthost";
@@ -39,6 +39,9 @@ public class Desktop extends Activity implements View.OnSystemUiVisibilityChange
/** Set of pressed keys for which we've sent TextEvent. */
private Set<Integer> mPressedTextKeys = new TreeSet<Integer>();
+ private ActivityLifecycleListener mActivityLifecycleListener;
+
+
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -53,6 +56,36 @@ public class Desktop extends Activity implements View.OnSystemUiVisibilityChange
View decorView = getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener(this);
+
+ mActivityLifecycleListener = CapabilityManager.getInstance()
+ .onActivityAcceptingListener(this, Capabilities.CAST_CAPABILITY);
+ mActivityLifecycleListener.onActivityCreated(this, savedInstanceState);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ mActivityLifecycleListener.onActivityStarted(this);
+ }
+
+ @Override
+ protected void onPause() {
+ if (isFinishing()) {
+ mActivityLifecycleListener.onActivityPaused(this);
+ }
+ super.onPause();
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ mActivityLifecycleListener.onActivityResumed(this);
+ }
+
+ @Override
+ protected void onStop() {
+ mActivityLifecycleListener.onActivityStopped(this);
+ super.onStop();
}
/** Called when the activity is finally finished. */
@@ -73,6 +106,9 @@ public class Desktop extends Activity implements View.OnSystemUiVisibilityChange
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.desktop_actionbar, menu);
+
+ mActivityLifecycleListener.onActivityCreatedOptionsMenu(this, menu);
+
return super.onCreateOptionsMenu(menu);
}
@@ -144,6 +180,9 @@ public class Desktop extends Activity implements View.OnSystemUiVisibilityChange
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
+
+ mActivityLifecycleListener.onActivityOptionsItemSelected(this, item);
+
if (id == R.id.actionbar_keyboard) {
((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).toggleSoftInput(0, 0);
return true;

Powered by Google App Engine
This is Rietveld 408576698