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 f40469f8360370d89d2e31dbd06ea44449602078..086b0caa54e0ab8422929e08e6e28b672d1f3c8c 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; |
| + |
|
Lambros
2014/08/14 23:54:25
nit: remove blank lines
aiguha
2014/08/15 03:37:29
Done.
|
| +import android.support.v7.app.ActionBarActivity; |
| + |
| import android.view.KeyCharacterMap; |
| import android.view.KeyEvent; |
| import android.view.Menu; |
| @@ -25,7 +27,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 +41,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 +58,39 @@ public class Desktop extends Activity implements View.OnSystemUiVisibilityChange |
| View decorView = getWindow().getDecorView(); |
| decorView.setOnSystemUiVisibilityChangeListener(this); |
| + |
| + |
|
Lambros
2014/08/14 23:54:25
nit: only one blank line
aiguha
2014/08/15 03:37:30
Done.
|
| + |
| + mActivityLifecycleListener = CapabilityManager.getInstance() |
| + .onActivityAcceptingListener(this, Capabilities.CAST_CAPABILITY); |
| + mActivityLifecycleListener.onActivityCreated(this, savedInstanceState); |
| + } |
| + |
|
Lambros
2014/08/14 23:54:25
nit: only one blank line
aiguha
2014/08/15 03:37:29
Done.
|
| + |
| + @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 +111,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 +185,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; |