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); }
activeRipples[i].getBounds(rippleBounds); rippleBounds.offset(cX, cY); drawingBounds.union(rippleBounds); background.getBounds(rippleBounds); rippleBounds.offset(cX, cY); drawingBounds.union(rippleBounds); dirtyBounds.union(drawingBounds); if (Build.VERSION.SDK_INT >= 21) dirtyBounds.union(super.getDirtyBounds()); return dirtyBounds; } else {
private 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); }
private 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); }
public void setThumbPosition(int x, int y) { if (mThumbPosition.x == x && mThumbPosition.y == y) { return; } // do not create new objects here, this is called quite often mInvalidateRect.set(mThumbPosition.x + mOffset.x, mOffset.y, mThumbPosition.x + mOffset.x + mWidth, mRecyclerView.getHeight() + mOffset.y); mThumbPosition.set(x, y); mInvalidateTmpRect.set(mThumbPosition.x + mOffset.x, mOffset.y, mThumbPosition.x + mOffset.x + mWidth, mRecyclerView.getHeight() + mOffset.y); mInvalidateRect.union(mInvalidateTmpRect); mRecyclerView.invalidate(mInvalidateRect); }
public void setOffset(int x, int y) { if (mOffset.x == x && mOffset.y == y) { return; } // do not create new objects here, this is called quite often mInvalidateRect.set(mThumbPosition.x + mOffset.x, mOffset.y, mThumbPosition.x + mOffset.x + mWidth, mRecyclerView.getHeight() + mOffset.y); mOffset.set(x, y); mInvalidateTmpRect.set(mThumbPosition.x + mOffset.x, mOffset.y, mThumbPosition.x + mOffset.x + mWidth, mRecyclerView.getHeight() + mOffset.y); mInvalidateRect.union(mInvalidateTmpRect); mRecyclerView.invalidate(mInvalidateRect); }
mInvalidateRect.union(mBgBounds); return mInvalidateRect;
public void setThumbWidth(int width) { mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, mThumbOffset.y, mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight); mThumbWidth = width; updateThumbPath(); mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, mThumbOffset.y, mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight); mRv.invalidate(mInvalidateRect); }
public void setThumbWidth(int width) { mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, mThumbOffset.y, mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight); mThumbWidth = width; updateThumbPath(); mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, mThumbOffset.y, mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight); mRv.invalidate(mInvalidateRect); }
public void setThumbWidth(int width) { mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, mThumbOffset.y, mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight); mThumbWidth = width; updateThumbPath(); mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, mThumbOffset.y, mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight); mRv.invalidate(mInvalidateRect); }
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); }
public void setThumbOffset(int x, int y) { if (mThumbOffset.x == x && mThumbOffset.y == y) { return; } mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, mThumbOffset.y, mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight); mThumbOffset.set(x, y); updateThumbPath(); mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, mThumbOffset.y, mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight); mRv.invalidate(mInvalidateRect); }
public void setThumbOffset(int x, int y) { if (mThumbOffset.x == x && mThumbOffset.y == y) { return; } mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, mThumbOffset.y, mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight); mThumbOffset.set(x, y); updateThumbPath(); mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, mThumbOffset.y, mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight); mRv.invalidate(mInvalidateRect); }
public void setThumbPosition(int x, int y) { if (mThumbPosition.x == x && mThumbPosition.y == y) { return; } // do not create new objects here, this is called quite often mInvalidateRect.set(mThumbPosition.x + mOffset.x, mOffset.y, mThumbPosition.x + mOffset.x + mWidth, mRecyclerView.getHeight() + mOffset.y); mThumbPosition.set(x, y); mInvalidateTmpRect.set(mThumbPosition.x + mOffset.x, mOffset.y, mThumbPosition.x + mOffset.x + mWidth, mRecyclerView.getHeight() + mOffset.y); mInvalidateRect.union(mInvalidateTmpRect); mRecyclerView.invalidate(mInvalidateRect); }
/** * Requests a redraw of the entire keyboard. Calling {@link #invalidate} is not sufficient * because the keyboard renders the keys to an off-screen buffer and an invalidate() only * draws the cached buffer. * @see #invalidateKey(Key) */ public void invalidateAllKeys() { mDirtyRect.union(0, 0, getWidth(), getHeight()); mDrawPending = true; invalidate(); }
public void setTrackWidth(int width) { mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, 0, mThumbOffset.x + mThumbWidth, mRv.getVisibleHeight()); mTrackWidth = width; updateThumbPath(); mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, 0, mThumbOffset.x + mThumbWidth, mRv.getVisibleHeight()); mRv.invalidate(mInvalidateRect); }
public void setTrackWidth(int width) { mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, 0, mThumbOffset.x + mThumbWidth, mRv.getHeight()); mTrackWidth = width; updateThumbPath(); mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, 0, mThumbOffset.x + mThumbWidth, mRv.getHeight()); mRv.invalidate(mInvalidateRect); }
/** * Requests a redraw of the entire keyboard. Calling {@link #invalidate} is not sufficient because * the keyboard renders the keys to an off-screen buffer and an invalidate() only draws the cached * buffer. * * @see #invalidateKey(int) */ public void invalidateAllKeys() { mDirtyRect.union(0, 0, getWidth(), getHeight()); mDrawPending = true; invalidate(); }
private void invalidateKeys(List<Key> keys) { if (keys == null || keys.size() == 0) return; for (Key key : keys) { mDirtyRect.union( key.getX() + getPaddingLeft(), key.getY() + getPaddingTop(), key.getX() + key.getWidth() + getPaddingLeft(), key.getY() + key.getHeight() + getPaddingTop()); } onBufferDraw(); invalidate(); }