Merge "Rotate screen when the R key is pressed."

This commit is contained in:
Makoto Onuki 2010-07-26 12:47:45 -07:00 committed by Android (Google) Code Review
commit f08b061ea8
1 changed files with 18 additions and 0 deletions

View File

@ -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);
}
}