List of usage examples for android.view Display getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:com.xxxifan.devbox.core.util.ViewUtils.java
private static DisplayMetrics getDisplayMetrics() { Display display = ((WindowManager) Devbox.getAppDelegate().getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay();//from w w w.j av a2 s . c om DisplayMetrics metrics = new DisplayMetrics(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { ((WindowManager) Devbox.getAppDelegate().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay() .getRealMetrics(metrics); } else { try { Method method = display.getClass().getMethod("getRealMetrics", DisplayMetrics.class); method.invoke(display, metrics); } catch (Exception e) { e.printStackTrace(); } } return metrics; }
From source file:org.acra.collector.DisplayManagerCollector.java
@NonNull private String collectFlags(@NonNull Display display) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { final int flags = display.getFlags(); for (Field field : display.getClass().getFields()) { if (field.getName().startsWith("FLAG_")) { try { flagNames.put(field.getInt(null), field.getName()); } catch (IllegalAccessException ignored) { }// w w w .j a va 2 s .c o m } } return display.getDisplayId() + ".flags=" + activeFlags(flags) + '\n'; } return ""; }
From source file:me.wimanacra.collector.DisplayManagerCollector.java
private void collectFlags(@NonNull Display display, @NonNull JSONObject container) throws JSONException { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { final int flags = display.getFlags(); for (Field field : display.getClass().getFields()) { if (field.getName().startsWith("FLAG_")) { try { flagNames.put(field.getInt(null), field.getName()); } catch (IllegalAccessException ignored) { }//from w w w.j av a 2 s.co m } } container.put("flags", activeFlags(flags)); } }
From source file:com.scoreflex.Scoreflex.java
@SuppressWarnings("deprecation") @SuppressLint("NewApi") private static Point getScreenSize() { final Point size = new Point(); WindowManager w = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE); Display d = w.getDefaultDisplay(); try {/*from w ww .j av a 2 s . com*/ Method getSizeMethod = d.getClass().getDeclaredMethod("getSize", Point.class); getSizeMethod.invoke(d, size); } catch (Exception e) { size.x = d.getWidth(); size.y = d.getHeight(); } return size; }
From source file:org.videolan.vlc.gui.video.VideoPlayerActivity.java
@SuppressWarnings("deprecation") private int getScreenRotation() { WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO /* Android 2.2 has getRotation */) { try {//from w w w . ja v a 2 s . c o m Method m = display.getClass().getDeclaredMethod("getRotation"); return (Integer) m.invoke(display); } catch (Exception e) { return Surface.ROTATION_0; } } else { return display.getOrientation(); } }