Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_UNSPECIFIED

List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_UNSPECIFIED

Introduction

In this page you can find the example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_UNSPECIFIED.

Prototype

int SCREEN_ORIENTATION_UNSPECIFIED

To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_UNSPECIFIED.

Click Source Link

Document

Constant corresponding to unspecified in the android.R.attr#screenOrientation attribute.

Usage

From source file:com.dm.material.dashboard.candybar.fragments.dialog.WallpaperSettingsFragment.java

@Override
public void onDismiss(DialogInterface dialog) {
    super.onDismiss(dialog);
    if (Preferences.getPreferences(getActivity()).isScrollWallpaper()) {
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    } else {//w  w  w  .  j av  a2 s .c  o m
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
}

From source file:com.coinblesk.client.ui.authview.AuthenticationDialog.java

@Override
public void onDestroy() {
    super.onDestroy();
    getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    if (listener != null) {
        listener.authViewDestroy();/*w  ww .ja  v  a2s  .  c  o m*/
    }

    getActivity().unbindService(serviceConnection);
}

From source file:org.apache.cordova.screenorientation.ScreenOrientation.java

public int getOrientation(String orientation) {
    if (orientation.equals(UNSPECIFIED)) {
        return (ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    } else if (orientation.equals(LANDSCAPE)) {
        return (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else if (orientation.equals(PORTRAIT)) {
        return (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else if (orientation.equals(USER)) {
        return (ActivityInfo.SCREEN_ORIENTATION_USER);
    } else if (orientation.equals(BEHIND)) {
        return (ActivityInfo.SCREEN_ORIENTATION_BEHIND);
    } else if (orientation.equals(SENSOR)) {
        return (ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    } else if (orientation.equals(NOSENSOR)) {
        return (ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    } else if (orientation.equals(SENSOR_LANDSCAPE)) {
        return (ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    } else if (orientation.equals(SENSOR_PORTRAIT)) {
        return (ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    } else if (orientation.equals(REVERSE_LANDSCAPE)) {
        return (ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
    } else if (orientation.equals(REVERSE_PORTRAIT)) {
        return (ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
    } else if (orientation.equals(FULL_SENSOR)) {
        return (ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
    }/* w  w w . ja v  a2  s  . co  m*/

    return (ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}

From source file:com.dm.wallpaper.board.fragments.dialogs.WallpaperSettingsFragment.java

@Override
public void onDismiss(DialogInterface dialog) {
    if (Preferences.get(getActivity()).isWallpaperCrop()) {
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else {//  w  w w .  j a v  a  2 s  . c  om
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }
    super.onDismiss(dialog);
}

From source file:de.sourcestream.movieDB.controller.GalleryPreviewDetail.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (activity.getSupportActionBar() != null && activity.getSupportActionBar().isShowing())
        activity.getSupportActionBar().hide();

    if (Build.VERSION.SDK_INT >= 19) {
        mUIFlag ^= View.SYSTEM_UI_FLAG_IMMERSIVE;
    }/*  w  ww. ja va2  s  .  c om*/

    if (this.isVisible()) {
        // Check orientation and lock to portrait if we are on phone
        if (getResources().getBoolean(R.bool.portrait_only)) {
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
        }
    }
    imageLoader.displayImage(currImg, mImageView, options, imageLoadingListener);
}

From source file:com.maxwen.wallpaper.board.fragments.dialogs.WallpaperApplyFragment.java

@Override
public void onDismiss(DialogInterface dialog) {
    if (Preferences.getPreferences(getActivity()).isScrollWallpaper()) {
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    } else {/*from   ww  w .  ja  v  a 2  s .com*/
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
    super.onDismiss(dialog);
}

From source file:free.rm.skytube.gui.activities.YouTubePlayerActivity.java

@Override
protected void onStart() {
    super.onStart();

    // set the video player's orientation as what the user wants
    String str = SkyTubeApp.getPreferenceManager().getString(getString(R.string.pref_key_screen_orientation),
            getString(R.string.pref_screen_auto_value));
    int orientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;

    if (str.equals(getString(R.string.pref_screen_landscape_value)))
        orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
    if (str.equals(getString(R.string.pref_screen_portrait_value)))
        orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
    if (str.equals(getString(R.string.pref_screen_sensor_value)))
        orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;

    setRequestedOrientation(orientation);
}

From source file:org.kontalk.util.SystemUtils.java

/**
 * Returns the correct screen orientation based on the supposedly preferred
 * position of the device./* w w w  .  ja  va 2s.  co m*/
 * http://stackoverflow.com/a/16585072/1045199
 */
public static int getScreenOrientation(Activity activity) {
    WindowManager windowManager = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE);
    Configuration configuration = activity.getResources().getConfiguration();
    int rotation = windowManager.getDefaultDisplay().getRotation();

    // Search for the natural position of the device
    if (configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
            && (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180)
            || configuration.orientation == Configuration.ORIENTATION_PORTRAIT
                    && (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270)) {
        // Natural position is Landscape
        switch (rotation) {
        case Surface.ROTATION_0:
            return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
        case Surface.ROTATION_90:
            return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
        case Surface.ROTATION_180:
            return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
        case Surface.ROTATION_270:
            return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
        }
    } else {
        // Natural position is Portrait
        switch (rotation) {
        case Surface.ROTATION_0:
            return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
        case Surface.ROTATION_90:
            return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
        case Surface.ROTATION_180:
            return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
        case Surface.ROTATION_270:
            return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
        }
    }

    return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
}

From source file:it.unicaradio.android.activities.MainActivity.java

private void decideAppOrientation() {
    if (getResources().getBoolean(R.bool.isTablet)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else {//from   w ww  .  j  a va  2  s.  c  o m
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }
}

From source file:free.rm.skytube.gui.activities.YouTubePlayerActivity.java

@Override
protected void onStop() {
    super.onStop();
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}