List of usage examples for android.content Context WINDOW_SERVICE
String WINDOW_SERVICE
To view the source code for android.content Context WINDOW_SERVICE.
Click Source Link
From source file:com.androidzeitgeist.webcards.overlay.HandleView.java
public HandleView(Context context) { super(context); windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); final Resources resources = getResources(); margin = resources.getDimensionPixelSize(R.dimen.overlay_button_margin); openOffsetX = resources.getDimensionPixelSize(R.dimen.overlay_width); paint = new Paint(); paint.setColor(ContextCompat.getColor(context, R.color.overlayAccent)); paint.setAntiAlias(true);/* w w w .j av a 2 s . c o m*/ streamBitmap = BitmapFactory.decodeResource(resources, R.drawable.ic_action_stream); openAppBitmap = BitmapFactory.decodeResource(resources, R.drawable.ic_action_open_app); currentBitmap = openAppBitmap; setElevation(resources.getDimensionPixelSize(R.dimen.overlay_button_elevation)); setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setOval(0, 0, getWidth(), getHeight()); } }); }
From source file:com.google.sample.cast.refplayer.utils.Utils.java
@SuppressWarnings("deprecation") /**/*www. jav a 2 s . c o m*/ * Returns the screen/display size * */ public static Point getDisplaySize(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight(); return new Point(width, height); }
From source file:ac.robinson.bettertogether.QRPopupWindow.java
@SuppressLint("InflateParams") QRPopupWindow(View anchorView) {/*from w ww.j a v a 2 s . com*/ mAnchorView = anchorView; mWindowManager = (WindowManager) mAnchorView.getContext().getSystemService(Context.WINDOW_SERVICE); mPopupWindow = new PopupWindow(mAnchorView.getContext()); LayoutInflater inflater = (LayoutInflater) mAnchorView.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); mPopupWindow.setContentView(inflater.inflate(R.layout.dialog_qr_code, null)); mPopupWindow.setTouchInterceptor(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { dismissPopUp(); return true; } }); }
From source file:com.jerrellmardis.amphitheatre.util.Utils.java
/** * Returns the screen/display size//from www . ja v a 2 s .c om * * @param context * @return */ public static Point getDisplaySize(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int height = size.y; return new Point(width, height); }
From source file:com.landenlabs.flipanimation.Ui.java
/** * @return DisplayMetrics//from www . j ava2s . c o m */ public static DisplayMetrics getDisplayMetrics(Context context) { DisplayMetrics dm = new DisplayMetrics(); ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(dm); return dm; }
From source file:com.king.android.common.widget.badge.BGADragBadgeView.java
public BGADragBadgeView(Context context, BGABadgeViewHelper badgeViewHelper) { super(context); mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); mBadgeViewHelper = badgeViewHelper;/*from w w w . j a v a 2 s . co m*/ mAnimator = new ValueAnimator(); initBadgePaint(); initLayoutParams(); }
From source file:net.kevxu.muzei.interfacelift.InterfaceliftMacdropsClient.java
/** * Get suitable photo size based on the screen size of phone. * * @return Dimension Dimension of suitable photo size. *//*www . ja v a2 s . c o m*/ protected Dimension getSuitablePhotoDimension() { WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); Point size = new Point(); display.getRealSize(size); final int width = size.x; final int height = size.y; int screenLayout = mContext.getResources().getConfiguration().screenLayout; boolean isXlarge = ((screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE); boolean isLarge = ((screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE); final boolean isTablet = isXlarge || isLarge; Dimension dimen; if (!isTablet) { // Wallpaper for phone needs at least [width x 2] x height dimen = new Dimension(width * 2, height); } else { // Wallpaper for tablet needs at least [long edge] x [long edge] int longEdge = width > height ? width : height; dimen = new Dimension(longEdge, longEdge); } return dimen; }
From source file:com.github.shareme.gwscleanstatusbar.CleanStatusBarService.java
@Override public void onCreate() { super.onCreate(); mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); sIsRunning = true;/* w w w .ja v a 2 s . co m*/ }
From source file:com.fastaccess.tfl.ui.widget.drag.DragView.java
public DragView(Context context, Bitmap bitmap, int registrationX, int registrationY, int left, int top, int width, int height) { super(context); mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Matrix scale = new Matrix(); float scaleFactor = width; scaleFactor = mScale = (scaleFactor + DRAG_SCALE) / scaleFactor; scale.setScale(scaleFactor, scaleFactor); mBitmap = Bitmap.createBitmap(bitmap, left, top, width, height, scale, true); mRegistrationX = registrationX + (DRAG_SCALE / 2); mRegistrationY = registrationY + (DRAG_SCALE / 2); }
From source file:com.amazon.android.utils.Helpers.java
/** * Returns the screen/display size./*from w ww. ja v a 2s . com*/ * * @param context The context. * @return The display size. */ public static Point getDisplaySize(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size); return size; }