List of usage examples for android.graphics Point Point
public Point()
From source file:Main.java
/** * get the screen height in pixels// w w w . j ava 2s . c o m * @param context * @return */ public static int getScreenHeight(Context context) { Display display = ((Activity) context).getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); return size.y; }
From source file:Main.java
/** * convert a gridId to a x y point/*from w w w . j a va 2 s. co m*/ * * @param id from grid TextView indicating which position in the grid it is * @return point equivalent of id parameter */ public static Point convertIDToPoint(int id, int size) { Point point = new Point(); point.x = id % size; point.y = id / size; return point; }
From source file:Main.java
public static Point getAppUsableScreenSize(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); Point size = new Point(); display.getSize(size);/*from w ww . j av a 2s . c o m*/ return size; }
From source file:Main.java
public static float getScaledWidth(WindowManager windowManager, float baseY, float basex, int exceptDis) { final Display display = windowManager.getDefaultDisplay(); Point mPoint = new Point(); getSize(display, mPoint);/*from www . java2 s. co m*/ if (exceptDis > mPoint.x) { return 0.0f; } return mPoint.x - exceptDis; }
From source file:Main.java
public static int getScreenWidth(Context context) { Display defaultDisplay = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay();/* ww w . j a v a 2 s .c o m*/ Point point = new Point(); defaultDisplay.getSize(point); return point.x; }
From source file:Main.java
public static int getDisplayWidth(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size);//from w w w.ja va 2s . c om return size.x; }
From source file:Main.java
public static int getScreenHeight(Context context) { Display defaultDisplay = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay();//from w w w . j ava2s .c om Point point = new Point(); defaultDisplay.getSize(point); return point.y; }
From source file:Main.java
public static Point getScreenDisplaySize(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point point = new Point(); if (Build.VERSION.SDK_INT >= 13) { display.getSize(point);/* www. j a v a 2 s .c om*/ } else { point = new Point(display.getWidth(), display.getHeight()); } return point; }
From source file:Main.java
public static Point getScreenSize(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { display.getSize(size);// ww w . j a va2 s. co m } else { size.set(display.getWidth(), display.getHeight()); } return size; }
From source file:Main.java
public static int getScreenMinWidth(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size);/*from ww w.j a va2 s . co m*/ return Math.min(size.x, size.y); }