1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.chromium.ui.base;
7 import android.content.Context;
9 import org.chromium.base.CalledByNative;
12 * UI utilities for accessing form factor information.
14 public class DeviceFormFactor {
17 * The minimum width that would classify the device as a tablet.
19 private static final int MINIMUM_TABLET_WIDTH_DP = 600;
21 private static Boolean sIsTablet = null;
24 * @param context Android's context
25 * @return Whether the app is should treat the device as a tablet for layout.
28 public static boolean isTablet(Context context) {
29 if (sIsTablet == null) {
30 int minimumScreenWidthDp = context.getResources().getConfiguration()
31 .smallestScreenWidthDp;
32 sIsTablet = minimumScreenWidthDp >= MINIMUM_TABLET_WIDTH_DP;