@Test public void getOrientation_whenLandscape_shouldReturnLandscape() { testResources.getConfiguration().orientation = Configuration.ORIENTATION_LANDSCAPE; MoPubShadowDisplay.setStaticRotation(Surface.ROTATION_90); assertThat(DeviceUtils.getScreenOrientation(testActivity)).isEqualTo(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }
public static int getScreenOrientation(@NonNull final Activity activity) { final int rotation = activity.getWindowManager().getDefaultDisplay().getRotation(); final int deviceOrientation = activity.getResources().getConfiguration().orientation; return getScreenOrientationFromRotationAndOrientation(rotation, deviceOrientation); }
DeviceUtils { public static int getScreenOrientation(@NonNull final Activity activity) { final int rotation = activity.getWindowManager().getDefaultDisplay().getRotation(); final int deviceOrientation = activity.getResources().getConfiguration().orientation; return getScreenOrientationFromRotationAndOrientation(rotation, deviceOrientation); } }
DeviceUtils { public static int getScreenOrientation(@NonNull final Activity activity) { final int rotation = activity.getWindowManager().getDefaultDisplay().getRotation(); final int deviceOrientation = activity.getResources().getConfiguration().orientation; return getScreenOrientationFromRotationAndOrientation(rotation, deviceOrientation); } private  DeviceUtils(); }
DeviceUtils { public static int getScreenOrientation(@NonNull final Activity activity) { final int rotation = activity.getWindowManager().getDefaultDisplay().getRotation(); final int deviceOrientation = activity.getResources().getConfiguration().orientation; return getScreenOrientationFromRotationAndOrientation(rotation, deviceOrientation); } private  DeviceUtils(); static String getIpAddress(IP ip); static String getHashedUdid(final Context context); static boolean isNetworkAvailable(@Nullable final Context context); static int memoryCacheSizeBytes(final Context context); static long diskCacheSizeBytes(File dir, long minSize); static long diskCacheSizeBytes(File dir); static int getScreenOrientation(@NonNull final Activity activity); static void lockOrientation(@NonNull Activity activity, @NonNull CreativeOrientation creativeOrientation); @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) static Point getDeviceDimensions(@NonNull final Context context); }
DeviceUtils { public static int getScreenOrientation(@NonNull final Activity activity) { final int rotation = activity.getWindowManager().getDefaultDisplay().getRotation(); final int deviceOrientation = activity.getResources().getConfiguration().orientation; return getScreenOrientationFromRotationAndOrientation(rotation, deviceOrientation); } private  DeviceUtils(); static String getIpAddress(IP ip); static String getHashedUdid(final Context context); static boolean isNetworkAvailable(@Nullable final Context context); static int memoryCacheSizeBytes(final Context context); static long diskCacheSizeBytes(File dir, long minSize); static long diskCacheSizeBytes(File dir); static int getScreenOrientation(@NonNull final Activity activity); static void lockOrientation(@NonNull Activity activity, @NonNull CreativeOrientation creativeOrientation); @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) static Point getDeviceDimensions(@NonNull final Context context);  }