Example usage for android.graphics Rect set

List of usage examples for android.graphics Rect set

Introduction

In this page you can find the example usage for android.graphics Rect set.

Prototype

public void set(Rect src) 

Source Link

Document

Copy the coordinates from src into this rectangle.

Usage

From source file:org.androfarsh.widget.DragGridLayout.java

private boolean requestHoverRect(Rect rect) {
    rect.setEmpty();//from  www .  j  ava  2s  .  com
    for (final Cell cell : mHoveredCells) {
        if (!rect.isEmpty()) {
            rect.union(cell.rect);
        } else {
            rect.set(cell.rect);
        }
    }
    return !mHoveredCells.isEmpty() && !rect.isEmpty();
}

From source file:org.androfarsh.widget.DragGridLayout.java

private Cell findCellUnder(Rect rect) {
    Cell resCell = null;//from  ww  w. j  a  v  a2s . c  o  m
    final Rect resRect = new Rect();
    for (final Cell cell : mCells) {
        if (mTmpRect.setIntersect(cell.rect, rect)) {
            if ((resCell == null)
                    || ((mTmpRect.width() * mTmpRect.height()) > (resRect.width() * resRect.height()))) {
                resRect.set(mTmpRect);
                resCell = cell;
            }
        }
    }

    return resCell;
}

From source file:me.ccrama.redditslide.Views.SubsamplingScaleImageView.java

/**
 * Converts source rectangle from tile, which treats the image file as if it were in the correct orientation already,
 * to the rectangle of the image that needs to be loaded.
 *//*from  w  w w  . j  av  a 2  s.c  om*/
@SuppressWarnings("SuspiciousNameCombination")
private void fileSRect(Rect sRect, Rect target) {
    if (getRequiredRotation() == 0) {
        target.set(sRect);
    } else if (getRequiredRotation() == 90) {
        target.set(sRect.top, sHeight - sRect.right, sRect.bottom, sHeight - sRect.left);
    } else if (getRequiredRotation() == 180) {
        target.set(sWidth - sRect.right, sHeight - sRect.bottom, sWidth - sRect.left, sHeight - sRect.top);
    } else {
        target.set(sWidth - sRect.bottom, sRect.left, sWidth - sRect.top, sRect.right);
    }
}

From source file:android.support.design.widget.CoordinatorLayout.java

/**
 * Get the last known child rect recorded by
 * {@link #recordLastChildRect(View, Rect)}.
 *
 * @param child child view to retrieve from
 * @param out rect to set to the outpur values
 *//* www.j  ava2s  .c  om*/
void getLastChildRect(View child, Rect out) {
    final LayoutParams lp = (LayoutParams) child.getLayoutParams();
    out.set(lp.getLastChildRect());
}