Skip to content

Commit

Permalink
Merge pull request #1860 from wordpress-mobile/issue/1821-remove-ista…
Browse files Browse the repository at this point in the history
…blet

fix #1821: remove DisplayUtis.isTablet() method
  • Loading branch information
nbradbury committed Sep 12, 2014
2 parents 4e92eaa + cbc7b24 commit c38f131
Showing 1 changed file with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ public static boolean isLandscape(Context context) {
return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
}

public static boolean isLandscapeTablet(Context context) {
return isLandscape(context) && isTablet(context);
}

public static Point getDisplayPixelSize(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Expand All @@ -43,7 +39,8 @@ public static int getDisplayPixelHeight(Context context) {
}

public static int dpToPx(Context context, int dp) {
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp,
context.getResources().getDisplayMetrics());
return (int) px;
}

Expand All @@ -52,20 +49,11 @@ public static int pxToDp(Context context, int px) {
return (int) ((px/displayMetrics.density)+0.5);
}

/**
* Deprecated method, returns true on some phones.
*/
@Deprecated
public static boolean isTablet(Context context) {
// http://stackoverflow.com/a/8427523/1673548
if (context == null)
return false;
return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}

public static boolean isXLarge(Context context) {
if ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE)
if ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)
== Configuration.SCREENLAYOUT_SIZE_XLARGE) {
return true;
}
return false;
}

Expand Down

0 comments on commit c38f131

Please sign in to comment.