Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_REVERSE_LANDSCAPE

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

Introduction

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

Prototype

int SCREEN_ORIENTATION_REVERSE_LANDSCAPE

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

Click Source Link

Document

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

Usage

From source file:RhodesService.java

public static Object getProperty(String name) {
    try {//from   w  ww.  j  a v  a  2  s. c  om
        if (name.equalsIgnoreCase("platform"))
            return "ANDROID";
        else if (name.equalsIgnoreCase("locale"))
            return getCurrentLocale();
        else if (name.equalsIgnoreCase("country"))
            return getCurrentCountry();
        else if (name.equalsIgnoreCase("screen_width"))
            return Integer.valueOf(getScreenWidth());
        else if (name.equalsIgnoreCase("screen_height"))
            return Integer.valueOf(getScreenHeight());
        else if (name.equalsIgnoreCase("screen_orientation")) {
            int orientation = getScreenOrientation();
            if ((orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
                    || (orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE))
                return "landscape";
            else
                return "portrait";
        } else if (name.equalsIgnoreCase("has_network"))
            return Boolean.valueOf(hasNetwork());
        else if (name.equalsIgnoreCase("has_wifi_network"))
            return Boolean.valueOf(hasWiFiNetwork());
        else if (name.equalsIgnoreCase("has_cell_network"))
            return Boolean.valueOf(hasCellNetwork());
        else if (name.equalsIgnoreCase("ppi_x"))
            return Float.valueOf(getScreenPpiX());
        else if (name.equalsIgnoreCase("ppi_y"))
            return Float.valueOf(getScreenPpiY());
        else if (name.equalsIgnoreCase("phone_number")) {
            Context context = ContextFactory.getContext();
            String number = "";
            if (context != null) {
                TelephonyManager manager = (TelephonyManager) context
                        .getSystemService(Context.TELEPHONY_SERVICE);
                number = manager.getLine1Number();
                Logger.I(TAG, "Phone number: " + number + "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
            }
            return number;
        } else if (name.equalsIgnoreCase("device_owner_name")) {
            return AndroidFunctionalityManager.getAndroidFunctionality()
                    .AccessOwnerInfo_getUsername(getContext());
        } else if (name.equalsIgnoreCase("device_owner_email")) {
            return AndroidFunctionalityManager.getAndroidFunctionality().AccessOwnerInfo_getEmail(getContext());
        } else if (name.equalsIgnoreCase("device_name")) {
            return Build.MANUFACTURER + " " + Build.DEVICE;
        } else if (name.equalsIgnoreCase("is_emulator")) {
            String strDevice = Build.DEVICE;
            return Boolean.valueOf(strDevice != null && strDevice.equalsIgnoreCase("generic"));
        } else if (name.equalsIgnoreCase("os_version")) {
            return Build.VERSION.RELEASE;
        } else if (name.equalsIgnoreCase("has_calendar")) {
            return Boolean.valueOf(EventStore.hasCalendar());
        } else if (name.equalsIgnoreCase("phone_id")) {
            RhodesService service = RhodesService.getInstance();
            if (service != null) {
                PhoneId phoneId = service.getPhoneId();
                return phoneId.toString();
            } else {
                return "";
            }
        } else if (name.equalsIgnoreCase("webview_framework")) {
            return RhodesActivity.safeGetInstance().getMainView().getWebView(-1).getEngineId();
        } else if (name.equalsIgnoreCase("is_motorola_device")) {
            return isMotorolaDevice();
        } else if (name.equalsIgnoreCase("oem_info")) {
            return Build.PRODUCT;
        } else if (name.equalsIgnoreCase("uuid")) {
            return fetchUUID();
        } else if (name.equalsIgnoreCase("has_camera")) {
            return Boolean.TRUE;
        } else {
            return RhoExtManager.getImplementationInstance().getProperty(name);
        }
    } catch (Exception e) {
        Logger.E(TAG, "Can't get property \"" + name + "\": " + e);
    }

    return null;
}

From source file:com.mantz_it.rfanalyzer.ui.activity.MainActivity.java

/**
 * Will check if any preference conflicts with the current state of the app and fix it
 *///from  www.ja  v  a2  s  .c  om
public void checkForChangedPreferences() {
    int sourceType = Integer.parseInt(preferences.getString(getString(R.string.pref_sourceType), "1"));
    /* todo: rework settings repository, so we could use reflection to instantiate source instead of hardcoded switch */
    /* todo dependency injection*/
    if (source != null) {
        switch (sourceType) {
        case FILE_SOURCE:
            updateSourcePreferences(FileIQSource.class);
            break;
        case HACKRF_SOURCE:
            updateSourcePreferences(HackrfSource.class);
            break;
        case RTLSDR_SOURCE:
            updateSourcePreferences(RtlsdrSource.class);
            break;
        case HIQSDR_SOURCE:
            updateSourcePreferences(HiqsdrSource.class);
            break;
        default:
            Log.e(LOGTAG,
                    "checkForChangedPreferences: selected source type (" + sourceType + "is not supported");
        }
    }

    if (analyzerSurface != null) {
        onPreferencesChanged(analyzerSurface, preferences);

    }

    // Screen Orientation:
    String screenOrientation = preferences.getString(getString(R.string.pref_screenOrientation), "auto")
            .toLowerCase();
    int orientation;
    switch (screenOrientation) {
    case "landscape":
        orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
        break;
    case "portrait":
        orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
        break;
    case "reverse_landscape":
        orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
        break;
    case "reverse_portrait":
        orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
        break;
    default:
    case "auto":
        orientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
        break;
    }
    setRequestedOrientation(orientation);
}

From source file:com.nbplus.vbroadlauncher.fragment.LauncherFragment.java

private void setContentViewByOrientation() {
    int orientation = DisplayUtils.getScreenOrientation(getActivity());
    LinearLayout.LayoutParams lp;/*from   w w  w  .  ja v  a 2 s  .co  m*/
    float marginDp = 0f;
    float marginPx = 0f;

    if (orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
            || orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) {
        mMainViewLayout.setOrientation(LinearLayout.HORIZONTAL);

        lp = (LinearLayout.LayoutParams) mMainViewLeftPanel.getLayoutParams();
        lp.weight = 0.6f;
        marginDp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_panel_margin);
        marginPx = DisplayUtils.pxFromDp(getActivity(), marginDp);
        lp.setMargins(0, 0, (int) marginPx, 0);
        mMainViewLeftPanel.setLayoutParams(lp);
        lp = (LinearLayout.LayoutParams) mMainViewRightPanel.getLayoutParams();
        lp.weight = 0.4f;
        lp.setMargins(0, 0, 0, 0);
        mMainViewRightPanel.setLayoutParams(lp);
    } else {
        mMainViewLayout.setOrientation(LinearLayout.VERTICAL);

        lp = (LinearLayout.LayoutParams) mMainViewLeftPanel.getLayoutParams();
        lp.weight = 1.0f;
        marginDp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_panel_margin);
        marginPx = DisplayUtils.pxFromDp(getActivity(), marginDp);
        lp.setMargins(0, 0, 0, (int) marginPx);
        mMainViewLeftPanel.setLayoutParams(lp);
        lp = (LinearLayout.LayoutParams) mMainViewRightPanel.getLayoutParams();
        lp.weight = 1.0f;
        lp.setMargins(0, 0, 0, 0);
        mMainViewRightPanel.setLayoutParams(lp);
    }
    lp = (LinearLayout.LayoutParams) mMainViewLayout.getLayoutParams();

    float heightDp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_main_view_margin_top);
    float px = DisplayUtils.pxFromDp(getActivity(), heightDp);
    float horizontalMarginDp = DisplayUtils.getDimension(getActivity(),
            R.dimen.launcher_main_view_margin_horizontal);
    float horizontalMarginPx = DisplayUtils.pxFromDp(getActivity(), horizontalMarginDp);

    lp.setMargins((int) horizontalMarginPx, (int) px, (int) horizontalMarginPx, lp.bottomMargin);
    mMainViewLayout.setLayoutParams(lp);

    float dp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_clock_height);
    px = DisplayUtils.pxFromDp(getActivity(), dp);
    mTextClock.setTextSize(px);
    mWeatherView.onConfigurationChanged(orientation);

    // right shortcut menu
    dp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_ic_menu_main_shortcut_width);
    float widthPx = DisplayUtils.pxFromDp(getActivity(), dp);

    dp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_ic_menu_main_shortcut_height);
    float heightPx = DisplayUtils.pxFromDp(getActivity(), dp);

    dp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_ic_menu_main_shortcut_font_size);
    float mainShortcutFontPx = DisplayUtils.pxFromDp(getActivity(), dp);

    GridLayout.LayoutParams childlp;
    View child;
    for (int i = 0; i < mMainShortcutGridLayout.getChildCount(); i++) {
        /**
         * right shortcut panel
         */
        child = mMainShortcutGridLayout.getChildAt(i);

        childlp = (GridLayout.LayoutParams) child.getLayoutParams();
        childlp.width = (int) widthPx;
        childlp.height = (int) heightPx;
        child.setLayoutParams(childlp);
    }

    // add other shortcuts.
    dp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_ic_menu_shortcut_width);
    float btnWidthPx = DisplayUtils.pxFromDp(getActivity(), dp);
    dp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_ic_menu_shortcut_height);
    float btnHeightPx = DisplayUtils.pxFromDp(getActivity(), dp);

    dp = DisplayUtils.getDimension(getActivity(), R.dimen.ic_nav_btn_drawable_padding);
    float drawablePadding = DisplayUtils.pxFromDp(getActivity(), dp);

    dp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_ic_menu_shortcut_font_size);
    float btnFontPx = DisplayUtils.pxFromDp(getActivity(), dp);

    for (int i = 0; i < mShorcutGridLayout.getChildCount(); i++) {
        /**
         * right shortcut panel
         */
        child = mShorcutGridLayout.getChildAt(i);

        childlp = (GridLayout.LayoutParams) child.getLayoutParams();
        childlp.width = (int) btnWidthPx;
        childlp.height = (int) btnHeightPx;
        child.setLayoutParams(childlp);
    }
}

