Returns screen height and width

@param context
Any non-null Android Context
@param p
Optional Point to reuse. If null, a new Point will be created.
@return .x is screen width; .y is screen height.
193349
private static Point getScreenSize(Context context, Point p) {
        if (p == null) {
            p = new Point();
        }
        WindowManager windowManager = (WindowManager) context
                .getSystemService(Context.WINDOW_SERVICE);
        Display display = windowManager.getDefaultDisplay();
        display.getSize(p);
        return p;
    }
623083
public static int getCacheSize(Context ctx) {
		final DisplayMetrics displayMetrics = ctx.getResources().
				getDisplayMetrics();
		final int screenWidth = displayMetrics.widthPixels;
		final int screenHeight = displayMetrics.heightPixels;
		// 4 bytes per pixel
		final int screenBytes = screenWidth * screenHeight * 4;

		return screenBytes * 3;
	}
1050219
static Context setup(GVRContext gvrContext, ImageSizePolicy sizePolicy) {
        Context androidContext = gvrContext.getContext();
        Memory.setup(androidContext);

        if (sizePolicy == null) {
            sizePolicy = new DefaultImageSizePolicy();
        }

        Context applicationContext = androidContext.getApplicationContext();
        // Should only be null in a unit test
        applicationContext = applicationContext == null ? androidContext
                : applicationContext;

        getScreenSize(applicationContext);

        int heapSize = Memory.getMemoryClass();
        maxImageSize = (int) (heapSize * sizePolicy.getMaximumImageFactor());
        Log.d(TAG, "Set maxImageSize == %, d", maxImageSize);

        gvrContext.runOnGlThread(new Runnable() {

            @Override
            public void run() {
                onGlInitialization();
            }
        });

        return applicationContext;
    }
226650
void putScreen(Context context) {
    Map<String, Object> screen = createMap();
    WindowManager manager = getSystemService(context, Context.WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    DisplayMetrics displayMetrics = new DisplayMetrics();
    display.getMetrics(displayMetrics);
    screen.put(SCREEN_DENSITY_KEY, displayMetrics.density);
    screen.put(SCREEN_HEIGHT_KEY, displayMetrics.heightPixels);
    screen.put(SCREEN_WIDTH_KEY, displayMetrics.widthPixels);
    put(SCREEN_KEY, screen);
  }
1122000
public static void fetchWidthAndHeight(ViewGroup.LayoutParams params, TypedArray array,
                                           int widthAttr, int heightAttr) {
        params.width = array.getLayoutDimension(widthAttr, 0);
        params.height = array.getLayoutDimension(heightAttr, 0);
    }
564174
public static int getDpFromPixel(Context context, int pixel) {
		float scale = context.getResources().getDisplayMetrics().density; // get display density

		return (int)(pixel / scale);
	}
1210535
@SuppressLint("NewApi")
    @SuppressWarnings("deprecation")
    public static int getDisplayWidth(WindowManager manager) {
        Display display = manager.getDefaultDisplay();
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB_MR2) {
            Point size = new Point();
            display.getSize(size);
            return size.x;
        } else {
            return display.getWidth();
        }

    }
414460
public static Point getCenteringPointOnScreen(Dimension dimension) {
		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
		if (dimension.width > screen.width) {
			dimension.width = screen.width;
		}
		if (dimension.height > screen.height) {
			dimension.height = screen.height;
		}
		return new Point((screen.width - dimension.width) / 2, (screen.height - dimension.height) / 2);
	}
