Android Rect - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Rect class.

This code example shows how to use the following methods:height, width
    if (framingRectInPreview == null) {
      Rect framingRect = getFramingRect();
      if (framingRect == null) {
        return null; 
      } 
      Rect rect = new Rect(framingRect);
      Point cameraResolution = configManager.getCameraResolution();
      Point screenResolution = configManager.getScreenResolution();
      if (cameraResolution == null || screenResolution == null) {
        // Called early, before init even finished 
        return null; 
      } 
      rect.left = rect.left * cameraResolution.x / screenResolution.x;
      rect.right = rect.right * cameraResolution.x / screenResolution.x;
      rect.top = rect.top * cameraResolution.y / screenResolution.y;
      rect.bottom = rect.bottom * cameraResolution.y / screenResolution.y;
      framingRectInPreview = rect;
    } 
    return framingRectInPreview;
  } 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:height, width
This code example shows how to use the following methods:
public abstract class QuickActionWidget extends PopupWindow {
 
    private static final int MEASURE_AND_LAYOUT_DONE = 1 << 1;
 
    private final int[] mLocation = new int[2];
    private final Rect mRect = new Rect();
 
    private int mPrivateFlags;
 
    private Context mContext;
 
    private boolean mDismissOnClick;
    private int mArrowOffsetY;
 
    private int mPopupY;
    private boolean mIsOnTop;
 
    private int mScreenHeight;
    private int mScreenWidth;
    private boolean mIsDirty;
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:set, sleep
 
        Canvas c = null;
        if (onAllowLockCanvas()) { 
            if (dirty == null) {
                if (mTmpDirty == null) {
                    mTmpDirty = new Rect();
                } 
                mTmpDirty.set(mSurfaceFrame);
                dirty = mTmpDirty;
            } 
 
            try { 
                c = mSurface.lockCanvas(dirty);
            } catch (Exception e) {
                Log.e(TAG, "Exception locking surface", e);
            } 
        } 
 
        if (DEBUG) Log.i(TAG, "Returned canvas: " + c);
        if (c != null) {

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:height, width
		Rect r = computeLayout();
		if (edge == GROW_NONE) {
			return; 
		} else if (edge == MOVE) {
			// Convert to image space before sending to moveBy(). 
			moveBy(dx * (mCropRect.width() / r.width()), dy * (mCropRect.height() / r.height()));
		} else { 
			if (((GROW_LEFT_EDGE | GROW_RIGHT_EDGE) & edge) == 0) {
				dx = 0;
			} 
 
			if (((GROW_TOP_EDGE | GROW_BOTTOM_EDGE) & edge) == 0) {
				dy = 0;
			} 
 
			// Convert to image space before sending to growBy(). 
			float xDelta = dx * (mCropRect.width() / r.width());
			float yDelta = dy * (mCropRect.height() / r.height());
			growBy((((edge & GROW_LEFT_EDGE) != 0) ? -1 : 1) * xDelta, (((edge & GROW_TOP_EDGE) != 0) ? -1 : 1)
					* yDelta);

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:centerX, centerY, height, width
    } 
 
    @Override 
    protected void onDraw(Canvas canvas) {
        BitmapDrawable bmDrawable = (BitmapDrawable) getDrawable();
        Rect rect = new Rect();
        getDrawingRect(rect);
        Bitmap product = Bitmap.createBitmap(rect.width(), rect.height(), Bitmap.Config.ARGB_8888);
 
        if (bmDrawable != null && bmDrawable.getBitmap() != null) {
            product.setDensity(bmDrawable.getBitmap().getDensity());
            Canvas c = new Canvas(product);
            c.setDensity(canvas.getDensity());
            c.drawColor(mFillColor);
            super.onDraw(c);
            if (maskDrawable != null) {
                Paint p = new Paint();
                p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
                c.drawBitmap(maskDrawable.getBitmap(), null, rect, p);
            } else if (maskDrawableNine != null) {

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:height, width
This code example shows how to use the following methods:height, width
      case PixelFormat.YCbCr_420_SP:
      // This format has never been seen in the wild, but is compatible as we only care 
      // about the Y channel, so allow it. 
      case PixelFormat.YCbCr_422_SP:
        return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
            rect.width(), rect.height());
      default: 
        // The Samsung Moment incorrectly uses this variant instead of the 'sp' version. 
        // Fortunately, it too has all the Y data up front, so we can read it. 
        if ("yuv420p".equals(previewFormatString)) {
          return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
            rect.width(), rect.height());
        } 
    } 
    throw new IllegalArgumentException("Unsupported picture format: " +
        previewFormat + '/' + previewFormatString);
  } 
 
} 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
public class RecentApplicationsBackground extends LinearLayout {
    private static final String TAG = "RecentApplicationsBackground";
 
    private boolean mBackgroundSizeChanged;
    private Drawable mBackground;
    private Rect mTmp0 = new Rect();
    private Rect mTmp1 = new Rect();
 
    public RecentApplicationsBackground(Context context) {
        this(context, null);
        init(); 
    } 
 
    public RecentApplicationsBackground(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(); 
    } 
 
    private void init() { 
        mBackground = getBackground();
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:

Related Android Rect Questions & Answers:

See Code Examples for Android Rect Methods: