Java Code Examples for android.graphics.RectF#intersects()

The following examples show how to use android.graphics.RectF#intersects() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractViewController.java    From document-viewer with GNU General Public License v3.0 6 votes vote down vote up
protected final boolean processLinkTap(final Page page, final PageLink link, final RectF pageBounds,
        final RectF tapRect) {
    final RectF linkRect = page.getLinkSourceRect(pageBounds, link);
    if (linkRect == null || !RectF.intersects(linkRect, tapRect)) {
        return false;
    }

    if (LCTX.isDebugEnabled()) {
        LCTX.d("Page link found under tap: " + link);
    }

    if (link.url != null) {
        goToURL(link.url);
        return true;
    }

    goToLink(link.targetPage, link.targetRect, AppSettings.current().storeLinkGotoHistory);
    return true;
}
 
Example 2
Source File: OC_Numberlines_S2f.java    From GLEXP-Team-onebillion with Apache License 2.0 6 votes vote down vote up
public void checkLineDrop(OBControl cont) throws Exception
{
    OBControl workRect = objectDict.get("numberline");
    RectF targetRect = new RectF(workRect.frame());

    targetRect.inset(-1.1f * workRect.width(), 0.3f * workRect.height());

    if (RectF.intersects(targetRect, cont.frame()))
    {

        playAudio("correct");
        OBAnimationGroup.runAnims(Arrays.asList(OBAnim.moveAnim(divPositions.get(11 - eventTargets.size()), cont)), 0.2, true, OBAnim.ANIM_EASE_IN_EASE_OUT, this);
        objectDict.put(String.format("divline_%d", (int) (11 - eventTargets.size())), cont);
        continueDrag(cont);
    }
    else
    {
        playAudio(null);
        OBAnimationGroup.runAnims(Arrays.asList(OBAnim.moveAnim((PointF)cont.propertyValue("startpos"), cont)), 0.2, true, OBAnim.ANIM_EASE_IN_EASE_OUT, this);
        cont.setZPosition(cont.zPosition() - 10);
        setStatus(STATUS_WAITING_FOR_DRAG);
    }
}
 
Example 3
Source File: Polygon.java    From mil-sym-android with Apache License 2.0 5 votes vote down vote up
/**
     * {@inheritDoc}
     * @since 1.2
     */
    public boolean intersects(double x, double y, double w, double h) {
        if (npoints <= 0 || !getBoundingBox().intersects(x, y, w, h)) {
            return false;
        }

        //Crossings cross = getCrossings(x, y, x+w, y+h);
        //return (cross == null || !cross.isEmpty());
        if (bounds != null) {
            float fx = (float) x;
            float fy = (float) y;
            float fw = (float) w;
            float fh = (float) h;
//not sure if math is correct here
            Path that = new Path();
//start
            that.moveTo(fx, fy);
//go right
            that.lineTo(fx + fw, fy);
//go down
            that.lineTo(fx + fw, fy - fh);
//go left
            that.lineTo(fx, fy - fh);
//close
            that.close();
//bounds holder
            RectF thatBounds = new RectF();
            RectF rectf=new RectF((float)bounds.x,(float)bounds.y,(float)bounds.x+(float)bounds.width,(float)bounds.y+(float)bounds.height);
            return RectF.intersects(rectf, thatBounds);
        } 
        else 
        {
            return false;
        }        
    }
 
Example 4
Source File: ActualNumberPicker.java    From actual-number-picker with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Checks whether the text overlaps the bar that is about to be drawn.<br>
 * <b>Note</b>: This method fakes the text width, i.e. increases it to allow for some horizontal padding.
 *
 * @param textBounds Which text bounds to check
 * @param barBounds Which bar bounds to check
 * @return {@code True} if bounds overlap each other, {@code false} if not
 */
private boolean textOverlapsBar(Rect textBounds, RectF barBounds) {
    if (!mShowText || mDrawOverText) {
        // no text, no overlapping; draw over text, no overlapping
        return false;
    }

    // increase original text width to give some padding to the text
    double factor = 0.6d;
    int textL = textBounds.left - scale(textBounds.width(), factor);
    int textT = textBounds.top;
    int textR = textBounds.right + scale(textBounds.width(), factor);
    int textB = textBounds.bottom;
    return barBounds.intersects(textL, textT, textR, textB);
}
 
