package net.solutinno.util;

import android.content.Context;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;

public class DisplayHelper
{
    public static DisplayMetrics getDisplayMetrics(Context context) {
        WindowManager mgr = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        Display defaultDisplay = mgr.getDefaultDisplay();
        DisplayMetrics result = new DisplayMetrics();
        defaultDisplay.getMetrics(result);
        return result;
    }
}

@@ -54,16 +54,56 @@
 ontext;%0A
+import android.content.pm.ActivityInfo;%0A
 import a
@@ -159,16 +159,45 @@
 isplay;%0A
+import android.view.Surface;%0A
 import a
@@ -335,28 +335,33 @@
     
-WindowManager mgr
+final Display display
  = 
+(
 (Win
@@ -424,64 +424,81 @@
 ICE)
-;%0A        Display defaultDisplay = mgr.getDefaultDisplay
+).getDefaultDisplay();%0A        DisplayMetrics result = new DisplayMetrics
 ();%0A
@@ -509,70 +509,264 @@
     
-D
+d
 isplay
+.get
 Metrics
- result = new DisplayMetrics
+(result);%0A        return result;%0A    %7D%0A%0A    public static int getScreenRotation(Context context) %7B%0A%0A        final Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay
 ();%0A
+%0A 
        
- defaultD
+switch (d
 ispl
@@ -775,47 +775,551 @@
 .get
-Metrics(result);%0A        return result;
+Rotation()) %7B%0A            case Surface.ROTATION_0:%0A                return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;%0A            case Surface.ROTATION_90:%0A                return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;%0A            case Surface.ROTATION_180:%0A                return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;%0A            case Surface.ROTATION_270:%0A                return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;%0A            default:%0A                return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;%0A        %7D
 %0A   

Add getScreenRotation function to DisplayHelper