1117013
public CmsJspImageBean createWidthVariation(String widthStr) {

        CmsJspImageBean result = null;

        try {

            double baseRatio;
            if ((getOriginalScaler().getFocalPoint() != null)
                && checkCropRegionContainsFocalPoint(getScaler(), getOriginalScaler().getFocalPoint())) {
                // We use scaling mode 8 if there is a focal point, and in this case,
                // the correct aspect ratio is width x height, not cropWidth x cropHeight
                // even if cropping is set
                baseRatio = (double)getScaler().getWidth() / (double)getScaler().getHeight();
            } else if (getScaler().isCropping()) {
                // use the image crop with/height for aspect ratio calculation
                baseRatio = (double)getScaler().getCropWidth() / (double)getScaler().getCropHeight();
            } else {
                // use the image original pixel width/height for aspect ratio calculation
                baseRatio = (double)getScaler().getWidth() / (double)getScaler().getHeight();
            }

            // height is not set, calculate it with the given width and the aspect ratio
            int targetWidth = Integer.valueOf(widthStr).intValue();
            int targetHeight = (int)Math.round(targetWidth / baseRatio);

            CmsImageScaler targetScaler = createVariation(
                getWidth(),
                getHeight(),
                getBaseScaler(),
                targetWidth,
                targetHeight,
                getQuality());

            if (targetScaler != null) {
                result = createVariation(targetScaler);
            }

        } catch (NumberFormatException e) {
            if (LOG.isWarnEnabled()) {
                LOG.warn(String.format("Illegal width format: '%s' not usable for image scaling", widthStr));
            }
        }

        return result;
    }
1347582
private void setWidth(int width) {
        contentParams.width = options.fullScreenPeek() ? screenWidth : width;
        content.setLayoutParams(contentParams);
    }
646797
public String getPreviewScaleParam(int imageHeight, int imageWidth) {

        int maxHeight = m_previewDialog.getPreviewHeight() - 4;
        int maxWidth = m_previewDialog.getDialogWidth() - 10;
        if (m_croppingParam != null) {
            return m_croppingParam.getRestrictedSizeScaleParam(maxHeight, maxWidth);
        }
        if ((imageHeight <= maxHeight) && (imageWidth <= maxWidth)) {
            return ""; // dummy parameter, doesn't actually do anything
        }
        CmsCroppingParamBean restricted = new CmsCroppingParamBean();
        restricted.setTargetHeight(imageHeight > maxHeight ? maxHeight : imageHeight);
        restricted.setTargetWidth(imageWidth > maxWidth ? maxWidth : imageWidth);
        return restricted.toString();
    }
1226689
public static int getScreenWidth(final GraphicsDevice graphicsDevice)
	{
		final GraphicsConfiguration[] graphicsConfigurations = graphicsDevice.getConfigurations();
		final GraphicsConfiguration graphicsConfiguration = ArrayExtensions
			.getFirst(graphicsConfigurations);
		if (graphicsConfiguration != null)
		{
			final Rectangle bounds = graphicsConfiguration.getBounds();
			final double width = bounds.getWidth();
			return (int)width;
		}
		return getScreenWidth();
	}
1129976
public int getSize() {
        int ret = 0;
        MethodState state = firstPointer;
        while (state != null) {
            ret++;
            state = state.getNext();
        }
        return ret;
    }
1147835
public static int getScreenHeight(Context context) {
        DisplayMetrics metrics = context.getResources().getDisplayMetrics();
        return metrics.heightPixels;
    }
76351
public static int dpToPx(Context context, float dp) {
    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
    return (int) ((dp * displayMetrics.density) + 0.5);
  }
919861
function(context){
		var chart = this;
		this.canvas = context.canvas;

		this.ctx = context;

		//Variables global to the chart
		var computeDimension = function(element,dimension)
		{
			if (element['offset'+dimension])
			{
				return element['offset'+dimension];
			}
			else
			{
				return document.defaultView.getComputedStyle(element).getPropertyValue(dimension);
			}
		};

		var width = this.width = computeDimension(context.canvas,'Width') || context.canvas.width;
		var height = this.height = computeDimension(context.canvas,'Height') || context.canvas.height;

		this.aspectRatio = this.width / this.height;
		//High pixel density displays - multiply the size of the canvas height/width by the device pixel ratio, then scale.
		helpers.retinaScale(this);

		return this;
	}
1040049
@SuppressWarnings("deprecation")
    @SuppressLint("NewApi")
    public static int getScreenWidth(Activity context) {

        Display display = context.getWindowManager().getDefaultDisplay();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
            Point size = new Point();
            display.getSize(size);
            return size.x;
        }
        return display.getWidth();
    }