Example 5
Source File: OC_MoreAddSubtract_S6i.java    From GLEXP-Team-onebillion with Apache License 2.0 5 votes vote down vote up
@Override
public void touchUpAtPoint(PointF pt, View v)
{

            if (status() == STATUS_DRAGGING && target!=null){
                setStatus(STATUS_BUSY);
                final OBControl targ = target;
                target = null;

                OBControl searchDrop = null;
                for(OBControl con : dropTargets)
                {

                    if(RectF.intersects(con.frame(),targ.frame()))
                    {
                        searchDrop = con;
                        break;
                    }
                }

                final OBControl drop = searchDrop;

                OBUtils.runOnOtherThread(new OBUtils.RunLambda()
                {
                    public void run() throws Exception
                    {
                        checkDrop(targ, drop);
                    }
                });
            }
}
 
Example 6
Source File: VirtualKeyboard.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
protected void snapKeys() {
	obscuresVirtualScreen = false;
	for (int i = 0; i < keypad.length; i++) {
		snapKey(i, 0);
		VirtualKey key = keypad[i];
		if (key.isVisible() && RectF.intersects(key.getRect(), virtualScreen)) {
			obscuresVirtualScreen = true;
			key.intersectsScreen = true;
		} else {
			key.intersectsScreen = false;
		}
	}
}
 
Example 7
Source File: GameManager.java    From Simple-Solitaire with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Use the rectangles of the card and the stacks to determinate if they intersect and if the card
 * can be placed on that stack. If so, save the stack and the amount of intersection.
 * If another stack is also a possible destination AND has a higher intersection rate, save the
 * new stack instead. So at the end, the best possible destination will be returned.
 * <p>
 * It takes one card and tests every stack (expect the stack, where the card is located on)
 *
 * @param card The card to test
 * @return A possible destination with the highest intersection
 */
private Stack getIntersectingStack(Card card) {

    RectF cardRect = new RectF(card.getX(), card.getY(),
            card.getX() + card.view.getWidth(),
            card.getY() + card.view.getHeight());

    Stack returnStack = null;
    float overlapArea = 0;

    for (Stack stack : stacks) {
        if (card.getStack() == stack)
            continue;

        RectF stackRect = stack.getRect();

        if (RectF.intersects(cardRect, stackRect)) {
            float overlapX = max(0, min(cardRect.right, stackRect.right) - max(cardRect.left, stackRect.left));
            float overlapY = max(0, min(cardRect.bottom, stackRect.bottom) - max(cardRect.top, stackRect.top));

            if (overlapX * overlapY > overlapArea && card.test(stack)) {
                overlapArea = overlapX * overlapY;
                returnStack = stack;
            }
        }
    }

    return returnStack;
}
 
Example 8
Source File: Page.java    From Mupdf with Apache License 2.0 4 votes vote down vote up
public boolean isVisible() {
    return RectF.intersects(documentView.getViewRect(), bounds);
}
 
Example 9
Source File: SelectionActionModeHelper.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Merges a {@link RectF} into an existing list of any objects which contain a rectangle.
 * While merging, this method makes sure that:
 *
 * <ol>
 * <li>No rectangle is redundant (contained within a bigger rectangle)</li>
 * <li>Rectangles of the same height and vertical position that intersect get merged</li>
 * </ol>
 *
 * @param list      the list of rectangles (or other rectangle containers) to merge the new
 *                  rectangle into
 * @param candidate the {@link RectF} to merge into the list
 * @param extractor a function that can extract a {@link RectF} from an element of the given
 *                  list
 * @param packer    a function that can wrap the resulting {@link RectF} into an element that
 *                  the list contains
 * @hide
 */