From source file:com.mantz_it.rfanalyzer.MainActivity.java

/**
 * Will check if any preference conflicts with the current state of the app and fix it
 *//*from  w w w .  jav  a 2  s .  c  o  m*/
public void checkForChangedPreferences() {
    // Source Type (this is pretty complex as we have to check each type individually):
    int sourceType = Integer.valueOf(preferences.getString(getString(R.string.pref_sourceType), "1"));
    if (source != null) {
        switch (sourceType) {
        case FILE_SOURCE:
            if (!(source instanceof FileIQSource)) {
                source.close();
                createSource();
            } else {
                long freq = Integer.valueOf(
                        preferences.getString(getString(R.string.pref_filesource_frequency), "97000000"));
                int sampRate = Integer.valueOf(
                        preferences.getString(getString(R.string.pref_filesource_sampleRate), "2000000"));
                String fileName = preferences.getString(getString(R.string.pref_filesource_file), "");
                int fileFormat = Integer
                        .valueOf(preferences.getString(getString(R.string.pref_filesource_format), "0"));
                boolean repeat = preferences.getBoolean(getString(R.string.pref_filesource_repeat), false);
                if (freq != source.getFrequency() || sampRate != source.getSampleRate()
                        || !fileName.equals(((FileIQSource) source).getFilename())
                        || repeat != ((FileIQSource) source).isRepeat()
                        || fileFormat != ((FileIQSource) source).getFileFormat()) {
                    source.close();
                    createSource();
                }
            }
            break;
        case HACKRF_SOURCE:
            if (!(source instanceof HackrfSource)) {
                source.close();
                createSource();
            } else {
                // overwrite hackrf source settings if changed:
                boolean amp = preferences.getBoolean(getString(R.string.pref_hackrf_amplifier), false);
                boolean antennaPower = preferences.getBoolean(getString(R.string.pref_hackrf_antennaPower),
                        false);
                int frequencyOffset = Integer
                        .valueOf(preferences.getString(getString(R.string.pref_hackrf_frequencyOffset), "0"));
                if (((HackrfSource) source).isAmplifierOn() != amp)
                    ((HackrfSource) source).setAmplifier(amp);
                if (((HackrfSource) source).isAntennaPowerOn() != antennaPower)
                    ((HackrfSource) source).setAntennaPower(antennaPower);
                if (((HackrfSource) source).getFrequencyOffset() != frequencyOffset)
                    ((HackrfSource) source).setFrequencyOffset(frequencyOffset);
            }
            break;
        case RTLSDR_SOURCE:
            if (!(source instanceof RtlsdrSource)) {
                source.close();
                createSource();
            } else {
                // Check if ip or port has changed and recreate source if necessary:
                String ip = preferences.getString(getString(R.string.pref_rtlsdr_ip), "");
                int port = Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_port), "1234"));
                boolean externalServer = preferences.getBoolean(getString(R.string.pref_rtlsdr_externalServer),
                        false);
                if (externalServer) {
                    if (!ip.equals(((RtlsdrSource) source).getIpAddress())
                            || port != ((RtlsdrSource) source).getPort()) {
                        source.close();
                        createSource();
                        return;
                    }
                } else {
                    if (!((RtlsdrSource) source).getIpAddress().equals("127.0.0.1")
                            || 1234 != ((RtlsdrSource) source).getPort()) {
                        source.close();
                        createSource();
                        return;
                    }
                }

                // otherwise just overwrite rtl-sdr source settings if changed:
                int frequencyCorrection = Integer.valueOf(
                        preferences.getString(getString(R.string.pref_rtlsdr_frequencyCorrection), "0"));
                int frequencyOffset = Integer
                        .valueOf(preferences.getString(getString(R.string.pref_rtlsdr_frequencyOffset), "0"));
                if (frequencyCorrection != ((RtlsdrSource) source).getFrequencyCorrection())
                    ((RtlsdrSource) source).setFrequencyCorrection(frequencyCorrection);
                if (((RtlsdrSource) source).getFrequencyOffset() != frequencyOffset)
                    ((RtlsdrSource) source).setFrequencyOffset(frequencyOffset);
                ((RtlsdrSource) source).setDirectSampling(Integer
                        .valueOf(preferences.getString(getString(R.string.pref_rtlsdr_directSamp), "0")));
            }
            break;
        default:
        }
    }

    if (analyzerSurface != null) {
        // All GUI settings will just be overwritten:
        analyzerSurface
                .setVerticalScrollEnabled(preferences.getBoolean(getString(R.string.pref_scrollDB), true));
        analyzerSurface.setVerticalZoomEnabled(preferences.getBoolean(getString(R.string.pref_zoomDB), true));
        analyzerSurface.setDecoupledAxis(preferences.getBoolean(getString(R.string.pref_decoupledAxis), false));
        analyzerSurface.setDisplayRelativeFrequencies(
                preferences.getBoolean(getString(R.string.pref_relativeFrequencies), false));
        analyzerSurface.setWaterfallColorMapType(
                Integer.valueOf(preferences.getString(getString(R.string.pref_colorMapType), "4")));
        analyzerSurface.setFftDrawingType(
                Integer.valueOf(preferences.getString(getString(R.string.pref_fftDrawingType), "2")));
        analyzerSurface.setAverageLength(
                Integer.valueOf(preferences.getString(getString(R.string.pref_averaging), "0")));
        analyzerSurface.setPeakHoldEnabled(preferences.getBoolean(getString(R.string.pref_peakHold), false));
        analyzerSurface.setFftRatio(
                Float.valueOf(preferences.getString(getString(R.string.pref_spectrumWaterfallRatio), "0.5")));
        analyzerSurface
                .setFontSize(Integer.valueOf(preferences.getString(getString(R.string.pref_fontSize), "2")));
        analyzerSurface.setShowDebugInformation(
                preferences.getBoolean(getString(R.string.pref_showDebugInformation), false));
        analyzerSurface.setDisplayFrequencyUnit(
                Integer.valueOf(preferences.getString(getString(R.string.pref_surface_unit), "1000000")));
    }

    // Screen Orientation:
    String screenOrientation = preferences.getString(getString(R.string.pref_screenOrientation), "auto");
    if (screenOrientation.equals("auto"))
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    else if (screenOrientation.equals("landscape"))
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    else if (screenOrientation.equals("portrait"))
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    else if (screenOrientation.equals("reverse_landscape"))
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
    else if (screenOrientation.equals("reverse_portrait"))
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
}

