当前位置: 首页>>代码示例>>Java>>正文


Java Rect.union方法代码示例

本文整理汇总了Java中android.graphics.Rect.union方法的典型用法代码示例。如果您正苦于以下问题:Java Rect.union方法的具体用法?Java Rect.union怎么用?Java Rect.union使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Rect的用法示例。


在下文中一共展示了Rect.union方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getViewsIntersectingRegion

import android.graphics.Rect; //导入方法依赖的package包/类
private void getViewsIntersectingRegion(int cellX, int cellY, int spanX, int spanY,
        View dragView, Rect boundingRect, ArrayList<View> intersectingViews) {
    if (boundingRect != null) {
        boundingRect.set(cellX, cellY, cellX + spanX, cellY + spanY);
    }
    intersectingViews.clear();
    Rect r0 = new Rect(cellX, cellY, cellX + spanX, cellY + spanY);
    Rect r1 = new Rect();
    final int count = mShortcutsAndWidgets.getChildCount();
    for (int i = 0; i < count; i++) {
        View child = mShortcutsAndWidgets.getChildAt(i);
        if (child == dragView) continue;
        LayoutParams lp = (LayoutParams) child.getLayoutParams();
        r1.set(lp.cellX, lp.cellY, lp.cellX + lp.cellHSpan, lp.cellY + lp.cellVSpan);
        if (Rect.intersects(r0, r1)) {
            mIntersectingViews.add(child);
            if (boundingRect != null) {
                boundingRect.union(r1);
            }
        }
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:23,代码来源:CellLayout.java

示例2: moveBy

import android.graphics.Rect; //导入方法依赖的package包/类
void moveBy(float dx, float dy) {
    Rect invalRect = new Rect(drawRect);

    cropRect.offset(dx, dy);

    // Put the cropping rectangle inside image rectangle
    cropRect.offset(
            Math.max(0, imageRect.left - cropRect.left),
            Math.max(0, imageRect.top  - cropRect.top));

    cropRect.offset(
            Math.min(0, imageRect.right  - cropRect.right),
            Math.min(0, imageRect.bottom - cropRect.bottom));

    drawRect = computeLayout();
    invalRect.union(drawRect);
    invalRect.inset(-(int) handleRadius, -(int) handleRadius);
    viewContext.invalidate(invalRect);
}
 
开发者ID:mityung,项目名称:XERUNG,代码行数:20,代码来源:HighlightView.java

示例3: moveBy

import android.graphics.Rect; //导入方法依赖的package包/类
void moveBy(float dx, float dy) {

        Rect invalRect = new Rect(mDrawRect);

        mCropRect.offset(dx, dy);

        // Put the cropping rectangle inside image rectangle.
        mCropRect.offset(
                Math.max(0, mImageRect.left - mCropRect.left),
                Math.max(0, mImageRect.top - mCropRect.top));

        mCropRect.offset(
                Math.min(0, mImageRect.right - mCropRect.right),
                Math.min(0, mImageRect.bottom - mCropRect.bottom));

        mDrawRect = computeLayout();
        invalRect.union(mDrawRect);
        invalRect.inset(-10, -10);
        mContext.invalidate(invalRect);
    }
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:21,代码来源:HighlightView.java

示例4: drawGestureTrails

import android.graphics.Rect; //导入方法依赖的package包/类
private boolean drawGestureTrails(final Canvas offscreenCanvas, final Paint paint,
        final Rect dirtyRect) {
    // Clear previous dirty rectangle.
    if (!dirtyRect.isEmpty()) {
        paint.setColor(Color.TRANSPARENT);
        paint.setStyle(Paint.Style.FILL);
        offscreenCanvas.drawRect(dirtyRect, paint);
    }
    dirtyRect.setEmpty();
    boolean needsUpdatingGestureTrail = false;
    // Draw gesture trails to offscreen buffer.
    synchronized (mGestureTrails) {
        // Trails count == fingers count that have ever been active.
        final int trailsCount = mGestureTrails.size();
        for (int index = 0; index < trailsCount; index++) {
            final GestureTrailDrawingPoints trail = mGestureTrails.valueAt(index);
            needsUpdatingGestureTrail |= trail.drawGestureTrail(offscreenCanvas, paint,
                    mGestureTrailBoundsRect, mDrawingParams);
            // {@link #mGestureTrailBoundsRect} has bounding box of the trail.
            dirtyRect.union(mGestureTrailBoundsRect);
        }
    }
    return needsUpdatingGestureTrail;
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:25,代码来源:GestureTrailsDrawingPreview.java

示例5: adjustLayout

import android.graphics.Rect; //导入方法依赖的package包/类
@Override
public void adjustLayout(int startPosition, int endPosition, LayoutManagerHelper helper) {
    if (requireLayoutView()) {
        View refer = null;
        Rect tempRect = new Rect();
        final OrientationHelperEx orientationHelper = helper.getMainOrientationHelper();
        for (int i = 0; i < helper.getChildCount(); i++) {
            refer = helper.getChildAt(i);
            int anchorPos = helper.getPosition(refer);
            if (getRange().contains(anchorPos)) {
                if (refer.getVisibility() == View.GONE) {
                    tempRect.setEmpty();
                } else {
                    final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)
                        refer.getLayoutParams();
                    if (helper.getOrientation() == VirtualLayoutManager.VERTICAL) {
                        tempRect.union(helper.getDecoratedLeft(refer) - params.leftMargin,
                            orientationHelper.getDecoratedStart(refer),
                            helper.getDecoratedRight(refer) + params.rightMargin,
                            orientationHelper.getDecoratedEnd(refer));
                    } else {
                        tempRect.union(orientationHelper.getDecoratedStart(refer),
                            helper.getDecoratedTop(refer) - params.topMargin, orientationHelper.getDecoratedEnd(refer),
                            helper.getDecoratedBottom(refer) + params.bottomMargin);
                    }
                }
            }
        }
        if (!tempRect.isEmpty()) {
            mLayoutRegion.set(tempRect.left - mPaddingLeft, tempRect.top - mPaddingTop,
                tempRect.right + mPaddingRight, tempRect.bottom + mPaddingBottom);
        } else {
            mLayoutRegion.setEmpty();
        }
        if (mLayoutView != null) {
            mLayoutView.layout(mLayoutRegion.left, mLayoutRegion.top, mLayoutRegion.right, mLayoutRegion.bottom);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:BaseLayoutHelper.java

示例6: getBoundingRectForViews

import android.graphics.Rect; //导入方法依赖的package包/类
void getBoundingRectForViews(ArrayList<View> views, Rect outRect) {
    boolean first = true;
    for (View v: views) {
        CellAndSpan c = map.get(v);
        if (first) {
            outRect.set(c.cellX, c.cellY, c.cellX + c.spanX, c.cellY + c.spanY);
            first = false;
        } else {
            outRect.union(c.cellX, c.cellY, c.cellX + c.spanX, c.cellY + c.spanY);
        }
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:13,代码来源:CellLayout.java

示例7: updateTextPositions

import android.graphics.Rect; //导入方法依赖的package包/类
void updateTextPositions(int position, float positionOffset, boolean force) {
    Rect r = this.mTempRect;
    int bottom = getHeight();
    int top = bottom - this.mIndicatorHeight;
    r.set(this.mCurrText.getLeft() - this.mTabPadding, top, this.mCurrText.getRight() + this.mTabPadding, bottom);
    super.updateTextPositions(position, positionOffset, force);
    this.mTabAlpha = (int) ((Math.abs(positionOffset - 0.5f) * 2.0f) * 255.0f);
    r.union(this.mCurrText.getLeft() - this.mTabPadding, top, this.mCurrText.getRight() + this.mTabPadding, bottom);
    invalidate(r);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:11,代码来源:PagerTabStrip.java

示例8: adjustLayout

import android.graphics.Rect; //导入方法依赖的package包/类
public void adjustLayout(int startPosition, int endPosition, LayoutManagerHelper helper) {
    if (!isChildrenEmpty()) {
        for (int i = 0, size = mChildren.size(); i < size; i++) {
            RangeStyle rangeStyle = mChildren.valueAt(i);
            rangeStyle.adjustLayout(startPosition, endPosition, helper);
        }
    }
    if (requireLayoutView()) {
        View refer = null;
        Rect tempRect = new Rect();
        final OrientationHelperEx orientationHelper = helper.getMainOrientationHelper();
        for (int i = 0; i < helper.getChildCount(); i++) {
            refer = helper.getChildAt(i);
            int anchorPos = helper.getPosition(refer);
            if (getRange().contains(anchorPos)) {
                if (refer.getVisibility() == View.GONE) {
                    tempRect.setEmpty();
                } else {
                    final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)
                        refer.getLayoutParams();
                    if (helper.getOrientation() == VirtualLayoutManager.VERTICAL) {
                        tempRect.union(helper.getDecoratedLeft(refer) - params.leftMargin,
                            orientationHelper.getDecoratedStart(refer),
                            helper.getDecoratedRight(refer) + params.rightMargin,
                            orientationHelper.getDecoratedEnd(refer));
                    } else {
                        tempRect.union(orientationHelper.getDecoratedStart(refer),
                            helper.getDecoratedTop(refer) - params.topMargin, orientationHelper.getDecoratedEnd(refer),
                            helper.getDecoratedBottom(refer) + params.bottomMargin);
                    }
                }
            }
        }
        if (!tempRect.isEmpty()) {
            mLayoutRegion.set(tempRect.left - mPaddingLeft, tempRect.top - mPaddingTop,
                tempRect.right + mPaddingRight, tempRect.bottom + mPaddingBottom);
        } else {
            mLayoutRegion.setEmpty();
        }
        if (mLayoutView != null) {
            mLayoutView.layout(mLayoutRegion.left, mLayoutRegion.top, mLayoutRegion.right, mLayoutRegion.bottom);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:45,代码来源:RangeStyle.java


注:本文中的android.graphics.Rect.union方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。