@VisibleForTesting
public static <T> void mergeRectangleIntoList(final List<T> list,
        final RectF candidate, final Function<T, RectF> extractor,
        final Function<RectF, T> packer) {
    if (candidate.isEmpty()) {
        return;
    }

    final int elementCount = list.size();
    for (int index = 0; index < elementCount; ++index) {
        final RectF existingRectangle = extractor.apply(list.get(index));
        if (existingRectangle.contains(candidate)) {
            return;
        }
        if (candidate.contains(existingRectangle)) {
            existingRectangle.setEmpty();
            continue;
        }

        final boolean rectanglesContinueEachOther = candidate.left == existingRectangle.right
                || candidate.right == existingRectangle.left;
        final boolean canMerge = candidate.top == existingRectangle.top
                && candidate.bottom == existingRectangle.bottom
                && (RectF.intersects(candidate, existingRectangle)
                || rectanglesContinueEachOther);

        if (canMerge) {
            candidate.union(existingRectangle);
            existingRectangle.setEmpty();
        }
    }

    for (int index = elementCount - 1; index >= 0; --index) {
        final RectF rectangle = extractor.apply(list.get(index));
        if (rectangle.isEmpty()) {
            list.remove(index);
        }
    }

    list.add(packer.apply(candidate));
}
 
Example 10
Source File: AbstractChart.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
protected void drawLabel(Canvas canvas, String s, DefaultRenderer defaultrenderer, List list, int i, int j, float f, 
        float f1, float f2, float f3, int k, int l, int i1, Paint paint, 
        boolean flag, boolean flag1)
{
    if (defaultrenderer.isShowLabels() || flag1)
    {
        paint.setColor(i1);
        double d = Math.toRadians(90F - (f2 + f3 / 2.0F));
        double d1 = Math.sin(d);
        double d2 = Math.cos(d);
        int j1 = Math.round((float)i + (float)(d1 * (double)f));
        int k1 = Math.round((float)j + (float)(d2 * (double)f));
        int l1 = Math.round((float)i + (float)(d1 * (double)f1));
        int i2 = Math.round((float)j + (float)(d2 * (double)f1));
        float f4 = defaultrenderer.getLabelsTextSize();
        float f5 = Math.max(f4 / 2.0F, 10F);
        paint.setTextAlign(android.graphics.Paint.Align.LEFT);
        if (j1 > l1)
        {
            f5 = -f5;
            paint.setTextAlign(android.graphics.Paint.Align.RIGHT);
        }
        float f6 = f5;
        float f7 = f6 + (float)l1;
        float f8 = i2;
        float f9 = (float)l - f7;
        if (j1 > l1)
        {
            f9 = f7 - (float)k;
        }
        String s1 = a(s, f9, paint);
        float f10 = paint.measureText(s1);
        boolean flag2 = false;
        while (!flag2 && flag) 
        {
            boolean flag3 = false;
            int k2 = list.size();
            int l2 = 0;
            float f11 = f8;
            while (l2 < k2 && !flag3) 
            {
                RectF rectf = (RectF)list.get(l2);
                int j2;
                boolean flag4;
                float f12;
                if (rectf.intersects(f7, f11, f7 + f10, f11 + f4))
                {
                    f12 = Math.max(f11, rectf.bottom);
                    flag4 = true;
                } else
                {
                    flag4 = flag3;
                    f12 = f11;
                }
                l2++;
                f11 = f12;
                flag3 = flag4;
            }
            if (!flag3)
            {
                flag2 = true;
            } else
            {
                flag2 = false;
            }
            f8 = f11;
        }
        if (flag)
        {
            j2 = (int)(f8 - f4 / 2.0F);
            canvas.drawLine(j1, k1, l1, j2, paint);
            canvas.drawLine(l1, j2, f6 + (float)l1, j2, paint);
        } else
        {
            paint.setTextAlign(android.graphics.Paint.Align.CENTER);
        }
        canvas.drawText(s1, f7, f8, paint);
        if (flag)
        {
            list.add(new RectF(f7, f8, f7 + f10, f8 + f4));
        }
    }
}
 
Example 11
Source File: PageTreeNode.java    From AndroidPDF with Apache License 2.0 4 votes vote down vote up
private boolean isVisible() {
    return RectF.intersects(documentView.getViewRect(), getTargetRectF());
}
 
Example 12
Source File: Page.java    From AndroidPDF with Apache License 2.0 4 votes vote down vote up
public boolean isVisible() {
    return RectF.intersects(documentView.getViewRect(), bounds);
}
 
Example 13
Source File: ViewState.java    From document-viewer with GNU General Public License v3.0 4 votes vote down vote up
public final boolean isNodeVisible(final RectF tr) {
    return RectF.intersects(viewRect, tr);
}
 
