| 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 36b6f74ba9bd5da3d9c73a6668da70a23b9f3b13..7c8bb1141e858c8e2420deea72990f18d49c3879 100644
|
| --- a/remoting/android/java/src/org/chromium/chromoting/Desktop.java
|
| +++ b/remoting/android/java/src/org/chromium/chromoting/Desktop.java
|
| @@ -7,6 +7,12 @@ package org.chromium.chromoting;
|
| import android.app.Activity;
|
| import android.content.res.Configuration;
|
| import android.os.Bundle;
|
| +import android.util.Log;
|
| +import android.view.KeyEvent;
|
| +import android.view.Menu;
|
| +import android.view.MenuItem;
|
| +import android.view.WindowManager;
|
| +import android.view.inputmethod.InputMethodManager;
|
|
|
| import org.chromium.chromoting.jni.JniInterface;
|
|
|
| @@ -14,7 +20,7 @@ import org.chromium.chromoting.jni.JniInterface;
|
| * A simple screen that does nothing except display a DesktopView and notify it of rotations.
|
| */
|
| public class Desktop extends Activity {
|
| - /** Whether the device has just been rotated. */
|
| + /** The surface that displays the remote host's desktop feed. */
|
| private DesktopView remoteHostDesktop;
|
|
|
| /** Called when the activity is first created. */
|
| @@ -36,6 +42,41 @@ public class Desktop extends Activity {
|
| @Override
|
| public void onConfigurationChanged(Configuration newConfig) {
|
| super.onConfigurationChanged(newConfig);
|
| - remoteHostDesktop.requestCanvasRedraw();
|
| + remoteHostDesktop.requestRecheckConstrainingDimension();
|
| + }
|
| +
|
| + /** Called to initialize the action bar. */
|
| + @Override
|
| + public boolean onCreateOptionsMenu(Menu menu) {
|
| + getMenuInflater().inflate(R.menu.actionbar, menu);
|
| + return super.onCreateOptionsMenu(menu);
|
| + }
|
| +
|
| + /** Called whenever an action bar button is pressed. */
|
| + @Override
|
| + public boolean onOptionsItemSelected(MenuItem item) {
|
| + switch (item.getItemId()) {
|
| + case R.id.actionbar_keyboard:
|
| + ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).toggleSoftInput(0, 0);
|
| + return true;
|
| + case R.id.actionbar_hide:
|
| + getActionBar().hide();
|
| + return true;
|
| + default:
|
| + return super.onOptionsItemSelected(item);
|
| + }
|
| + }
|
| +
|
| + /** Called when a hardware key is pressed, and usually when a software key is pressed. */
|
| + @Override
|
| + public boolean dispatchKeyEvent(KeyEvent event) {
|
| + JniInterface.keyboardAction(event.getKeyCode(), event.getAction() == KeyEvent.ACTION_DOWN);
|
| +
|
| + if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
|
| + // We stop this event from propagating further to prevent the keyboard from closing.
|
| + return true;
|
| + }
|
| +
|
| + return super.dispatchKeyEvent(event);
|
| }
|
| }
|
|
|