title: How to detect landscape left (normal) vs landscape right (reverse) with support for naturally landscape devices?
body: <p>What I would like to do:</p>
  
  <ul>
  <li>Detect the current layout orientation of the device (Portrait, Landscape-Left, Portrait(upside down), Landscape-Right)</li>
  <li>Differentiate between the two possible landscape modes (leaning on the left side, leaning on the right side)</li>
  <li>Support devices that have landscape as their natural state (<a href="http://www.motorola.com/Consumers/US-EN/Consumer-Product-and-Services/Mobile-Phones/MOTOROLA-CHARM-with-MOTOBLUR-US-EN" rel="noreferrer">for example</a>, <a href="http://android-developers.blogspot.com/2010/09/one-screen-turn-deserves-another.html" rel="noreferrer">discussed here</a>)</li>
  <li>Support &lt; 2.2 (can't use <a href="http://developer.android.com/reference/android/view/Display.html#getRotation%28%29" rel="noreferrer">getRotation()</a>)</li>
  </ul>
  
  <p>Just to clarify, I want to know what orientation the layout is currently in.  Which direction is the bottom of the layout?  Is it in portrait?  Is it in landscape?  Is the landscape left or right? etc.</p>
  
  <p>The closest I can find is <a href="http://developer.android.com/reference/android/content/res/Configuration.html#orientation" rel="noreferrer">Activity.getResources().getConfiguration().orientation</a>, but it only returns three possible values. ORIENTATION_LANDSCAPE, ORIENTATION_PORTRAIT, or ORIENTATION_SQUARE.  It does not say which type of landscape.</p>
  
  <p>So, then I thought, well if I can get the orientation value (like 90, 180, 270, etc)  of the device and compare it to the above config value I could figure it out. For example, if the config value was ORIENTATION_LANDSCAPE and the orientation was 270, I could tell that it was in the reverse landscape mode.  However, there doesn't appear to be an easy way to get the orientation value.  I could implement an <a href="http://developer.android.com/reference/android/view/OrientationEventListener.html" rel="noreferrer">OrientationEventListener</a>, but that seems overkill since I just need to get the value once at a specific time, not constantly.</p>
  
  <p>There are two values in the Display class but <a href="http://developer.android.com/reference/android/view/Display.html#getOrientation%28%29" rel="noreferrer">getOrientation</a> is deprecated and <a href="http://developer.android.com/reference/android/view/Display.html#getRotation%28%29" rel="noreferrer">getRotation</a> is only available for 2.2 and above.</p>
  
  <p>Now, even if I did get this value, there is still the issue of devices that are naturally landscape. Meaning their 0 value would be landscape instead of portrait.  So I also need a sure way to tell which (landscape-left, landscape-right or portrait) corresponds to 0.</p>
  
  <p>There are a lot of posts on SO about orientation and similar issues, but I haven't seen any that take all of these issues into consideration.  Has anyone figured this out?</p>
  
  <p>When all is said and done I would like something like Activity.getResources().getConfiguration().orientation but be able to tell which landscape mode it is.</p>