Example 14
Source File: OC_Numberlines_S2.java    From GLEXP-Team-onebillion with Apache License 2.0 4 votes vote down vote up
public  void checkDrop() throws Exception
{
    playAudio(null);
    OBControl cont = target;
    target =  null;
    OBGroup peg = (OBGroup)objectDict.get(cont.settings.get("target"));
    RectF hotRect = new RectF(peg.frame());
    hotRect.inset(-1.5f* peg.width(), -0.5f * peg.height());
    if(eventTargets.contains(cont.propertyValue("value")) && RectF.intersects(cont.frame(),hotRect))
    {
        float left = peg.position().x - (cont.width()/2);
        if(cont.top() < peg.bottom())
        {
            OBAnimationGroup.runAnims(Arrays.asList(OBAnim.propertyAnim("left",left,cont),
                    OBAnim.propertyAnim("top",peg.bottom()+peg.height(),cont))
                    ,0.15,true,OBAnim.ANIM_EASE_IN_EASE_OUT,this);
            peg.setZPosition(11);
            cont.setZPosition(3);
            OBAnimationGroup.runAnims(Arrays.asList(OBAnim.propertyAnim("top",objectDict.get("rope").bottom(),cont))
                    ,0.15,true,OBAnim.ANIM_EASE_IN_EASE_OUT,this);
        }
        else
        {
            peg.setZPosition(11);
            cont.setZPosition(3);
            OBAnimationGroup.runAnims(Arrays.asList(OBAnim.propertyAnim("left",left,cont),
                    OBAnim.propertyAnim("top",objectDict.get("rope").bottom(),cont))
                    ,0.2,true,OBAnim.ANIM_EASE_IN_EASE_OUT,this);
        }
        closePeg(peg);
        gotItRight();
        eventTargets.remove(cont.settings.get("value"));
        dragTargets.remove(cont);
        if(eventTargets.size() == 0)
        {
            waitForSecs(0.2f);
            displayTick();
            waitForSecs(0.2f);
            performSel("demoFin",currentEvent());
            nextScene();
        }
        else
        {
            setStatus(STATUS_WAITING_FOR_DRAG);
        }
    }
    else
    {
        OBControl rope = objectDict.get("rope");
        RectF rect = new RectF(cont.frame());
        rect.inset( 0, -4*rope.height());
        boolean remind = RectF.intersects(cont.frame(),rect);
        gotItWrongWithSfx();
        OBAnimationGroup.runAnims(Arrays.asList(OBAnim.moveAnim((PointF)cont.propertyValue("startpos"),cont))
                ,0.2,true,OBAnim.ANIM_EASE_IN_EASE_OUT,this);
        waitSFX();
        if(remind)
            playAudioQueuedScene("INCORRECT",0.3f,false);
        setStatus(STATUS_WAITING_FOR_DRAG);
    }
}
 
Example 15
Source File: OC_CountingPractice.java    From GLEXP-Team-onebillion with Apache License 2.0 4 votes vote down vote up
public PointF getRandomDropPointInJarForControl (OBControl control)
{
    //thePointer.hide();
    //
    PointF dropPosition = new PointF(0, 0);
    RectF dropFrame = jarContainerPath.getWorldFrame();
    RectF labelContainerFrame = jarLabelContainer.getWorldFrame();
    //
    //OBControl dropFrameControl = new OBControl();
    //dropFrameControl.setFrame(dropFrame);
    //dropFrameControl.setOpacity(1.0f);
    //dropFrameControl.setBackgroundColor(Color.rgb(0,255,0));
    //dropFrameControl.show();
    //dropFrameControl.setShouldTexturise(true);
    //OC_Generic.sendObjectToTop(dropFrameControl, this);
    //attachControl(dropFrameControl);
    //
    //OBControl labelFrameControl = new OBControl();
    //labelFrameControl.setFrame(labelContainerFrame);
    //labelFrameControl.setOpacity(1.0f);
    //labelFrameControl.setBackgroundColor(Color.rgb(255,0,0));
    //labelFrameControl.show();
    //labelFrameControl.setShouldTexturise(true);
    //OC_Generic.sendObjectToTop(labelFrameControl, this);
    //attachControl(labelFrameControl);
    //
    double delta = labelContainerFrame.left - dropFrame.left;
    dropFrame.left = labelContainerFrame.left;
    dropFrame.right -= delta;
    while (!_aborting)
    {
        dropPosition.set(dropFrame.left + randomInt(1, 100) * 0.01f * (dropFrame.width()), dropFrame.top + 0.5f * control.height() + randomInt(1, 100) * 0.01f * (dropFrame.height() - 0.5f * control.height()));
        RectF futureFrame = new RectF(dropPosition.x, dropPosition.y, dropPosition.x + control.width(), dropPosition.y + control.height());
        //
        //OBControl tempFrame = new OBControl();
        //tempFrame.setFrame(futureFrame);
        //tempFrame.setFillColor(Color.BLACK);
        //OC_Generic.sendObjectToTop(tempFrame, this);
        //tempFrame.show();
        //attachControl(tempFrame);
        //
        if (labelContainerFrame.contains(futureFrame))
        {
            //MainActivity.log("Not good --> inside label container");
            continue;
        }
        else if (RectF.intersects(labelContainerFrame, futureFrame))
        {
            //MainActivity.log("Not good --> intersects label container");
            continue;
        }
        else if (!dropFrame.contains(futureFrame))
        {
            //MainActivity.log("Not good --> not contained by drop frame");
            continue;
        }
        else
        {
            //MainActivity.log("It's good");
            break;
        }
        //
        //waitForSecsNoThrow(3.0);
        //detachControl(tempFrame);
    }
    return dropPosition;
}
 