From source file:com.nbplus.vbroadlauncher.HomeLauncherActivity.java

private void setContentViewByOrientation() {
    int wallpaperId = LauncherSettings.getInstance(this).getWallpaperId();
    int orientation = DisplayUtils.getScreenOrientation(this);
    if (orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
            || orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) {
        getWindow().setBackgroundDrawableResource(LauncherSettings.landWallpaperResource[wallpaperId]);
    } else {/*from ww  w  . j  a va2  s.  c om*/
        getWindow().setBackgroundDrawableResource(LauncherSettings.portWallpaperResource[wallpaperId]);
    }
}

From source file:net.zorgblub.typhon.fragment.ReadingFragment.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void updateFromPrefs() {

    AppCompatActivity activity = (AppCompatActivity) getActivity();

    if (activity == null) {
        return;//  w ww.  ja va  2s  .co  m
    }

    bookView.setTextSize(config.getTextSize());

    int marginH = config.getHorizontalMargin();
    int marginV = config.getVerticalMargin();

    this.textLoader.setFontFamily(config.getDefaultFontFamily());
    this.bookView.setFontFamily(config.getDefaultFontFamily());
    this.textLoader.setSansSerifFontFamily(config.getSansSerifFontFamily());
    this.textLoader.setSerifFontFamily(config.getSerifFontFamily());

    bookView.setHorizontalMargin(marginH);
    bookView.setVerticalMargin(marginV);

    if (!isAnimating()) {
        bookView.setEnableScrolling(config.isScrollingEnabled());
    }

    textLoader.setStripWhiteSpace(config.isStripWhiteSpaceEnabled());
    textLoader.setAllowStyling(config.isAllowStyling());
    textLoader.setUseColoursFromCSS(config.isUseColoursFromCSS());

    bookView.setLineSpacing(config.getLineSpacing());

    if (config.isFullScreenEnabled()) {
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        activity.getSupportActionBar().hide();

    } else {
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        activity.getSupportActionBar().show();
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        if (config.isFullScreenEnabled()) {
            activity.getWindow().getDecorView().setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    // | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
        }
        if (config.isDimSystemUI()) {
            activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
        }
    }

    if (config.isKeepScreenOn()) {
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    } else {
        activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }

    restoreColorProfile();

    // Check if we need a restart
    if (config.isFullScreenEnabled() != savedConfigState.fullscreen
            || config.isShowPageNumbers() != savedConfigState.usePageNum
            || config.isBrightnessControlEnabled() != savedConfigState.brightness
            || config.isStripWhiteSpaceEnabled() != savedConfigState.stripWhiteSpace
            || !config.getDefaultFontFamily().getName().equalsIgnoreCase(savedConfigState.fontName)
            || !config.getSerifFontFamily().getName().equalsIgnoreCase(savedConfigState.serifFontName)
            || !config.getSansSerifFontFamily().getName().equalsIgnoreCase(savedConfigState.sansSerifFontName)
            || config.getHorizontalMargin() != savedConfigState.hMargin
            || config.getVerticalMargin() != savedConfigState.vMargin
            || config.getTextSize() != savedConfigState.textSize
            || config.isScrollingEnabled() != savedConfigState.scrolling
            || config.isAllowStyling() != savedConfigState.allowStyling
            || config.isUseColoursFromCSS() != savedConfigState.allowColoursFromCSS
            || config.isRikaiEnabled() != savedConfigState.rikaiEnabled
            || dictionaryService.getLastUpdateTimestamp() > this.dictionaryLastUpdate) {
        DictionaryServiceImpl.reset();
        textLoader.invalidateCachedText();
        restartActivity();
    }

    Configuration.OrientationLock orientation = config.getScreenOrientation();

    switch (orientation) {
    case PORTRAIT:
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        break;
    case LANDSCAPE:
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        break;
    case REVERSE_LANDSCAPE:
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); // Android 2.3+ value
        break;
    case REVERSE_PORTRAIT:
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); // Android 2.3+ value
        break;
    default:
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }
}

