use of android.view.Display in project platform_frameworks_base by android.
the class WallpaperManagerService method getMaximumSizeDimension.
private int getMaximumSizeDimension() {
WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
Display d = wm.getDefaultDisplay();
return d.getMaximumSizeDimension();
}
use of android.view.Display in project libgdx by libgdx.
the class AndroidGraphics method onSurfaceCreated.
@Override
public void onSurfaceCreated(javax.microedition.khronos.opengles.GL10 gl, EGLConfig config) {
eglContext = ((EGL10) EGLContext.getEGL()).eglGetCurrentContext();
setupGL(gl);
logConfig(config);
updatePpi();
Mesh.invalidateAllMeshes(app);
Texture.invalidateAllTextures(app);
Cubemap.invalidateAllCubemaps(app);
TextureArray.invalidateAllTextureArrays(app);
ShaderProgram.invalidateAllShaderPrograms(app);
FrameBuffer.invalidateAllFrameBuffers(app);
logManagedCachesStatus();
Display display = app.getWindowManager().getDefaultDisplay();
this.width = display.getWidth();
this.height = display.getHeight();
this.mean = new WindowedMean(5);
this.lastFrameTime = System.nanoTime();
gl.glViewport(0, 0, this.width, this.height);
}
use of android.view.Display in project NoHttp by yanzhenjie.
the class DisplayUtils method initScreen.
/**
* 初始化屏幕宽度和高度
*/
public static void initScreen(Activity activity) {
if (isInitialize)
return;
isInitialize = true;
Display display = activity.getWindowManager().getDefaultDisplay();
DisplayMetrics metric = new DisplayMetrics();
// 屏幕宽度、高度、密度、缩放因子
if (VERSION.SDK_INT >= 17) {
display.getRealMetrics(metric);
} else {
try {
Class<?> clazz = Class.forName("android.view.Display");
Method method = clazz.getMethod("getRealMetrics", DisplayMetrics.class);
method.invoke(display, metric);
} catch (Throwable e) {
display.getMetrics(metric);
}
}
try {
// 状态栏高度
Class<?> clazz = Class.forName("com.android.internal.R$dimen");
Field field = clazz.getField("status_bar_height");
int x = Integer.parseInt(field.get(clazz.newInstance()).toString());
statusBarHeight = activity.getResources().getDimensionPixelSize(x);
} catch (Throwable e) {
e.printStackTrace();
Rect outRect = new Rect();
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(outRect);
statusBarHeight = outRect.top;
}
screenWidth = metric.widthPixels;
screenHeight = metric.heightPixels;
screenDpi = metric.densityDpi;
density = metric.density;
scaledDensity = metric.scaledDensity;
if (screenWidth >= 320 && screenWidth < 480) {
displayType = DISPLAY_SMALL;
} else if (screenWidth >= 480 && screenWidth < 720) {
displayType = DISPLAY_MIDDLE;
} else if (screenWidth >= 720 && screenWidth < 1080) {
displayType = DISPLAY_LARGE;
} else {
displayType = DISPLAY_XLARGE;
}
}
use of android.view.Display in project TourGuide by worker8.
the class ToolTilMeasureTest method getScreenHeight.
public int getScreenHeight(Activity activity) {
Display display = activity.getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
return size.y;
}
use of android.view.Display in project WordPress-Android by wordpress-mobile.
the class StatsUIHelper method isInLandscape.
private static boolean isInLandscape(Activity act) {
Display display = act.getWindowManager().getDefaultDisplay();
Point point = new Point();
display.getSize(point);
return (point.y < point.x);
}
Aggregations