List of usage examples for android.graphics Canvas CLIP_SAVE_FLAG
int CLIP_SAVE_FLAG
To view the source code for android.graphics Canvas CLIP_SAVE_FLAG.
Click Source Link
From source file:rp3.widget.SlidingPaneLayout.java
@Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); boolean result; final int save = canvas.save(Canvas.CLIP_SAVE_FLAG); if (mCanSlide && !lp.slideable && mSlideableView != null) { // Clip against the slider; no sense drawing what will immediately // be covered. canvas.getClipBounds(mTmpRect);/*from w w w. j a v a 2s . co m*/ mTmpRect.right = Math.min(mTmpRect.right, mSlideableView.getLeft()); canvas.clipRect(mTmpRect); } if (Build.VERSION.SDK_INT >= 11) { // HC result = super.drawChild(canvas, child, drawingTime); } else { if (lp.dimWhenOffset && mSlideOffset > 0) { if (!child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(true); } final Bitmap cache = child.getDrawingCache(); if (cache != null) { canvas.drawBitmap(cache, child.getLeft(), child.getTop(), lp.dimPaint); result = false; } else { Log.e(TAG, "drawChild: child view " + child + " returned null drawing cache"); result = super.drawChild(canvas, child, drawingTime); } } else { if (child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(false); } result = super.drawChild(canvas, child, drawingTime); } } canvas.restoreToCount(save); return result; }
From source file:cn.emagsoftware.ui.BugFixedSlidingPaneLayout.java
@Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); boolean result; final int save = canvas.save(Canvas.CLIP_SAVE_FLAG); if (mCanSlide && !lp.slideable && mSlideableView != null) { // Clip against the slider; no sense drawing what will immediately be covered. canvas.getClipBounds(mTmpRect);/* w ww . j a v a 2 s.c o m*/ mTmpRect.right = Math.min(mTmpRect.right, mSlideableView.getLeft()); canvas.clipRect(mTmpRect); } if (Build.VERSION.SDK_INT >= 11) { // HC result = super.drawChild(canvas, child, drawingTime); } else { if (lp.dimWhenOffset && mSlideOffset > 0) { if (!child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(true); } final Bitmap cache = child.getDrawingCache(); if (cache != null) { canvas.drawBitmap(cache, child.getLeft(), child.getTop(), lp.dimPaint); result = false; } else { Log.e(TAG, "drawChild: child view " + child + " returned null drawing cache"); result = super.drawChild(canvas, child, drawingTime); } } else { if (child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(false); } result = super.drawChild(canvas, child, drawingTime); } } canvas.restoreToCount(save); return result; }
From source file:com.waz.zclient.pages.main.conversationpager.SlidingPaneLayout.java
@Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); boolean result; final int save = canvas.save(Canvas.CLIP_SAVE_FLAG); if (canSlide && !lp.slideable && slideableView != null) { // Clip against the slider; no sense drawing what will immediately be covered. canvas.getClipBounds(tmpRect);/* ww w. j a va 2s. co m*/ if (isLayoutRtlSupport()) { tmpRect.left = Math.max(tmpRect.left, slideableView.getRight()); } else { tmpRect.right = Math.min(tmpRect.right, slideableView.getLeft()); } canvas.clipRect(tmpRect); } if (Build.VERSION.SDK_INT >= 11) { // HC result = super.drawChild(canvas, child, drawingTime); } else { if (lp.dimWhenOffset && slideOffset > 0) { if (!child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(true); } final Bitmap cache = child.getDrawingCache(); if (cache != null) { canvas.drawBitmap(cache, child.getLeft(), child.getTop(), lp.dimPaint); result = false; } else { Timber.e("drawChild: child view %s returned null drawing cache", child); result = super.drawChild(canvas, child, drawingTime); } } else { if (child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(false); } result = super.drawChild(canvas, child, drawingTime); } } canvas.restoreToCount(save); return result; }
From source file:com.example.zhaozhu.practisecustomview.customviewgroup.HSlidingPaneLayout2.java
@Override protected boolean drawChild(final Canvas canvas, final View child, final long drawingTime) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); boolean result; final int save = canvas.save(Canvas.CLIP_SAVE_FLAG); if (this.mCanSlide && !lp.slideable && (this.mSlideableView != null)) { // Clip against the slider; no sense drawing what will immediately // be covered. canvas.getClipBounds(this.mTmpRect); this.mTmpRect.right = Math.min(this.mTmpRect.right, this.mSlideableView.getLeft()); canvas.clipRect(this.mTmpRect); }// ww w. j ava2 s .com if (Build.VERSION.SDK_INT >= 11) { // HC result = super.drawChild(canvas, child, drawingTime); } else { if (lp.dimWhenOffset && (this.mSlideOffset > 0)) { if (!child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(true); } Bitmap cache = child.getDrawingCache(); if (cache != null && !cache.isRecycled()) { canvas.drawBitmap(cache, child.getLeft(), child.getTop(), lp.dimPaint); result = false; } else { Log.e(HSlidingPaneLayout2.TAG, "drawChild: child view " + child + " returned null drawing cache"); result = super.drawChild(canvas, child, drawingTime); } } else { if (child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(false); } result = super.drawChild(canvas, child, drawingTime); } } canvas.restoreToCount(save); return result; }
From source file:com.example.zhaozhu.practisecustomview.customviewgroup.HSlidingPaneLayout.java
@Override protected boolean drawChild(final Canvas canvas, final View child, final long drawingTime) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); boolean result; final int save = canvas.save(Canvas.CLIP_SAVE_FLAG); if (this.mCanSlide && !lp.slideable && (this.mSlideableView != null)) { // Clip against the slider; no sense drawing what will immediately // be covered. canvas.getClipBounds(this.mTmpRect); this.mTmpRect.right = Math.min(this.mTmpRect.right, this.mSlideableView.getLeft()); canvas.clipRect(this.mTmpRect); }// ww w .j a v a 2 s .c om if (Build.VERSION.SDK_INT >= 11) { // HC result = super.drawChild(canvas, child, drawingTime); } else { if (lp.dimWhenOffset && (this.mSlideOffset > 0)) { if (!child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(true); } Bitmap cache = child.getDrawingCache(); if (cache != null && !cache.isRecycled()) { canvas.drawBitmap(cache, child.getLeft(), child.getTop(), lp.dimPaint); result = false; } else { Log.e(HSlidingPaneLayout.TAG, "drawChild: child view " + child + " returned null drawing cache"); result = super.drawChild(canvas, child, drawingTime); } } else { if (child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(false); } result = super.drawChild(canvas, child, drawingTime); } } canvas.restoreToCount(save); return result; }
From source file:cn.zmdx.kaka.locker.widget.SlidingPaneLayout.java
@Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); boolean result; final int save = canvas.save(Canvas.CLIP_SAVE_FLAG); if (mCanSlide && !lp.slideable && mSlideableView != null) { // Clip against the slider; no sense drawing what will immediately // be covered. canvas.getClipBounds(mTmpRect);/*from w ww. j a va 2s .c o m*/ if (isLayoutRtlSupport()) { mTmpRect.left = Math.max(mTmpRect.left, mSlideableView.getRight()); } else { mTmpRect.right = Math.min(mTmpRect.right, mSlideableView.getLeft()); } canvas.clipRect(mTmpRect); } if (Build.VERSION.SDK_INT >= 11) { // HC result = super.drawChild(canvas, child, drawingTime); } else { if (lp.dimWhenOffset && mSlideOffset > 0) { if (!child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(true); } final Bitmap cache = child.getDrawingCache(); if (cache != null) { canvas.drawBitmap(cache, child.getLeft(), child.getTop(), lp.dimPaint); result = false; } else { Log.e(TAG, "drawChild: child view " + child + " returned null drawing cache"); result = super.drawChild(canvas, child, drawingTime); } } else { if (child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(false); } result = super.drawChild(canvas, child, drawingTime); } } canvas.restoreToCount(save); return result; }
From source file:cn.bingoogolapple.swipebacklayout.BGASwipeBackLayout.java
@Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); boolean result; final int save = canvas.save(Canvas.CLIP_SAVE_FLAG); if (mCanSlide && !lp.slideable && mSlideableView != null) { // Clip against the slider; no sense drawing what will immediately be covered. canvas.getClipBounds(mTmpRect);/* www . ja v a 2s . co m*/ if (isLayoutRtlSupport()) { mTmpRect.left = Math.max(mTmpRect.left, mSlideableView.getRight()); } else { mTmpRect.right = Math.min(mTmpRect.right, mSlideableView.getLeft()); } canvas.clipRect(mTmpRect); } if (Build.VERSION.SDK_INT >= 11) { // HC result = super.drawChild(canvas, child, drawingTime); } else { if (lp.dimWhenOffset && mSlideOffset > 0) { if (!child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(true); } final Bitmap cache = child.getDrawingCache(); if (cache != null) { canvas.drawBitmap(cache, child.getLeft(), child.getTop(), lp.dimPaint); result = false; } else { Log.e(TAG, "drawChild: child view " + child + " returned null drawing cache"); result = super.drawChild(canvas, child, drawingTime); } } else { if (child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(false); } result = super.drawChild(canvas, child, drawingTime); } } canvas.restoreToCount(save); return result; }