Example 16
Source File: PongGame.java    From Learning-Java-by-Building-Android-Games-Second-Edition with MIT License 4 votes vote down vote up
private void detectCollisions(){
    // Has the bat hit the ball?
    if(RectF.intersects(mBat.getRect(), mBall.getRect())) {
        // Realistic-ish bounce
        mBall.batBounce(mBat.getRect());
        mBall.increaseVelocity();
        mScore++;
        mSP.play(mBeepID, 1, 1, 0, 0, 1);
    }

    // Has the ball hit the edge of the screen

    // Bottom
    if(mBall.getRect().bottom > mScreenY){
        mBall.reverseYVelocity();

        mLives--;
        mSP.play(mMissID, 1, 1, 0, 0, 1);

        if(mLives == 0){
            mPaused = true;
            startNewGame();
        }
    }

    // Top
    if(mBall.getRect().top < 0){
        mBall.reverseYVelocity();
        mSP.play(mBoopID, 1, 1, 0, 0, 1);
    }

    // Left
    if(mBall.getRect().left < 0){
        mBall.reverseXVelocity();
        mSP.play(mBopID, 1, 1, 0, 0, 1);
    }

    // Right
    if(mBall.getRect().right > mScreenX){
        mBall.reverseXVelocity();
        mSP.play(mBopID, 1, 1, 0, 0, 1);
    }

}
 
Example 17
Source File: BulletHellGame.java    From Learning-Java-by-Building-Android-Games-Second-Edition with MIT License 4 votes vote down vote up
private void detectCollisions(){
    // Has a bullet collided with a wall?
    // Loop through each active bullet in turn
    for(int i = 0; i < mNumBullets; i++) {
        if (mBullets[i].getRect().bottom > mScreenY) {
            mBullets[i].reverseYVelocity();
        }

        if (mBullets[i].getRect().top < 0) {
            mBullets[i].reverseYVelocity();
        }

        if (mBullets[i].getRect().left < 0) {
            mBullets[i].reverseXVelocity();
        }

        if (mBullets[i].getRect().right > mScreenX) {
            mBullets[i].reverseXVelocity();
        }

    }

    // Has a bullet hit Bob?
    // Check each bullet for an intersection with Bob's RectF
    for (int i = 0; i < mNumBullets; i++) {

        if (RectF.intersects(mBullets[i].getRect(), mBob.getRect())) {
            // Bob has been hit
            mSP.play(mBeepID, 1, 1, 0, 0, 1);

            // This flags that a hit occured so that the draw
            // method "knows" as well
            mHit = true;

            // Rebound the bullet that collided
            mBullets[i].reverseXVelocity();
            mBullets[i].reverseYVelocity();

            // keep track of the number of hits
            mNumHits++;

            if(mNumHits == mShield) {
                mPaused = true;
                mTotalGameTime = System.currentTimeMillis() - mStartGameTime;
                startGame();
            }
        }

    }
}
 