From source file:com.aimfire.main.MainActivity.java

public int getScreenOrientation() {
    int rotation = getWindowManager().getDefaultDisplay().getRotation();
    int orientation = getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_PORTRAIT) {
        if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_270) {
            return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
        } else {/*from  w  w  w . j  av a  2s  . c o m*/
            return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
        }
    }
    if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
        if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90) {
            return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
        } else {
            return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
        }
    }
    return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
}

From source file:com.youku.player.base.YoukuBasePlayerActivity.java

@Override
public void reverseLand() { //OrientationChangeCallback?
    if (null != orientationHelper)
        orientationHelper.disableListener();
    if (!PreferenceUtil.getPreferenceBoolean(this, "video_lock", false)) {
        layoutHandler.removeCallbacksAndMessages(null);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    } else {//w ww . j ava  2s  .c o m
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
    }
}

From source file:org.videolan.vlc.gui.video.VideoPlayerActivity.java

@TargetApi(Build.VERSION_CODES.GINGERBREAD)
private int getScreenOrientation() {
    switch (getScreenRotation()) {
    case Surface.ROTATION_0:
        return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    case Surface.ROTATION_90:
        return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
    case Surface.ROTATION_180:
        // SCREEN_ORIENTATION_REVERSE_PORTRAIT only available since API Level 9+
        return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO
                ? ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
                : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    case Surface.ROTATION_270:
        // SCREEN_ORIENTATION_REVERSE_LANDSCAPE only available since API Level 9+
        return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO
                ? ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
                : ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    default://w  w  w  . j  ava 2  s. c o m
        return 0;
    }
}