Example usage for android.content.res Configuration ORIENTATION_LANDSCAPE

List of usage examples for android.content.res Configuration ORIENTATION_LANDSCAPE

Introduction

In this page you can find the example usage for android.content.res Configuration ORIENTATION_LANDSCAPE.

Prototype

int ORIENTATION_LANDSCAPE

To view the source code for android.content.res Configuration ORIENTATION_LANDSCAPE.

Click Source Link

Document

Constant for #orientation , value corresponding to the land resource qualifier.

Usage

From source file:com.android.mms.ui.ComposeMessageActivity.java

private boolean resetConfiguration(Configuration config) {
    mIsKeyboardOpen = config.keyboardHidden == KEYBOARDHIDDEN_NO;
    boolean isLandscape = config.orientation == Configuration.ORIENTATION_LANDSCAPE;
    if (mIsLandscape != isLandscape) {
        mIsLandscape = isLandscape;/*from w w  w .  j a  v  a2  s . c o m*/
        return true;
    }
    return false;
}

From source file:com.yek.keyboard.anysoftkeyboard.AnySoftKeyboard.java

private void setInitialCondensedState(Configuration newConfig) {
    final String defaultCondensed = mAskPrefs.getInitialKeyboardCondenseState();
    mKeyboardInCondensedMode = CondenseType.None;
    switch (defaultCondensed) {
    case "split_always":
        mKeyboardInCondensedMode = CondenseType.Split;
        break;/*from  ww w  .  j ava 2s . c  o  m*/
    case "split_in_landscape":
        if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
            mKeyboardInCondensedMode = CondenseType.Split;
        else
            mKeyboardInCondensedMode = CondenseType.None;
        break;
    case "compact_right_always":
        mKeyboardInCondensedMode = CondenseType.CompactToRight;
        break;
    case "compact_left_always":
        mKeyboardInCondensedMode = CondenseType.CompactToLeft;
        break;
    }
}

From source file:com.anysoftkeyboard.AnySoftKeyboard.java

private void setInitialCondensedState(SharedPreferences sp, Configuration configuration) {
    final int settingsKeyResId = configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
            ? R.string.settings_key_default_split_state_landscape
            : R.string.settings_key_default_split_state_portrait;
    final String initialKeyboardCondenseState = sp.getString(getString(settingsKeyResId),
            getString(R.string.settings_default_default_split_state));

    final CondenseType previousCondenseType = mKeyboardInCondensedMode;
    mKeyboardInCondensedMode = CondenseType.None;
    switch (initialKeyboardCondenseState) {
    case "split":
        mKeyboardInCondensedMode = CondenseType.Split;
        break;//from   w w w . j av a2  s.c o  m
    case "compact_right":
        mKeyboardInCondensedMode = CondenseType.CompactToRight;
        break;
    case "compact_left":
        mKeyboardInCondensedMode = CondenseType.CompactToLeft;
        break;
    }
    if (previousCondenseType != mKeyboardInCondensedMode) {
        getKeyboardSwitcher().flushKeyboardsCache();
        resetKeyboardView(false);
    }
}

From source file:com.android.launcher2.Launcher.java

/** Maps the current orientation to an index for referencing orientation correct global icons */
private int getCurrentOrientationIndexForGlobalIcons() {
    // default - 0, landscape - 1
    switch (getResources().getConfiguration().orientation) {
    case Configuration.ORIENTATION_LANDSCAPE:
        return 1;
    default://from  w w  w  .j  a  v  a 2s .c o m
        return 0;
    }
}

From source file:com.android.launcher2.Launcher.java

