Java Code Examples for android.content.res.Configuration#SCREENLAYOUT_SIZE_XLARGE

The following examples show how to use android.content.res.Configuration#SCREENLAYOUT_SIZE_XLARGE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UI.java    From android-lockpattern with Apache License 2.0 6 votes vote down vote up
/**
 * Gets current screen size.
 * 
 * @param context
 *            the context.
 * @return current screen size.
 */
public static ScreenSize getCurrent(Context context) {
    switch (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) {
    case Configuration.SCREENLAYOUT_SIZE_SMALL:
        return SMALL;
    case Configuration.SCREENLAYOUT_SIZE_NORMAL:
        return NORMAL;
    case Configuration.SCREENLAYOUT_SIZE_LARGE:
        return LARGE;
    case Configuration.SCREENLAYOUT_SIZE_XLARGE:
        return XLARGE;
    default:
        return UNDEFINED;
    }
}
 
Example 2
Source File: BrowserProvider.java    From coursera-android with MIT License 5 votes vote down vote up
@Override
public boolean onCreate() {
    final Context context = getContext();
    boolean xlargeScreenSize = (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK)
            == Configuration.SCREENLAYOUT_SIZE_XLARGE;
    boolean isPortrait = (context.getResources().getConfiguration().orientation
            == Configuration.ORIENTATION_PORTRAIT);


    if (xlargeScreenSize && isPortrait) {
        mMaxSuggestionLongSize = MAX_SUGGEST_LONG_LARGE;
        mMaxSuggestionShortSize = MAX_SUGGEST_SHORT_LARGE;
    } else {
        mMaxSuggestionLongSize = MAX_SUGGEST_LONG_SMALL;
        mMaxSuggestionShortSize = MAX_SUGGEST_SHORT_SMALL;
    }
    mOpenHelper = new DatabaseHelper(context);
    mBackupManager = new BackupManager(context);
    // we added "picasa web album" into default bookmarks for version 19.
    // To avoid erasing the bookmark table, we added it explicitly for
    // version 18 and 19 as in the other cases, we will erase the table.
    if (DATABASE_VERSION == 18 || DATABASE_VERSION == 19) {
        SharedPreferences p = PreferenceManager
                .getDefaultSharedPreferences(context);
        boolean fix = p.getBoolean("fix_picasa", true);
        if (fix) {
            fixPicasaBookmark();
            Editor ed = p.edit();
            ed.putBoolean("fix_picasa", false);
            ed.apply();
        }
    }
    mSettings = BrowserSettings.getInstance();
    return true;
}
 
Example 3
Source File: Utilities.java    From TurkcellUpdater_android_sdk with Apache License 2.0 5 votes vote down vote up
@SuppressLint("NewApi")
static boolean isTablet(Context context) {
	if (android.os.Build.VERSION.SDK_INT > 12) {
		return context.getResources().getConfiguration().smallestScreenWidthDp > 600;
	} else if (android.os.Build.VERSION.SDK_INT > 10) {
		int size = context.getResources().getConfiguration().screenLayout
				& Configuration.SCREENLAYOUT_SIZE_MASK;
		return (size == Configuration.SCREENLAYOUT_SIZE_LARGE)
				|| (size == Configuration.SCREENLAYOUT_SIZE_XLARGE);
	} else {
		return false;
	}
}
 
Example 4
Source File: TableFragment.java    From openScale with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    LinearLayout row = new LinearLayout(getContext());
    row.setLayoutParams(new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));

    final int screenSize = getResources().getConfiguration()
            .screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
    final boolean isSmallScreen =
            screenSize != Configuration.SCREENLAYOUT_SIZE_XLARGE
                    && screenSize != Configuration.SCREENLAYOUT_SIZE_LARGE;

    final int count = viewType == VIEW_TYPE_YEAR ? 1 : visibleMeasurements.size();
    for (int i = 0; i < count; ++i) {
        TextView column = new TextView(getContext());
        column.setLayoutParams(new LinearLayout.LayoutParams(
                0, ViewGroup.LayoutParams.WRAP_CONTENT, 1));

        if (viewType == VIEW_TYPE_MEASUREMENT) {
            column.setMinLines(2);
            column.setGravity(Gravity.CENTER_HORIZONTAL);

            if (isSmallScreen) {
                column.setTextSize(COMPLEX_UNIT_DIP, 9);
            }
        }
        else {
            column.setPadding(0, 10, 0, 10);
            column.setGravity(Gravity.CENTER);
            column.setTextSize(COMPLEX_UNIT_DIP, 16);
        }

        row.addView(column);
    }

    return new ViewHolder(row);
}
 
Example 5
Source File: SettingsActivity.java    From android-slideshow with MIT License 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
	return (context.getResources().getConfiguration().screenLayout
			& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 6
Source File: BgGraphBuilder.java    From NightWatch with GNU General Public License v3.0 4 votes vote down vote up
static public boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 7
Source File: SettingsActivity.java    From privacy-friendly-passwordgenerator with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 8
Source File: SettingsActivity.java    From GitJourney with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 9
Source File: SettingsActivity.java    From WiFiKeyShare with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 10
Source File: SettingsActivity.java    From shrinker with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 11
Source File: SettingsActivity.java    From Android-Carbon-Forum with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 12
Source File: SettingsActivity.java    From beaconloc with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 13
Source File: SettingsActivity.java    From HAPP with GNU General Public License v3.0 4 votes vote down vote up
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 14
Source File: SettingsActivity.java    From ScreenShift with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 15
Source File: SettingsActivity.java    From logmein-android with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
    & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 16
Source File: BgGraphBuilder.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
static public boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 17
Source File: GaPreferenceActivity.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean onIsMultiPane() {
    final int layout = getResources().getConfiguration().screenLayout;
    return (layout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 18
Source File: SettingsActivity.java    From kolabnotes-android with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 19
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
static public boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 20
Source File: ThemableBrowserActivity.java    From Xndroid with GNU General Public License v3.0 4 votes vote down vote up
boolean isTablet() {
    return (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
}