Example usage for android.content.res Configuration ORIENTATION_PORTRAIT

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

Introduction

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

Prototype

int ORIENTATION_PORTRAIT

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

Click Source Link

Document

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

Usage

From source file:org.cocos2dx.plugin.QH360Wrapper.java

public static boolean isLandscape(Context ctx) {
    Configuration config = ctx.getResources().getConfiguration();
    int orientation = config.orientation;

    if (orientation != Configuration.ORIENTATION_LANDSCAPE
            && orientation != Configuration.ORIENTATION_PORTRAIT) {
        orientation = Configuration.ORIENTATION_PORTRAIT;
    }/*  www  . j  a v  a  2s .  c  om*/

    return (orientation == Configuration.ORIENTATION_LANDSCAPE);
}

From source file:com.simplaapliko.util.sample.MainFragment.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.get_screen_orientation:

        switch (Screen.getOrientation(getActivity())) {
        case Configuration.ORIENTATION_PORTRAIT:
            mMessage.setText(R.string.portrait);
            break;
        case Configuration.ORIENTATION_LANDSCAPE:
            mMessage.setText(R.string.landscape);
            break;
        case Configuration.ORIENTATION_SQUARE:
            mMessage.setText(R.string.square);
            break;
        }// w w  w .  j  a  va 2s  .  c  o m

        break;
    }
}

From source file:com.lithidsw.wallbox.app.theme.ThemeFragment.java

private boolean isPort() {
    return fa.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
}

From source file:com.aptoide.amethyst.ui.ViewPagerAdapterScreenshots.java

private int getPlaceholder(Context ctx) {
    int id;//from   w ww. j a v  a 2 s.  c  o m
    if (ctx.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        id = R.drawable.placeholder_144x240;
    } else {
        id = R.drawable.placeholder_256x160;
    }
    return id;
}

From source file:com.dm.material.dashboard.candybar.helpers.ViewHelper.java

public static void resetViewBottomMargin(@Nullable View view) {
    if (view == null)
        return;/*  w w w. j  a  v  a  2  s  .c  o m*/

    Context context = ContextHelper.getBaseContext(view);
    int orientation = context.getResources().getConfiguration().orientation;

    if (!(view.getLayoutParams() instanceof CoordinatorLayout.LayoutParams))
        return;

    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) view.getLayoutParams();
    int left = params.leftMargin;
    int right = params.rightMargin;
    int bottom = params.bottomMargin;
    int top = params.topMargin;
    int bottomNavBar = 0;
    int rightNavBar = 0;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        boolean tabletMode = context.getResources().getBoolean(R.bool.tablet_mode);
        if (tabletMode || orientation == Configuration.ORIENTATION_PORTRAIT) {
            bottomNavBar = getNavigationBarHeight(context);
        } else {
            rightNavBar = getNavigationBarHeight(context);
        }
    }

    int navBar = getNavigationBarHeight(context);
    if ((bottom > bottomNavBar) && ((bottom - navBar) > 0))
        bottom -= navBar;
    if ((right > rightNavBar) && ((right - navBar) > 0))
        right -= navBar;

    params.setMargins(left, top, (right + rightNavBar), (bottom + bottomNavBar));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        params.setMarginEnd((right + rightNavBar));
    }
    view.setLayoutParams(params);
}

From source file:com.google.sample.cast.refplayer.utils.Utils.java

/**
 * Returns {@code true} if and only if the screen orientation is portrait.
 *///from w ww . j  a  va 2 s  .  co m
public static boolean isOrientationPortrait(Context context) {
    return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
}

From source file:com.android.emergency.EmergencyTabActivity.java

@Override
protected void onResume() {
    super.onResume();
    int display_mode = getResources().getConfiguration().orientation;

    if (display_mode == Configuration.ORIENTATION_PORTRAIT) {
        mTabLayout.setTabMode(TabLayout.MODE_FIXED);
        mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
    }/*w w  w . j  a va  2  s  .c  o  m*/
}

From source file:tk.wasdennnoch.androidn_ify.ui.emergency.EmergencyTabActivity.java

@Override
protected void onResume() {
    super.onResume();
    int display_mode = getResources().getConfiguration().orientation;
    if (display_mode == Configuration.ORIENTATION_PORTRAIT) {
        mTabLayout.setTabMode(TabLayout.MODE_FIXED);
        mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
    }//from w  w  w  . j  a  v  a2s . com
}

From source file:cn.edu.nuc.seeworld.YOUJIActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_youji);

    createViewPagerFragments();//  w  w  w .  ja v a2  s.  c  o m
    mPageAdapter = new ColorFragmentAdapter(getSupportFragmentManager(), mViewPagerFragments);

    boolean portrait = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;

    mFlippableStack = (FlippableStackView) findViewById(R.id.flippable_stack_view);
    mFlippableStack.initStack(4,
            portrait ? StackPageTransformer.Orientation.VERTICAL : StackPageTransformer.Orientation.HORIZONTAL);
    mFlippableStack.setAdapter(mPageAdapter);
}

From source file:com.waz.zclient.utils.ViewUtils.java

public static boolean isInPortrait(@NonNull Configuration configuration) {
    return configuration.orientation == Configuration.ORIENTATION_PORTRAIT;
}