private int mapConfigurationOriActivityInfoOri(int configOri) {
    final Display d = getWindowManager().getDefaultDisplay();
    int naturalOri = Configuration.ORIENTATION_LANDSCAPE;
    switch (d.getRotation()) {
    case Surface.ROTATION_0:
    case Surface.ROTATION_180:
        // We are currently in the same basic orientation as the natural orientation
        naturalOri = configOri;//  w  w  w . j a  v  a2 s  .c  om
        break;
    case Surface.ROTATION_90:
    case Surface.ROTATION_270:
        // We are currently in the other basic orientation to the natural orientation
        naturalOri = (configOri == Configuration.ORIENTATION_LANDSCAPE) ? Configuration.ORIENTATION_PORTRAIT
                : Configuration.ORIENTATION_LANDSCAPE;
        break;
    }

    int[] oriMap = { ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE,
            ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT,
            ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE };
    // Since the map starts at portrait, we need to offset if this device's natural orientation
    // is landscape.
    int indexOffset = 0;
    if (naturalOri == Configuration.ORIENTATION_LANDSCAPE) {
        indexOffset = 1;
    }
    return oriMap[(d.getRotation() + indexOffset) % 4];
}

From source file:com.zoffcc.applications.zanavi.Navit.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    if (last_orientation != newConfig.orientation) {
        // Checks the orientation of the screen
        if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
            // setContentView(R.layout.main_layout);

            // -- bottom bar --
            int h = NavitGraphics.mCanvasHeight;
            try {
                int h001;
                android.view.ViewGroup.LayoutParams lp001;

                View v003 = (View) findViewById(R.id.osd_nextturn_new);
                h001 = getResources().getDimensionPixelSize(R.dimen.osd_nextturn_new_height);
                lp001 = v003.getLayoutParams();
                lp001.height = h001;/*from   w  w w .j a va 2 s  . c o m*/
                v003.requestLayout();

                v003 = (View) findViewById(R.id.bottom_bar);
                h001 = getResources().getDimensionPixelSize(R.dimen.bottom_bar_height);
                lp001 = v003.getLayoutParams();
                lp001.height = h001;
                v003.requestLayout();

                LinearLayout v002 = (LinearLayout) findViewById(R.id.bottom_slide_view);
                h001 = getResources().getDimensionPixelSize(R.dimen.bottom_slide_view_height);
                lp001 = v002.getLayoutParams();
                lp001.height = h001;
                v002.requestLayout();

                v003 = (View) findViewById(R.id.osd_timetodest_new);
                h001 = getResources().getDimensionPixelSize(R.dimen.osd_timetodest_new_height);
                lp001 = v003.getLayoutParams();
                lp001.height = h001;
                v003.requestLayout();

                v002 = (LinearLayout) findViewById(R.id.bottom_line_container);
                h001 = getResources().getDimensionPixelSize(R.dimen.bottom_line_container_height);
                lp001 = v002.getLayoutParams();
                lp001.height = h001;
                v002.requestLayout();

                RelativeLayout v001 = (RelativeLayout) findViewById(R.id.gui_top_container);
                h001 = getResources().getDimensionPixelSize(R.dimen.gui_top_container_height);
                lp001 = v001.getLayoutParams();
                lp001.height = h001;
                v001.requestLayout();

                int ml = getResources().getDimensionPixelSize(R.dimen.margin_left_speeding);
                int mb = getResources().getDimensionPixelSize(R.dimen.margin_bottom_speeding);
                v003 = (View) findViewById(R.id.view_speeding);
                RelativeLayout.LayoutParams relativeParams_001 = (RelativeLayout.LayoutParams) v003
                        .getLayoutParams();
                relativeParams_001.setMargins(ml, 0, 0, mb); // left, top, right, bottom
                v003.setLayoutParams(relativeParams_001);
                v003.requestLayout();

                smaller_top_bar(true);

                // Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();

                bottom_bar_px = (int) getResources().getDimension(R.dimen.gui_top_container_height);
                bottom_bar_slider_shadow_px = (int) getResources()
                        .getDimension(R.dimen.bottom_slide_view_shadow_compat_height);

                Navit.cur_y_margin_bottom_bar_touch = h + Navit.actionBarHeight + bottom_bar_px
                        - Navit.bottom_bar_slider_shadow_px; // try to put view at bottom
            } catch (Exception e) {
                Navit.cur_y_margin_bottom_bar_touch = h + Navit.actionBarHeight + bottom_bar_px
                        - Navit.bottom_bar_slider_shadow_px; // try to put view at bottom
            }
            Navit.bottom_y_margin_bottom_bar_touch = Navit.cur_y_margin_bottom_bar_touch;
            // -- bottom bar --
        } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
            // setContentView(R.layout.main_layout);

            // -- bottom bar --
            int h = NavitGraphics.mCanvasHeight;
            try {
                int h001;
                android.view.ViewGroup.LayoutParams lp001;

                View v003 = (View) findViewById(R.id.osd_nextturn_new);
                h001 = getResources().getDimensionPixelSize(R.dimen.osd_nextturn_new_height);
                lp001 = v003.getLayoutParams();
                lp001.height = h001;
                v003.requestLayout();

                v003 = (View) findViewById(R.id.bottom_bar);
                h001 = getResources().getDimensionPixelSize(R.dimen.bottom_bar_height);
                lp001 = v003.getLayoutParams();
                lp001.height = h001;
                v003.requestLayout();

                LinearLayout v002 = (LinearLayout) findViewById(R.id.bottom_slide_view);
                h001 = getResources().getDimensionPixelSize(R.dimen.bottom_slide_view_height);
                lp001 = v002.getLayoutParams();
                lp001.height = h001;
                v002.requestLayout();

                v003 = (View) findViewById(R.id.osd_timetodest_new);
                h001 = getResources().getDimensionPixelSize(R.dimen.osd_timetodest_new_height);
                lp001 = v003.getLayoutParams();
                lp001.height = h001;
                v003.requestLayout();

                v002 = (LinearLayout) findViewById(R.id.bottom_line_container);
                h001 = getResources().getDimensionPixelSize(R.dimen.bottom_line_container_height);
                lp001 = v002.getLayoutParams();
                lp001.height = h001;
                v002.requestLayout();

                RelativeLayout v001 = (RelativeLayout) findViewById(R.id.gui_top_container);
                h001 = getResources().getDimensionPixelSize(R.dimen.gui_top_container_height);
                lp001 = v001.getLayoutParams();
                lp001.height = h001;
                v001.requestLayout();

                int ml = getResources().getDimensionPixelSize(R.dimen.margin_left_speeding);
                int mb = getResources().getDimensionPixelSize(R.dimen.margin_bottom_speeding);
                v003 = (View) findViewById(R.id.view_speeding);
                RelativeLayout.LayoutParams relativeParams_001 = (RelativeLayout.LayoutParams) v003
                        .getLayoutParams();
                relativeParams_001.setMargins(ml, 0, 0, mb); // left, top, right, bottom
                v003.setLayoutParams(relativeParams_001);
                v003.requestLayout();

                smaller_top_bar(false);

                // Toast.makeText(this, "protrait", Toast.LENGTH_SHORT).show();

                bottom_bar_px = (int) getResources().getDimension(R.dimen.gui_top_container_height);
                bottom_bar_slider_shadow_px = (int) getResources()
                        .getDimension(R.dimen.bottom_slide_view_shadow_compat_height);

                Navit.cur_y_margin_bottom_bar_touch = h + Navit.actionBarHeight + bottom_bar_px
                        - Navit.bottom_bar_slider_shadow_px; // try to put view at bottom
            } catch (Exception e) {
                Navit.cur_y_margin_bottom_bar_touch = h + Navit.actionBarHeight + bottom_bar_px
                        - Navit.bottom_bar_slider_shadow_px; // try to put view at bottom
            }
            Navit.bottom_y_margin_bottom_bar_touch = Navit.cur_y_margin_bottom_bar_touch;
            // -- bottom bar --
        }

        last_orientation = newConfig.orientation;
    }
}