From 0f6e1c9e4981bbb3c959ec64fdeb297223d07e90 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Mon, 26 Jul 2010 11:14:09 -0700 Subject: [PATCH] Rotate screen when the R key is pressed. Workaround for auto-orientation not working on the device (bug 2865868). Change-Id: Ie1e7c802c0c816338aea1f56f6e86991df241f3b --- .../android/email/activity/MessageListXL.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/com/android/email/activity/MessageListXL.java b/src/com/android/email/activity/MessageListXL.java index ef0e225a2..fe1a90f36 100644 --- a/src/com/android/email/activity/MessageListXL.java +++ b/src/com/android/email/activity/MessageListXL.java @@ -25,8 +25,10 @@ import android.app.FragmentTransaction; import android.app.LoaderManager.LoaderCallbacks; import android.content.Context; import android.content.Loader; +import android.content.pm.ActivityInfo; import android.os.Bundle; import android.util.Log; +import android.view.KeyEvent; import android.view.View; import java.util.ArrayList; @@ -464,4 +466,20 @@ public class MessageListXL extends Activity implements View.OnClickListener { } return false; } + + /** + * STOPSHIP: Remove this. + * Rotate screen when the R key is pressed. Workaround for auto-orientation not working. + */ + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_R) { + setRequestedOrientation( + (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) + ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + : ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); + return true; + } + return super.onKeyDown(keyCode, event); + } }