-
-
Save lithid/6405433 to your computer and use it in GitHub Desktop.
Shown to show transparency
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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); | |
boolean drawScrim = false; | |
boolean mDrawBehind = true; | |
if (!mDrawBehind && mCanSlide && !lp.slideable && mSlideableView != null) { | |
// Clip against the slider; no sense drawing what will immediately be covered. | |
canvas.getClipBounds(mTmpRect); | |
mTmpRect.bottom = Math.min(mTmpRect.bottom, mSlideableView.getTop()); | |
canvas.clipRect(mTmpRect); | |
if (mSlideOffset < 1) { | |
drawScrim = true; | |
} | |
} | |
result = super.drawChild(canvas, child, drawingTime); | |
canvas.restoreToCount(save); | |
if (drawScrim) { | |
final int baseAlpha = (mCoveredFadeColor & 0xff000000) >>> 24; | |
final int imag = (int) (baseAlpha * (1 - mSlideOffset)); | |
final int color = imag << 24 | (mCoveredFadeColor & 0xffffff); | |
mCoveredFadePaint.setColor(color); | |
canvas.drawRect(mTmpRect, mCoveredFadePaint); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment