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.concentricsky.android.khanacademy.app.VideoDetailActivity.java

private void goFullscreen(boolean force) {
    isFullscreen = true;/*from w w w . j  a  va2 s.c o  m*/
    setRequestedOrientation(force ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
            : ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);

    VideoController videoControls = (VideoController) findViewById(R.id.controller);
    if (videoControls != null) {
        videoControls.setFullscreen(true);
    }

    ThumbnailWrapper videoContainer = (ThumbnailWrapper) findViewById(R.id.video_fragment_container);
    videoContainer.setMaintainAspectRatio(false);

    if (captionFragment != null) {
        FragmentTransaction tx = getFragmentManager().beginTransaction();
        tx.remove(captionFragment);
        tx.commit();
    }
    findViewById(R.id.detail_bottom_container).setVisibility(View.GONE);
    if (isBigScreen) {
        findViewById(R.id.detail_right_container).setVisibility(View.GONE);
        findViewById(R.id.detail_center_divider).setVisibility(View.GONE);
    }

    setNavVisibility(videoFragment == null || !videoFragment.isPlaying());

    getDecorViewTreeObserver().addOnGlobalLayoutListener(layoutFixer);
}

From source file:net.nightwhistler.pageturner.fragment.ReadingFragment.java

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

    SherlockFragmentActivity activity = getSherlockActivity();

    if (activity == null) {
        return;//from   ww w  .  j a  va 2 s. c om
    }

    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()) {
            bookView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);

        }
        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) {

        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(8); // Android 2.3+ value
        break;
    case REVERSE_PORTRAIT:
        getActivity().setRequestedOrientation(9); // Android 2.3+ value
        break;
    default:
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }
}

From source file:com.aujur.ebookreader.activity.ReadingFragment.java

private void updateFromPrefs() {

    SherlockFragmentActivity activity = getSherlockActivity();

    if (activity == null) {
        return;//from ww w . j  a  v  a 2s.  c om
    }

    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 && 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) {

        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(8); // Android 2.3+ value
        break;
    case REVERSE_PORTRAIT:
        getActivity().setRequestedOrientation(9); // Android 2.3+ value
        break;
    default:
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }
}

From source file:com.concentricsky.android.khanacademy.app.VideoDetailActivity.java

private void goLargeLandscape() {
    isFullscreen = false;// w w  w.  j a  va 2 s . c o m
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);

    VideoController videoControls = (VideoController) findViewById(R.id.controller);
    if (videoControls != null) {
        videoControls.setFullscreen(false);
    }

    ThumbnailWrapper videoContainer = (ThumbnailWrapper) findViewById(R.id.video_fragment_container);
    videoContainer.setMaintainAspectRatio(true);

    FrameLayout headerContainer = (FrameLayout) findViewById(R.id.detail_header_container);
    LinearLayout.LayoutParams p = (LinearLayout.LayoutParams) headerContainer.getLayoutParams();
    p.weight = 1;
    headerContainer.setLayoutParams(p);
    headerContainer.setVisibility(View.VISIBLE);

    FrameLayout emptyContainer = (FrameLayout) findViewById(R.id.detail_bottom_container);
    p = (LinearLayout.LayoutParams) emptyContainer.getLayoutParams();
    p.weight = 0;
    emptyContainer.setLayoutParams(p);
    emptyContainer.setVisibility(View.GONE);

    findViewById(R.id.detail_right_container).setVisibility(View.VISIBLE);
    createAndAttachCaptionFragment(R.id.detail_right_caption_container);
    createAndAttachHeader();

    findViewById(R.id.detail_center_divider).setVisibility(View.VISIBLE);

    getDecorViewTreeObserver().addOnGlobalLayoutListener(layoutFixer);
}

From source file:com.google.appinventor.components.runtime.Form.java

