List of usage examples for android.view Display getRealSize
public void getRealSize(Point outSize)
From source file:Main.java
public static void getRealSize(Display display, Point outSize) { display.getRealSize(outSize); }
From source file:Main.java
@TargetApi(17) private static void getDisplaySizeV17(Display display, Point outSize) { display.getRealSize(outSize); }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.KITKAT) public static int getWidthKitKat(Display display) { Point point = new Point(); display.getRealSize(point); return point.x; }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static int getRealHeight(Display display) { int height;/* w w w . j ava2 s .c o m*/ try { Point size = new Point(); display.getRealSize(size); height = size.y; } catch (NoSuchMethodError e) { height = display.getHeight(); } return height; }
From source file:Main.java
public static Point getRealScreenSize(Activity activity) { Point result = new Point(); Display display = activity.getWindowManager().getDefaultDisplay(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { display.getRealSize(result); } else {/*from w ww . ja va 2s . co m*/ display.getSize(result); } return result; }
From source file:Main.java
/** * Computes the navigation bar height comparing the usable screen height and the real display height. * Please note that the system status bar is considered part of the usable screen height. * @param context Android Context instance * @return The height in pixels of the system navigation bar *//*from www.ja va 2s . com*/ public static int getNavigationBarSize(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); //noinspection ConstantConditions Display display = windowManager.getDefaultDisplay(); Point appUsableSize = new Point(); display.getSize(appUsableSize); Point realScreenSize = new Point(); display.getRealSize(realScreenSize); return realScreenSize.y - appUsableSize.y; }
From source file:com.android.leanlauncher.LauncherAppState.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) static DynamicGrid createDynamicGrid(Context context, DynamicGrid dynamicGrid) { // Determine the dynamic grid properties WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point realSize = new Point(); display.getRealSize(realSize); DisplayMetrics dm = new DisplayMetrics(); display.getMetrics(dm);//from w w w .j av a 2s . co m if (dynamicGrid == null) { Point smallestSize = new Point(); Point largestSize = new Point(); display.getCurrentSizeRange(smallestSize, largestSize); dynamicGrid = new DynamicGrid(context, context.getResources(), Math.min(smallestSize.x, smallestSize.y), Math.min(largestSize.x, largestSize.y), realSize.x, realSize.y, dm.widthPixels, dm.heightPixels); } // Update the icon size DeviceProfile grid = dynamicGrid.getDeviceProfile(); grid.updateFromConfiguration(context, context.getResources(), realSize.x, realSize.y, dm.widthPixels, dm.heightPixels); return dynamicGrid; }
From source file:org.acra.collector.DisplayManagerCollector.java
private static String collectRealSize(@NonNull Display display) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { final Point size = new Point(); display.getRealSize(size); return display.getDisplayId() + ".realSize=[" + size.x + ',' + size.y + ']' + '\n'; }// w w w . ja v a 2s. co m return ""; }
From source file:com.dm.material.dashboard.candybar.helpers.ViewHelper.java
public static Point getRealScreenSize(@NonNull Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); Point size = new Point(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { display.getRealSize(size); } else {/*from w ww. j av a 2 s .co m*/ try { size.x = (Integer) Display.class.getMethod("getRawWidth").invoke(display); size.y = (Integer) Display.class.getMethod("getRawHeight").invoke(display); } catch (Exception e) { size.x = display.getWidth(); size.y = display.getHeight(); } } return size; }
From source file:me.wimanacra.collector.DisplayManagerCollector.java
private static void collectRealSize(@NonNull Display display, JSONObject container) throws JSONException { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { final Point size = new Point(); display.getRealSize(size); container.put("realSize", new JSONArray(Arrays.asList(size.x, size.y))); }//from www. jav a 2 s.c om }