| 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 d301c092e2e80229faa42473e1fd7b1018e0333c..ea6d7d26637fcbbda166de4eb2469fb76d1fa415 100644
|
| --- a/remoting/android/java/src/org/chromium/chromoting/Desktop.java
|
| +++ b/remoting/android/java/src/org/chromium/chromoting/Desktop.java
|
| @@ -5,10 +5,12 @@
|
| 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;
|
| @@ -17,15 +19,13 @@ import android.view.View;
|
| import android.view.inputmethod.InputMethodManager;
|
| import android.widget.ImageButton;
|
|
|
| -import org.chromium.chromoting.jni.JniInterface;
|
| -
|
| import java.util.Set;
|
| 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,39 @@ 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 +109,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);
|
| }
|
|
|
| @@ -143,6 +182,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;
|
|
|