/**
 * ScreenOrientation property setter method: sets the screen orientation for
 * the form.//  www .  j av a 2 s .com
 *
 * @param screenOrientation  the screen orientation as a string
 */
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_SCREEN_ORIENTATION, defaultValue = "unspecified")
@SimpleProperty(category = PropertyCategory.APPEARANCE)
public void ScreenOrientation(String screenOrientation) {
    if (screenOrientation.equalsIgnoreCase("behind")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_BEHIND);
    } else if (screenOrientation.equalsIgnoreCase("landscape")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else if (screenOrientation.equalsIgnoreCase("nosensor")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    } else if (screenOrientation.equalsIgnoreCase("portrait")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else if (screenOrientation.equalsIgnoreCase("sensor")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    } else if (screenOrientation.equalsIgnoreCase("unspecified")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    } else if (screenOrientation.equalsIgnoreCase("user")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
    } else if (SdkLevel.getLevel() >= SdkLevel.LEVEL_GINGERBREAD) {
        if (screenOrientation.equalsIgnoreCase("fullSensor")) {
            setRequestedOrientation(10); // ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR
        } else if (screenOrientation.equalsIgnoreCase("reverseLandscape")) {
            setRequestedOrientation(8); // ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
        } else if (screenOrientation.equalsIgnoreCase("reversePortrait")) {
            setRequestedOrientation(9); // ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
        } else if (screenOrientation.equalsIgnoreCase("sensorLandscape")) {
            setRequestedOrientation(6); // ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
        } else if (screenOrientation.equalsIgnoreCase("sensorPortrait")) {
            setRequestedOrientation(7); // ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
        } else {
            dispatchErrorOccurredEvent(this, "ScreenOrientation",
                    ErrorMessages.ERROR_INVALID_SCREEN_ORIENTATION, screenOrientation);
        }
    } else {
        dispatchErrorOccurredEvent(this, "ScreenOrientation", ErrorMessages.ERROR_INVALID_SCREEN_ORIENTATION,
                screenOrientation);
    }
}

From source file:com.concentricsky.android.khanacademy.app.VideoDetailActivity.java

private void goPortrait() {
    isFullscreen = false;//from w  w  w .  j  a  v a 2 s  . com
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);

    VideoController videoControls = (VideoController) findViewById(R.id.controller);
    if (videoControls != null) {
        videoControls.setFullscreen(false);
    }

    ThumbnailWrapper videoContainer = (ThumbnailWrapper) findViewById(R.id.video_fragment_container);
    videoContainer.setMaintainAspectRatio(true);

    FrameLayout headerContainer = (FrameLayout) findViewById(R.id.detail_header_container);
    LinearLayout.LayoutParams p = (LinearLayout.LayoutParams) headerContainer.getLayoutParams();
    p.weight = 0;
    headerContainer.setLayoutParams(p);

    createAndAttachCaptionFragment(R.id.detail_bottom_container);
    FrameLayout captionContainer = (FrameLayout) findViewById(R.id.detail_bottom_container);
    captionContainer.setVisibility(View.VISIBLE);
    p = (LinearLayout.LayoutParams) captionContainer.getLayoutParams();
    p.weight = 1;
    captionContainer.setLayoutParams(p);

    if (isBigScreen) {
        findViewById(R.id.detail_right_container).setVisibility(View.GONE);
        findViewById(R.id.detail_center_divider).setVisibility(View.GONE);
    }

    setNavVisibility(true);
    createAndAttachHeader();

    getDecorViewTreeObserver().addOnGlobalLayoutListener(layoutFixer);
}

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;//from   w  ww. java 2  s.c  o 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  www . j ava 2  s.  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.thomasokken.free42.Free42Activity.java

private boolean read_shell_state(IntHolder version) {
    try {/*from w  ww  .  ja  va  2 s.  co m*/
        if (state_read_int() != FREE42_MAGIC())
            return false;
        version.value = state_read_int();
        if (version.value < 0 || version.value > FREE42_VERSION())
            return false;
        int shell_version = state_read_int();
        ShellSpool.printToGif = state_read_boolean();
        ShellSpool.printToGifFileName = state_read_string();
        ShellSpool.printToTxt = state_read_boolean();
        ShellSpool.printToTxtFileName = state_read_string();
        if (shell_version >= 1)
            ShellSpool.maxGifHeight = state_read_int();
        if (shell_version >= 2)
            skinName[0] = state_read_string();
        if (shell_version >= 3)
            externalSkinName[0] = state_read_string();
        if (shell_version >= 4) {
            skinName[1] = state_read_string();
            externalSkinName[1] = state_read_string();
            keyClicksEnabled = state_read_boolean();
        } else {
            skinName[1] = skinName[0];
            externalSkinName[1] = externalSkinName[0];
            keyClicksEnabled = true;
        }
        if (shell_version >= 5)
            preferredOrientation = state_read_int();
        else
            preferredOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
        if (shell_version >= 6) {
            skinSmoothing[0] = state_read_boolean();
            displaySmoothing[0] = state_read_boolean();
        }
        if (shell_version >= 7) {
            skinSmoothing[1] = state_read_boolean();
            displaySmoothing[1] = state_read_boolean();
        }
        if (shell_version >= 8)
            keyVibrationEnabled = state_read_boolean();
        if (shell_version >= 9) {
            style = state_read_int();
            int maxStyle = PreferencesDialog.immersiveModeSupported ? 2 : 1;
            if (style > maxStyle)
                style = maxStyle;
        } else
            style = 0;
        if (shell_version >= 10)
            alwaysRepaintFullDisplay = state_read_boolean();
        if (shell_version >= 11)
            alwaysOn = state_read_boolean();
        init_shell_state(shell_version);
    } catch (IllegalArgumentException e) {
        return false;
    }
    return true;
}

From source file:com.thomasokken.free42.Free42Activity.java

private void init_shell_state(int shell_version) {
    switch (shell_version) {
    case -1:/*  w w w  . jav  a2 s .  c  o m*/
        ShellSpool.printToGif = false;
        ShellSpool.printToGifFileName = "";
        ShellSpool.printToTxt = false;
        ShellSpool.printToTxtFileName = "";
        // fall through
    case 0:
        ShellSpool.maxGifHeight = 256;
        // fall through
    case 1:
        skinName[0] = "Standard";
        // fall through
    case 2:
        externalSkinName[0] = topStorageDir() + "/Free42/" + skinName[0];
        // fall through
    case 3:
        skinName[1] = "Landscape";
        externalSkinName[1] = topStorageDir() + "/Free42/" + skinName[1];
        keyClicksEnabled = true;
        // fall through
    case 4:
        preferredOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
        // fall through
    case 5:
        skinSmoothing[0] = true;
        displaySmoothing[0] = false;
        // fall through
    case 6:
        skinSmoothing[1] = skinSmoothing[0];
        displaySmoothing[1] = displaySmoothing[0];
        // fall through
    case 7:
        keyVibrationEnabled = false;
        // fall through
    case 8:
        style = 0;
        // fall through
    case 9:
        alwaysRepaintFullDisplay = false;
        // fall through
    case 10:
        alwaysOn = false;
        // fall through
    case 11:
        // current version (SHELL_VERSION = 11),
        // so nothing to do here since everything
        // was initialized from the state file.
        ;
    }
}