List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE
int SCREEN_ORIENTATION_LANDSCAPE
To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE.
Click Source Link
landscape
in the android.R.attr#screenOrientation attribute. From source file:Main.java
public static void setOrientationHorizontal(Activity context) { context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }
From source file:Main.java
public static void setScreenHorizontal(Activity activity) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }
From source file:Main.java
public static void setRequestedOrientationLANDSCAPE(Activity act) { act.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }
From source file:Main.java
public static final void Window_setOrientationLandscape(Activity act) { act.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }
From source file:Main.java
public static void rotateScreen(Activity activity) { if (activity.getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else {/* w w w . j a va2s .c o m*/ activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } }
From source file:Main.java
public static void OrientationFix(Activity context, boolean fixOrient) { if (fixOrient) { int ori = context.getResources().getConfiguration().orientation; if (ori == Configuration.ORIENTATION_LANDSCAPE) { context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else {/* w w w. j a v a 2 s. c o m*/ context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } else { context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } }
From source file:Main.java
public static void initialize(Activity activity) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity); String orientation = prefs.getString("prefOrientation", "Null"); if ("Landscape".equals(orientation)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if ("Portrait".equals(orientation)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else {/*from w ww . ja va2s .co m*/ activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR); } }
From source file:Main.java
public static void initialize(Activity activity) { /** //from w w w .j a v a2 s. c o m *gets a SharedPreferences instance that points to the default file that is used by the preference framework */ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity); /** * used to store latest orientation of android device */ String orientation = prefs.getString("prefOrientation", "Null"); if ("Landscape".equals(orientation)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if ("Portrait".equals(orientation)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR); } }
From source file:Main.java
private static void rotateToLandscape(Activity activity) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }
From source file:Main.java
public static void lockOrientation(Activity activity) { Display display = ((WindowManager) activity.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int rotation = display.getRotation(); int tempOrientation = activity.getResources().getConfiguration().orientation; int orientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; switch (tempOrientation) { case Configuration.ORIENTATION_LANDSCAPE: if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90) orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; else// w w w . j a va 2s .c o m orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; break; case Configuration.ORIENTATION_PORTRAIT: if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_270) orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; else orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; } activity.setRequestedOrientation(orientation); }