List of usage examples for android.graphics Canvas restore
public void restore()
From source file:com.klinker.android.launcher.launcher3.Workspace.java
/** * Draw the View v into the given Canvas. * * @param v the view to draw/*w ww .j a v a 2s .co m*/ * @param destCanvas the canvas to draw on * @param padding the horizontal and vertical padding to use when drawing */ private static void drawDragView(View v, Canvas destCanvas, int padding) { final Rect clipRect = sTempRect; v.getDrawingRect(clipRect); boolean textVisible = false; destCanvas.save(); if (v instanceof TextView) { Drawable d = getTextViewIcon((TextView) v); Rect bounds = getDrawableBounds(d); clipRect.set(0, 0, bounds.width() + padding, bounds.height() + padding); destCanvas.translate(padding / 2 - bounds.left, padding / 2 - bounds.top); d.draw(destCanvas); } else { if (v instanceof FolderIcon) { // For FolderIcons the text can bleed into the icon area, and so we need to // hide the text completely (which can't be achieved by clipping). if (((FolderIcon) v).getTextVisible()) { ((FolderIcon) v).setTextVisible(false); textVisible = true; } } destCanvas.translate(-v.getScrollX() + padding / 2, -v.getScrollY() + padding / 2); destCanvas.clipRect(clipRect, Op.REPLACE); v.draw(destCanvas); // Restore text visibility of FolderIcon if necessary if (textVisible) { ((FolderIcon) v).setTextVisible(true); } } destCanvas.restore(); }
From source file:cc.flydev.launcher.Page.java
@Override protected void dispatchDraw(Canvas canvas) { int halfScreenSize = getViewportWidth() / 2; // mOverScrollX is equal to getScrollX() when we're within the normal scroll range. // Otherwise it is equal to the scaled overscroll position. int screenCenter = mOverScrollX + halfScreenSize; if (screenCenter != mLastScreenCenter || mForceScreenScrolled) { // set mForceScreenScrolled before calling screenScrolled so that screenScrolled can // set it for the next frame mForceScreenScrolled = false;/*from ww w .j a va2 s . c o m*/ screenScrolled(screenCenter); mLastScreenCenter = screenCenter; } // Find out which screens are visible; as an optimization we only call draw on them final int pageCount = getChildCount(); if (pageCount > 0) { getVisiblePages(mTempVisiblePagesRange); final int leftScreen = mTempVisiblePagesRange[0]; final int rightScreen = mTempVisiblePagesRange[1]; if (leftScreen != -1 && rightScreen != -1) { final long drawingTime = getDrawingTime(); // Clip to the bounds canvas.save(); canvas.clipRect(getScrollX(), getScrollY(), getScrollX() + getRight() - getLeft(), getScrollY() + getBottom() - getTop()); // Draw all the children, leaving the drag view for last for (int i = pageCount - 1; i >= 0; i--) { final View v = getPageAt(i); if (v == mDragView) continue; if (mForceDrawAllChildrenNextFrame || (leftScreen <= i && i <= rightScreen && shouldDrawChild(v))) { drawChild(canvas, v, drawingTime); } } // Draw the drag view on top (if there is one) if (mDragView != null) { drawChild(canvas, mDragView, drawingTime); } mForceDrawAllChildrenNextFrame = false; canvas.restore(); } } }
From source file:android.car.ui.provider.CarDrawerLayout.java
@Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) { final int height = getHeight(); final boolean drawingContent = isContentView(child); int clipLeft = findContentView().getLeft(); int clipRight = findContentView().getRight(); final int baseAlpha = (mScrimColor & 0xff000000) >>> 24; final int restoreCount = canvas.save(); if (drawingContent) { final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View v = getChildAt(i); if (v == child || v.getVisibility() != VISIBLE || !hasOpaqueBackground(v) || !isDrawerView(v) || v.getHeight() < height) { continue; }/*from w ww . j a v a 2 s . c o m*/ if (checkDrawerViewAbsoluteGravity(v, Gravity.LEFT)) { final int vright = v.getRight(); if (vright > clipLeft) { clipLeft = vright; } } else { final int vleft = v.getLeft(); if (vleft < clipRight) { clipRight = vleft; } } } canvas.clipRect(clipLeft, 0, clipRight, getHeight()); } final boolean result = super.drawChild(canvas, child, drawingTime); canvas.restoreToCount(restoreCount); if (drawingContent) { int scrimAlpha = SCRIM_ENABLED ? (int) (baseAlpha * Math.max(0, Math.min(1, onScreen())) * MAX_SCRIM_ALPHA) : 0; if (scrimAlpha > 0) { int color = scrimAlpha << 24 | (mScrimColor & 0xffffff); mScrimPaint.setColor(color); canvas.drawRect(clipLeft, 0, clipRight, getHeight(), mScrimPaint); canvas.drawRect(clipLeft - 1, 0, clipLeft, getHeight(), mEdgeHighlightPaint); } LayoutParams drawerLp = (LayoutParams) findDrawerView().getLayoutParams(); if (mShadow != null && checkDrawerViewAbsoluteGravity(findDrawerView(), Gravity.LEFT)) { final int offScreen = (int) ((1 - drawerLp.onScreen) * findDrawerView().getWidth()); final int drawerRight = getWidth() - drawerLp.getMarginEnd() - offScreen; final int shadowWidth = mShadow.getIntrinsicWidth(); final float alpha = Math.max(0, Math.min((float) drawerRight / mDragger.getEdgeSize(), 1.f)); mShadow.setBounds(drawerRight, child.getTop(), drawerRight + shadowWidth, child.getBottom()); mShadow.setAlpha((int) (255 * alpha * alpha * alpha)); mShadow.draw(canvas); } else if (mShadow != null && checkDrawerViewAbsoluteGravity(findDrawerView(), Gravity.RIGHT)) { final int onScreen = (int) (findDrawerView().getWidth() * drawerLp.onScreen); final int drawerLeft = drawerLp.getMarginStart() + getWidth() - onScreen; final int shadowWidth = mShadow.getIntrinsicWidth(); final float alpha = Math.max(0, Math.min((float) onScreen / mDragger.getEdgeSize(), 1.f)); canvas.save(); canvas.translate(2 * drawerLeft - shadowWidth, 0); canvas.scale(-1.0f, 1.0f); mShadow.setBounds(drawerLeft - shadowWidth, child.getTop(), drawerLeft, child.getBottom()); mShadow.setAlpha((int) (255 * alpha * alpha * alpha * alpha)); mShadow.draw(canvas); canvas.restore(); } } return result; }
From source file:com.n2hsu.launcher.Page.java
@Override protected void dispatchDraw(Canvas canvas) { int halfScreenSize = getViewportWidth() / 2; // mOverScrollX is equal to getScrollX() when we're within the normal // scroll range. // Otherwise it is equal to the scaled overscroll position. int screenCenter = mOverScrollX + halfScreenSize; if (screenCenter != mLastScreenCenter || mForceScreenScrolled) { // set mForceScreenScrolled before calling screenScrolled so that // screenScrolled can // set it for the next frame mForceScreenScrolled = false;//from w w w . j a va2s. co m screenScrolled(screenCenter); mLastScreenCenter = screenCenter; } // Find out which screens are visible; as an optimization we only call // draw on them final int pageCount = getChildCount(); if (pageCount > 0) { getVisiblePages(mTempVisiblePagesRange); final int leftScreen = mTempVisiblePagesRange[0]; final int rightScreen = mTempVisiblePagesRange[1]; if (leftScreen != -1 && rightScreen != -1) { final long drawingTime = getDrawingTime(); // Clip to the bounds canvas.save(); canvas.clipRect(getScrollX(), getScrollY(), getScrollX() + getRight() - getLeft(), getScrollY() + getBottom() - getTop()); // Draw all the children, leaving the drag view for last for (int i = pageCount - 1; i >= 0; i--) { final View v = getPageAt(i); if (v == mDragView) continue; if (mForceDrawAllChildrenNextFrame || (leftScreen <= i && i <= rightScreen && shouldDrawChild(v))) { drawChild(canvas, v, drawingTime); } } // Draw the drag view on top (if there is one) if (mDragView != null) { drawChild(canvas, mDragView, drawingTime); } mForceDrawAllChildrenNextFrame = false; canvas.restore(); } } }
From source file:com.android.launcher3.Workspace.java
/** * Draw the View v into the given Canvas. * * @param v the view to draw//from www . j a v a 2 s.c om * @param destCanvas the canvas to draw on * @param padding the horizontal and vertical padding to use when drawing */ private static void drawDragView(View v, Canvas destCanvas, int padding) { final Rect clipRect = sTempRect; v.getDrawingRect(clipRect); boolean textVisible = false; destCanvas.save(); if (v instanceof TextView) { Drawable d = ((TextView) v).getCompoundDrawables()[1]; Rect bounds = getDrawableBounds(d); clipRect.set(0, 0, bounds.width() + padding, bounds.height() + padding); destCanvas.translate(padding / 2 - bounds.left, padding / 2 - bounds.top); d.draw(destCanvas); } else { if (v instanceof FolderIcon) { // For FolderIcons the text can bleed into the icon area, and so we need to // hide the text completely (which can't be achieved by clipping). if (((FolderIcon) v).getTextVisible()) { ((FolderIcon) v).setTextVisible(false); textVisible = true; } } destCanvas.translate(-v.getScrollX() + padding / 2, -v.getScrollY() + padding / 2); destCanvas.clipRect(clipRect, Op.REPLACE); v.draw(destCanvas); // Restore text visibility of FolderIcon if necessary if (textVisible) { ((FolderIcon) v).setTextVisible(true); } } destCanvas.restore(); }
From source file:com.cssweb.android.view.FTrendView.java
public void drawChart(Canvas canvas) throws JSONException { paint = new Paint(Paint.ANTI_ALIAS_FLAG); // paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(1);/*from w w w . j a v a 2s.c om*/ tPaint = new Paint(); tPaint.setStyle(Paint.Style.STROKE); tPaint.setTypeface(Typeface.DEFAULT_BOLD); tPaint.setAntiAlias(true); // dataPaint = new Paint(Paint.ANTI_ALIAS_FLAG); // dataPaint.setStyle(Paint.Style.STROKE); dataPaint.setStrokeWidth(3); tPaint.setTextSize(dTextSize); axisLabelHeight = Font.getFontHeight(dTextSize); axisLabelWidth = (int) tPaint.measureText("0.00000") + offSet; klineWidth = width - axisLabelWidth; klineHeight = height - axisLabelHeight * 2 - iSLowerScreen; klineX = axisLabelWidth; klineY = axisLabelHeight; SPACE = Arith.div(klineWidth, count); //klineWidth/count; scale = klineHeight / (highPrice - lowPrice); // double ratio = (highPrice - lowPrice) / rowNum; // rowHeight = klineHeight / rowNum; colWeight = klineWidth / colNum; tPaint.setColor(GlobalColor.colorLabelName); tPaint.setTextAlign(Paint.Align.LEFT); /** * */ canvas.drawText(":" + quoteData.getJSONArray(isTrackNumber).getString(0), axisLabelWidth, axisLabelHeight - 5, tPaint); canvas.drawText(":" + quoteData.getJSONArray(isTrackNumber).getDouble(3), axisLabelWidth + width / 2, axisLabelHeight - 5, tPaint); paint.setColor(GlobalColor.clrGrayLine); /** * */ tPaint.setTextAlign(Paint.Align.RIGHT); for (int i = 0; i <= rowNum; i++) { if (i == 0 || i == rowNum) { canvas.drawLine(klineX, klineY + rowHeight * i, klineX + klineWidth, klineY + rowHeight * i, paint); } else { Graphics.drawDashline(canvas, klineX, klineY + rowHeight * i, klineX + klineWidth, klineY + rowHeight * i, paint); } if (i == 0) { canvas.drawText(Utils.dataFormation(highPrice, 3), klineX, klineY + rowHeight * i + axisLabelHeight / 2, tPaint); } else if (i == rowNum) { canvas.drawText(Utils.dataFormation(lowPrice, 3), klineX, klineY + rowHeight * i, tPaint); } else { double AxisLabelPrice = highPrice - ratio * i; canvas.drawText(Utils.dataFormation(AxisLabelPrice, 3), klineX, klineY + rowHeight * i + axisLabelHeight / 2, tPaint); } } /** * */ for (int i = 0; i <= colNum; i++) { if (i == 0) { canvas.drawLine(klineX, klineY, klineX, klineY + klineHeight, paint); } else if (i == colNum) { canvas.drawLine(width - 1, klineY, width - 1, klineY + klineHeight, paint); } else { Graphics.drawDashline(canvas, klineX + colWeight * i, klineY, klineX + colWeight * i, klineY + klineHeight, paint); } } /** * ? */ double x1 = 0; double y1 = 0; double x2 = 0; double y2 = 0; double temp = 0; double tHeight = 0; dataPaint.setColor(GlobalColor.colorStockName); dataPaint.setStrokeWidth(3); for (int i = begin; i < (begin + count); i++) { temp = quoteData.getJSONArray(i).getDouble(3); if (i - begin == 0) { x1 = klineX + SPACE * (i - begin); x2 = klineX + SPACE * (i - begin + 1); tHeight = (temp - lowPrice) * scale; // tHeight = ( - ) * y1 = axisLabelHeight + klineHeight - tHeight; // - tHeight y2 = axisLabelHeight + klineHeight - tHeight; } else { canvas.drawLine((int) x1, (int) y1, (int) x2, (int) y2, dataPaint); x1 = x2; x2 = klineX + SPACE * (i - begin + 1); tHeight = (temp - lowPrice) * scale; y1 = y2; y2 = axisLabelHeight + klineHeight - tHeight; } } /** * */ tPaint.setColor(GlobalColor.colorLabelName); tPaint.setTextAlign(Paint.Align.LEFT); canvas.drawText(quoteData.getJSONArray(begin).getString(0), axisLabelWidth, klineHeight + axisLabelHeight * 2 - 5, tPaint); canvas.drawText(quoteData.getJSONArray(begin + count - 1).getString(0), (float) (width - tPaint.measureText(quoteData.getJSONArray(begin + count - 1).getString(0))), klineHeight + axisLabelHeight * 2 - 5, tPaint); /** * */ if (isTrackStatus) { canvas.save(); //?? paint.setColor(GlobalColor.colorLine); canvas.drawLine(trackLineV, axisLabelHeight, trackLineV, klineHeight + axisLabelHeight, paint); canvas.restore(); } }
From source file:org.chromium.chrome.browser.toolbar.ToolbarPhone.java
private boolean drawLocationBar(Canvas canvas, long drawingTime) { boolean clipped = false; if (mLocationBarBackground != null && (mTabSwitcherState == STATIC_TAB || mTextureCaptureMode)) { canvas.save();// w w w .j ava 2 s . co m int backgroundAlpha; if (mTabSwitcherModeAnimation != null) { // Fade out/in the location bar towards the beginning of the animations to avoid // large jumps of stark white. backgroundAlpha = (int) (Math.pow(mLocationBar.getAlpha(), 3) * mLocationBarBackgroundAlpha); } else if (getToolbarDataProvider().isUsingBrandColor() && !mBrandColorTransitionActive) { backgroundAlpha = mUnfocusedLocationBarUsesTransparentBg ? (int) (MathUtils.interpolate(LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA, 255, mUrlExpansionPercent)) : 255; } else { backgroundAlpha = mLocationBarBackgroundAlpha; } mLocationBarBackground.setAlpha(backgroundAlpha); if ((mLocationBar.getAlpha() > 0 || mForceDrawLocationBarBackground) && !mTextureCaptureMode) { mLocationBarBackground.setBounds( mLocationBarBackgroundBounds.left + mLocationBarBackgroundNtpOffset.left - mLocationBarBackgroundPadding.left, mLocationBarBackgroundBounds.top + mLocationBarBackgroundNtpOffset.top - mLocationBarBackgroundPadding.top, mLocationBarBackgroundBounds.right + mLocationBarBackgroundNtpOffset.right + mLocationBarBackgroundPadding.right, mLocationBarBackgroundBounds.bottom + mLocationBarBackgroundNtpOffset.bottom + mLocationBarBackgroundPadding.bottom); mLocationBarBackground.draw(canvas); } float locationBarClipLeft = mLocationBarBackgroundBounds.left + mLocationBarBackgroundNtpOffset.left; float locationBarClipRight = mLocationBarBackgroundBounds.right + mLocationBarBackgroundNtpOffset.right; float locationBarClipTop = mLocationBarBackgroundBounds.top + mLocationBarBackgroundNtpOffset.top; float locationBarClipBottom = mLocationBarBackgroundBounds.bottom + mLocationBarBackgroundNtpOffset.bottom; // When unexpanded, the location bar's visible content boundaries are inset from the // viewport used to draw the background. During expansion transitions, compensation // is applied to increase the clip regions such that when the location bar converts // to the narrower collapsed layout that the visible content is the same. if (mUrlExpansionPercent != 1f) { int leftDelta = mUnfocusedLocationBarLayoutLeft - getViewBoundsLeftOfLocationBar(mVisualState); int rightDelta = getViewBoundsRightOfLocationBar(mVisualState) - mUnfocusedLocationBarLayoutLeft - mUnfocusedLocationBarLayoutWidth; float inversePercent = 1f - mUrlExpansionPercent; locationBarClipLeft += leftDelta * inversePercent; locationBarClipRight -= rightDelta * inversePercent; } // Clip the location bar child to the URL viewport calculated in onDraw. canvas.clipRect(locationBarClipLeft, locationBarClipTop, locationBarClipRight, locationBarClipBottom); clipped = true; } boolean retVal = super.drawChild(canvas, mLocationBar, drawingTime); if (clipped) canvas.restore(); return retVal; }
From source file:cc.flydev.launcher.Workspace.java
/** * Draw the View v into the given Canvas. * * @param v the view to draw//from w w w .jav a2s . co m * @param destCanvas the canvas to draw on * @param padding the horizontal and vertical padding to use when drawing */ private void drawDragView(View v, Canvas destCanvas, int padding, boolean pruneToDrawable) { final Rect clipRect = mTempRect; v.getDrawingRect(clipRect); boolean textVisible = false; destCanvas.save(); if (v instanceof TextView && pruneToDrawable) { Drawable d = ((TextView) v).getCompoundDrawables()[1]; clipRect.set(0, 0, d.getIntrinsicWidth() + padding, d.getIntrinsicHeight() + padding); destCanvas.translate(padding / 2, padding / 2); d.draw(destCanvas); } else { if (v instanceof FolderIcon) { // For FolderIcons the text can bleed into the icon area, and so we need to // hide the text completely (which can't be achieved by clipping). if (((FolderIcon) v).getTextVisible()) { ((FolderIcon) v).setTextVisible(false); textVisible = true; } } else if (v instanceof BubbleTextView) { final BubbleTextView tv = (BubbleTextView) v; clipRect.bottom = tv.getExtendedPaddingTop() - (int) BubbleTextView.PADDING_V + tv.getLayout().getLineTop(0); } else if (v instanceof TextView) { final TextView tv = (TextView) v; clipRect.bottom = tv.getExtendedPaddingTop() - tv.getCompoundDrawablePadding() + tv.getLayout().getLineTop(0); } destCanvas.translate(-v.getScrollX() + padding / 2, -v.getScrollY() + padding / 2); destCanvas.clipRect(clipRect, Op.REPLACE); v.draw(destCanvas); // Restore text visibility of FolderIcon if necessary if (textVisible) { ((FolderIcon) v).setTextVisible(true); } } destCanvas.restore(); }
From source file:com.wb.launcher3.Page.java
@Override protected void dispatchDraw(Canvas canvas) { int halfScreenSize = getViewportWidth() / 2; // mOverScrollX is equal to getScrollX() when we're within the normal scroll range. // Otherwise it is equal to the scaled overscroll position. int screenCenter = mOverScrollX + halfScreenSize; if (screenCenter != mLastScreenCenter || mForceScreenScrolled) { // set mForceScreenScrolled before calling screenScrolled so that screenScrolled can // set it for the next frame mForceScreenScrolled = false;//from ww w. ja v a 2 s . co m screenScrolled(screenCenter); mLastScreenCenter = screenCenter; } // Find out which screens are visible; as an optimization we only call draw on them final int pageCount = getChildCount(); if (pageCount > 0) { //*/Modified by tyd Greg 2014-03-20,for transition effect boolean allowed = true; Workspace workspace = null; if (this instanceof Workspace) { workspace = (Workspace) this; allowed = !workspace.isSmall(); } if (TydtechConfig.TYDTECH_DEBUG_FLAG) { Log.d("Greg", "allowed: " + allowed); } /*/ if(!allowed || !TydtechConfig.TRANSITION_EFFECT_ENABLED){ getVisiblePages(mTempVisiblePagesRange); }else{ getVisiblePagesExt(mTempVisiblePagesRange); } //*/ getVisiblePages(mTempVisiblePagesRange); //*/ final int leftScreen = mTempVisiblePagesRange[0]; final int rightScreen = mTempVisiblePagesRange[1]; if (leftScreen != -1 && rightScreen != -1) { final long drawingTime = getDrawingTime(); // Clip to the bounds canvas.save(); canvas.clipRect(getScrollX(), getScrollY(), getScrollX() + getRight() - getLeft(), getScrollY() + getBottom() - getTop()); // Draw all the children, leaving the drag view for last for (int i = pageCount - 1; i >= 0; i--) { final View v = getPageAt(i); if (v == mDragView) continue; if (mForceDrawAllChildrenNextFrame || (leftScreen <= i && i <= rightScreen && shouldDrawChild(v))) { drawChild(canvas, v, drawingTime); } } // Draw the drag view on top (if there is one) if (mDragView != null) { drawChild(canvas, mDragView, drawingTime); } mForceDrawAllChildrenNextFrame = false; canvas.restore(); } //*/Added by TYD Theobald_Wu on 20130223 [begin] for cycle rolling pages if (TydtechConfig.CYCLE_ROLL_PAGES_ENABLED && allowed) { canvas.save(); int width = 0; final int pageW = getViewportWidth(); View v = null; int scrollOffset = (pageW - getChildWidth(0)) / 2; if (mOverScrollX < 0) { int index = pageCount - 1; v = getPageAt(index); width = getViewportOffsetX() - scrollOffset - v.getWidth(); } else if (mOverScrollX > mMaxScrollX) { v = getPageAt(0); width = getViewportOffsetX() + pageW * pageCount + scrollOffset; } if (TydtechConfig.TYDTECH_DEBUG_FLAG) { Log.d("Greg", "width: " + width); Log.d("Greg", "mOverScrollX: " + mOverScrollX); } if (v != null) { canvas.translate(width, v.getY()); canvas.concat(v.getMatrix()); final int w = v.getWidth(); final int h = v.getHeight(); final int sx = v.getScrollX(); final int sy = v.getScrollY(); Rect rect = new Rect(sx, sy, sx + w, sy + h); ///* zhangwuba mark this, user verison lead to screen flash 2014-5-12 //canvas.saveLayerAlpha(sx, sy, sx + w, sy + h, (int) (v.getAlpha() * 255), // Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG); //*/ v.draw(canvas); } canvas.restore(); } //*/ } }
From source file:com.aidy.launcher3.ui.workspace.Workspace.java
/** * Draw the View v into the given Canvas. * //from w ww.j av a 2 s . c o m * @param v * the view to draw * @param destCanvas * the canvas to draw on * @param padding * the horizontal and vertical padding to use when drawing */ private void drawDragView(View v, Canvas destCanvas, int padding, boolean pruneToDrawable) { final Rect clipRect = mTempRect; v.getDrawingRect(clipRect); boolean textVisible = false; destCanvas.save(); if (v instanceof TextView && pruneToDrawable) { Drawable d = ((TextView) v).getCompoundDrawables()[1]; clipRect.set(0, 0, d.getIntrinsicWidth() + padding, d.getIntrinsicHeight() + padding); destCanvas.translate(padding / 2, padding / 2); d.draw(destCanvas); } else { if (v instanceof FolderIcon) { // For FolderIcons the text can bleed into the icon area, and so // we need to // hide the text completely (which can't be achieved by // clipping). if (((FolderIcon) v).getTextVisible()) { ((FolderIcon) v).setTextVisible(false); textVisible = true; } } else if (v instanceof BubbleTextView) { final BubbleTextView tv = (BubbleTextView) v; clipRect.bottom = tv.getExtendedPaddingTop() - (int) BubbleTextView.PADDING_V + tv.getLayout().getLineTop(0); } else if (v instanceof TextView) { final TextView tv = (TextView) v; clipRect.bottom = tv.getExtendedPaddingTop() - tv.getCompoundDrawablePadding() + tv.getLayout().getLineTop(0); } destCanvas.translate(-v.getScrollX() + padding / 2, -v.getScrollY() + padding / 2); destCanvas.clipRect(clipRect, Op.REPLACE); v.draw(destCanvas); // Restore text visibility of FolderIcon if necessary if (textVisible) { ((FolderIcon) v).setTextVisible(true); } } destCanvas.restore(); }