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:Main.java

public static boolean isVertical(Context context) {
    return getOrientacao(context) == Configuration.ORIENTATION_PORTRAIT;
}

From source file:Main.java

public static boolean isPortrait(Resources res) {
    return res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
}

From source file:Main.java

public static boolean isScreenPortrait(Context context) {
    return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
}

From source file:Main.java

public static boolean isPortrait() {
    return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
}

From source file:Main.java

public static boolean isScreenOriatationPortrait(Context context) {
    return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
}

From source file:Main.java

public static boolean isVertical(Context context) {
    int orientacao = context.getResources().getConfiguration().orientation;
    boolean vertical = orientacao == Configuration.ORIENTATION_PORTRAIT;
    return vertical;
}

From source file:Main.java

public static boolean isOrientationPortrait(Context context) {
    if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        return true;
    }//w  w w  . j av a  2  s  .com
    return false;
}

From source file:Main.java

public static String getDisplayOrientation(Context context) {
    String text;//from  ww w .  j ava2  s . co m

    switch (context.getResources().getConfiguration().orientation) {
    case Configuration.ORIENTATION_PORTRAIT:
        text = "portrait";
        break;
    case Configuration.ORIENTATION_LANDSCAPE:
        text = "landscape";
        break;
    case Configuration.ORIENTATION_SQUARE:
        text = "square";
        break;
    default:
        text = null;
    }
    ;

    return text;
}

From source file:Main.java

private static boolean isEnoughSpace(Configuration configuration) {
    if (configuration == null) {
        return false;
    }/*  w  ww . j a  va 2  s .  c o m*/
    if (configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
        return true;
    }
    int sizeMask = configuration.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
    boolean smallScreen = sizeMask == Configuration.SCREENLAYOUT_SIZE_SMALL
            || sizeMask == Configuration.SCREENLAYOUT_SIZE_NORMAL;
    return !smallScreen;
}

From source file:Main.java

public static int getNavigationBarHeight(Context context) {
    int id = context.getResources().getIdentifier(
            context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT
                    ? "navigation_bar_height"
                    : "navigation_bar_height_landscape",
            "dimen", "android");
    if (id > 0) {
        return context.getResources().getDimensionPixelSize(id);
    }/*from ww w .  j  av a2 s.  c  om*/
    return 0;
}