@Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (mFolder == null) return; if (mFolder.getItemCount() == 0 && !mAnimating) return; ArrayList<View> items = mFolder.getItemsInReadingOrder(false); Drawable d; TextView v; // Update our drawing parameters if necessary if (mAnimating) { computePreviewDrawingParams(mAnimParams.drawable); } else { v = (TextView) items.get(0); d = v.getCompoundDrawables()[1]; computePreviewDrawingParams(d); } int nItemsInPreview = Math.min(items.size(), NUM_ITEMS_IN_PREVIEW); if (!mAnimating) { for (int i = nItemsInPreview - 1; i >= 0; i--) { v = (TextView) items.get(i); d = v.getCompoundDrawables()[1]; mParams = computePreviewItemDrawingParams(i, mParams); mParams.drawable = d; drawPreviewItem(canvas, mParams); } } else { drawPreviewItem(canvas, mAnimParams); } }
@Override protected void dispatchDraw(Canvas canvas) { View childView = getChildAt(mCurrentSelection); TextView childTextView = null; if (childView instanceof TextView) { childTextView = (TextView) childView; } if (childTextView != null && !TextUtils.isEmpty(childTextView.getText()) && getVisibility() == View.VISIBLE && childTextView.getVisibility() == View.VISIBLE) { Rect childRect = new Rect(); childTextView.getLocalVisibleRect(childRect); float childViewX = childTextView.getX() + childTextView.getWidth() / 2; float childViewY = childTextView.getY() + childTextView.getHeight() / 2; int top = (int) (childViewY - mSelectedRect.height() / 2); int left = (int) (childViewX - mSelectedRect.width() / 2); mSelectedRect.set(left, top, left + mSelectedRect.width(), top + mSelectedRect.height()); if (isShowSelected && !mSelectedRect.isEmpty()) { final Drawable selectedBg = mSelectedBg; selectedBg.setBounds(mSelectedRect); selectedBg.draw(canvas); } } super.dispatchDraw(canvas); }
@Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (mTabCount == 0) { return; } // under line Paint paint = new Paint(); paint.setColor(mUnderLineColor); RectF rectF = new RectF(0, getHeight() - mUnderLineHeight, getWidth(), getHeight()); canvas.drawRect(rectF, paint); // indicator line mPath.rewind(); float leftX = mIndicatorMarginTab + mLineMarginX; float rightX = leftX + mTabWidth - 2 * mIndicatorMarginTab; mPath.moveTo(leftX, mIndicatorTopY); mPath.lineTo(rightX, mIndicatorTopY); mPath.lineTo(rightX, mIndicatorBottomY); mPath.lineTo(leftX, mIndicatorBottomY); mPath.close(); canvas.drawPath(mPath, mPaintLine); }
@Override protected void dispatchDraw(Canvas canvas) { final int saveCount = canvas.save(); final Matrix m = mController.getEffectsMatrix(); if (!m.isIdentity()) canvas.concat(m); final float alpha = mController.getEffectsAlpha(); if (alpha != 1f) canvas.saveLayerAlpha( 0, 0, canvas.getWidth(), canvas.getHeight(), (int) (255 * alpha), Canvas.HAS_ALPHA_LAYER_SAVE_FLAG); super.dispatchDraw(canvas); final int fadeFactor = mController.getFadeFactor(); if (fadeFactor > 0f) { mFadePaint.setColor(Color.argb(fadeFactor, 0, 0, 0)); canvas.drawRect(0, 0, getWidth(), getHeight(), mFadePaint); } canvas.restoreToCount(saveCount); }
@Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); canvas.save(); canvas.translate(mTranslationX, getHeight() - 2); canvas.drawLine(0, 0, mTabWidth, 0, mPaint); canvas.restore(); }
@Override protected void dispatchDraw(Canvas canvas) { for (TouchDelegateRecord record : mTouchDelegateRecords) { mPaint.setColor(record.color); canvas.drawRect(record.rect, mPaint); } super.dispatchDraw(canvas); }
@Override protected void dispatchDraw(Canvas canvas) { RectF drawRect = new RectF(); drawRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); canvas.drawRoundRect(drawRect, 5, 5, innerPaint); canvas.drawRoundRect(drawRect, 5, 5, borderPaint); super.dispatchDraw(canvas); }
@Override protected void dispatchDraw(Canvas canvas) { // If this is off-screen pass apply blur only if (mBlurRenderer.isOffscreenCanvas(canvas)) { mBlurRenderer.applyBlur(); } // Otherwise draw blurred background image and continue to child views else { mBlurRenderer.drawToCanvas(canvas); super.dispatchDraw(canvas); } }
/** * Override dispatchDraw so that we can put our own background and border in. This is all * complexity to support a shared border from one item to the next. */ @Override public void dispatchDraw(Canvas c) { super.dispatchDraw(c); // This custom border is causing our scrolling fps to drop from 60+ to the mid 40's. // Commenting out for now until we come up with a new UI design that doesn't require // the border. return; // View v = mMessageBlock; // if (v != null) { // Path path = null; // if (mAvatar.getPosition() == Divot.RIGHT_UPPER) { // if (mPathRight == null) { // float r = v.getWidth() - 1; // float b = v.getHeight(); // // mPathRight = new Path(); // mPathRight.moveTo(0, mAvatar.getCloseOffset()); // mPathRight.lineTo(0, 0); // mPathRight.lineTo(r, 0); // mPathRight.lineTo(r, b); // mPathRight.lineTo(0, b); // mPathRight.lineTo(0, mAvatar.getFarOffset()); // } // path = mPathRight; // } else if (mAvatar.getPosition() == Divot.LEFT_UPPER) { // if (mPathLeft == null) { // float r = v.getWidth() - 1; // float b = v.getHeight(); // // mPathLeft = new Path(); // mPathLeft.moveTo(r, mAvatar.getCloseOffset()); // mPathLeft.lineTo(r, 0); // mPathLeft.lineTo(0, 0); // mPathLeft.lineTo(0, b); // mPathLeft.lineTo(r, b); // mPathLeft.lineTo(r, mAvatar.getFarOffset()); // } // path = mPathLeft; // } // if (mPaint == null) { // mPaint = new Paint(); // mPaint.setColor(0xffcccccc); // mPaint.setStrokeWidth(1F); // mPaint.setStyle(Paint.Style.STROKE); // mPaint.setColor(0xff00ff00); // turn on for debugging, draws lines in green // } // c.translate(v.getX(), v.getY()); // c.drawPath(path, mPaint); // } }
protected void dispatchDraw(Canvas canvas) { if (AbstractTnGraphics.getInstance() != null) { AbstractTnGraphics.getInstance().setGraphics(canvas); canvas.save(); tnContainer.draw(AbstractTnGraphics.getInstance()); canvas.restore(); } super.dispatchDraw(canvas); }
@Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (mGroups == null) return; for (int i = 0; i < mGroups.length; i++) { Drawable indicator = mExpandedGroups[i] ? mIndicatorExpanded : mIndicatorCollapsed; View v = mGroups[i]; Rect newBounds = indicator.copyBounds(); newBounds.offsetTo(v.getLeft() + mIndicatorMarginLeft, v.getTop() + mIndicatorMarginTop); indicator.setBounds(newBounds); indicator.draw(canvas); } }
@Override protected void dispatchDraw(Canvas canvas) { // Draw the indicators (these should be drawn above the dividers) and children super.dispatchDraw(canvas); // Draw the dividers final int dividerHeight = mDividerHeight; if (dividerHeight > 0 && mDivider != null) { // final Rect mTempRect = new Rect(); // // Only modify the top and bottom in the loop, we set the left and right here // getDrawingRect(mTempRect); final Rect bounds = new Rect(); int mPaddingLeft = super.getPaddingLeft(); int mPaddingRight = super.getPaddingRight(); int mRight = super.getRight(); int mLeft = super.getLeft(); int mBottom = super.getBottom(); int mTop = super.getTop(); bounds.left = mPaddingLeft; bounds.right = mRight - mLeft - mPaddingRight; final int count = getChildCount(); int bottom; int listBottom = mBottom - mTop - 0; // mListPadding.bottom; for (int i = 0; i < count; i++) { View child = getChildAt(i); bottom = child.getBottom(); // Don't draw dividers next to items that are not enabled if (bottom <= listBottom) { bounds.top = bottom; bounds.bottom = bottom + dividerHeight; drawDivider(canvas, bounds, i); } } } }
@Override protected void dispatchDraw(Canvas canvas) { final int saveCount = canvas.save(); canvas.concat(mEffectsController.getEffectsMatrix()); canvas.saveLayerAlpha( 0, 0, canvas.getWidth(), canvas.getHeight(), (int) (255 * mEffectsController.getEffectsAlpha()), Canvas.HAS_ALPHA_LAYER_SAVE_FLAG); super.dispatchDraw(canvas); if (mFadeFactor > 0f) { mFadePaint.setColor(Color.argb(mFadeFactor, 0, 0, 0)); canvas.drawRect(0, 0, getWidth(), getHeight(), mFadePaint); } canvas.restoreToCount(saveCount); }
@Override protected void dispatchDraw(Canvas canvas) { // String name = getResources().getResourceEntryName(getId()); // Log.d(TAG, name + " ispatchDraw " + mState); // this is why 'mState' was added: // avoid flicker before animation start if (mState == State.ABOUT_TO_ANIMATE && !mIsShrinking) { int delta = mOrientation == VERTICAL ? mContentHeight : mContentWidth; if (mPosition == LEFT || mPosition == TOP) { delta = -delta; } if (mOrientation == VERTICAL) { canvas.translate(0, delta); } else { canvas.translate(delta, 0); } } if (mState == State.TRACKING || mState == State.FLYING) { canvas.translate(mTrackX, mTrackY); } super.dispatchDraw(canvas); }
@Override protected void dispatchDraw(final Canvas canvas) { mHelper.dispatchDrawBackground(canvas); super.dispatchDraw(canvas); mHelper.dispatchDrawLabels(canvas); }
@Override public void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (!mShouldDoAnimation || mTargetWidth <= 0 || mTouchTarget == null) { return; } if (isOpenSwitch) { if (mRevealRadius > mMinBetweenWidthAndHeight / 2) { mRevealRadius += mRevealRadiusGap * 8; } else { mRevealRadius += mRevealRadiusGap * 8; } } if (isCloseReveal) { if (mRevealRadius > mMinBetweenWidthAndHeight / 2) { mRevealRadius -= mRevealRadiusGap * 8; } else { mRevealRadius -= mRevealRadiusGap * 8; } } this.getLocationOnScreen(mLocationInScreen); int[] location = new int[2]; mTouchTarget.getLocationOnScreen(location); int left = mRevealLayoutl; int top = mRevealLayoutt; int right = mRevealLayoutr; int bottom = mRevealLayoutb; Log.e( "TAG", "left:" + left + "top:" + top + "right:" + right + "bottom" + bottom + "mRevealRadius" + mRevealRadius); canvas.save(); canvas.clipRect(left, top, right, bottom); canvas.drawCircle(mCenterX, mCenterY, mRevealRadius, mPaint); canvas.restore(); // 水波纹半径设置最大为right,bottom最大值 if (mRevealRadius >= Math.max(right, bottom) * 2) { isCloseReveal = true; isPlayReavel = false; return; } // 波纹减小到0退出 if (mRevealRadius < 0) { isCloseReveal = false; isPlayReavel = false; return; } if (mRevealRadius <= Math.max(right, bottom)) { postInvalidateDelayed(INVALIDATE_DURATION, left, top, right, bottom); } else if (!mIsPressed) { if (!isOpenSwitch) { mShouldDoAnimation = false; } // 重新触发dispatchDraw事件会直接退出 postInvalidateDelayed(INVALIDATE_DURATION, left, top, right, bottom); } }
/** * 屏蔽了底下的线 * * @param canvas Canvas * @see android.view.ViewGroup#dispatchDraw(android.graphics.Canvas) */ @Override public void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); }
@Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); }