Example 18
Source File: PhysicsEngine.java    From Learning-Java-by-Building-Android-Games-Second-Edition with MIT License 4 votes vote down vote up
private boolean detectCollisions(GameState mGameState, ArrayList<GameObject> objects, SoundEngine se, ParticleSystem ps ){
    boolean playerHit = false;
    for(GameObject go1 : objects) {

        if(go1.checkActive()){
            // The ist object is active so worth checking

            for(GameObject go2 : objects) {

                if(go2.checkActive()){

                    // The 2nd object is active so worth checking
                    if(RectF.intersects(go1.getTransform().getCollider(), go2.getTransform().getCollider())){
                        // There has been a collision - but does it matter
                        switch (go1.getTag() + " with " + go2.getTag()){
                            case "Player with Alien Laser":
                                playerHit = true;
                                mGameState.loseLife(se);

                                break;

                            case "Player with Alien":
                                playerHit = true;
                                mGameState.loseLife(se);

                                break;

                            case "Player Laser with Alien":
                                mGameState.increaseScore();
                                // Respawn the alien
                                ps.emitParticles(
                                        new PointF(
                                                go2.getTransform().getLocation().x,
                                                go2.getTransform().getLocation().y

                                        )
                                );
                                go2.setInactive();
                                go2.spawn(objects.get(Level.PLAYER_INDEX).getTransform());
                                go1.setInactive();
                                se.playAlienExplode();

                                break;

                            default:
                                break;
                        }

                    }
                }
            }
        }
    }
    return playerHit;
}
 
Example 19
Source File: CaptureLayoutHelper.java    From Camera2 with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the sub-rect of the preview that is not being blocked by the
 * bottom bar. This can be used to lay out mode options, settings button,
 * etc. If not enough info has been provided to calculate this, return an
 * empty rect. Note that the rect returned is relative to the content layout
 * of the activity. It may need to be translated based on the parent view's
 * location.
 */
public RectF getUncoveredPreviewRect()
{
    if (mPositionConfiguration == null)
    {
        updatePositionConfiguration();
    }
    // Not enough info to create a position configuration.
    if (mPositionConfiguration == null)
    {
        return new RectF();
    }

    if (!RectF.intersects(mPositionConfiguration.mBottomBarRect,
            mPositionConfiguration.mPreviewRect) || !mShowBottomBar)
    {
        return mPositionConfiguration.mPreviewRect;
    }

    if (mWindowHeight > mWindowWidth)
    {
        // Portrait.
        if (mRotation >= 180)
        {
            // Reverse portrait, bottom bar align top.
            return new RectF(mPositionConfiguration.mPreviewRect.left,
                    mPositionConfiguration.mBottomBarRect.bottom,
                    mPositionConfiguration.mPreviewRect.right,
                    mPositionConfiguration.mPreviewRect.bottom);
        } else
        {
            return new RectF(mPositionConfiguration.mPreviewRect.left,
                    mPositionConfiguration.mPreviewRect.top,
                    mPositionConfiguration.mPreviewRect.right,
                    mPositionConfiguration.mBottomBarRect.top);
        }
    } else
    {
        if (mRotation >= 180)
        {
            // Reverse landscape, bottom bar align left.
            return new RectF(mPositionConfiguration.mBottomBarRect.right,
                    mPositionConfiguration.mPreviewRect.top,
                    mPositionConfiguration.mPreviewRect.right,
                    mPositionConfiguration.mPreviewRect.bottom);
        } else
        {
            return new RectF(mPositionConfiguration.mPreviewRect.left,
                    mPositionConfiguration.mPreviewRect.top,
                    mPositionConfiguration.mBottomBarRect.left,
                    mPositionConfiguration.mPreviewRect.bottom);
        }
    }
}
 
Example 20
Source File: AbstractScrollController.java    From document-viewer with GNU General Public License v3.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see org.ebookdroid.ui.viewer.IViewController#isPageVisible(org.ebookdroid.core.Page,
 *      org.ebookdroid.core.ViewState, android.graphics.RectF)
 */
@Override
public final boolean isPageVisible(final Page page, final ViewState viewState, final RectF outBounds) {
    viewState.getBounds(page, outBounds);
    return RectF.intersects(viewState.viewRect, outBounds);
}