@Override protected void onDraw(Canvas canvas) { Log.d("hr123", "MyEditOnDraw"); Paint paint = new Paint(); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(2); if (this.isFocused() == true) { Log.d("hr123", "MyEditOnDrawFocus"); paint.setColor(Color.parseColor("#F0F0F0")); } else { Log.d("hr123", "MyEditOnDrawUnFocus"); paint.setColor(Color.parseColor("#11cd6e")); } canvas.drawRoundRect( new RectF( 2 + this.getScrollX(), 2 + this.getScrollY(), this.getWidth() - 3 + this.getScrollX(), this.getHeight() + this.getScrollY() - 1), 3, 3, paint); super.onDraw(canvas); }
@SuppressWarnings("NullableProblems") @Override protected void onDraw(Canvas canvas) { // Draw Title Text if (mAttributes.isShowTitle() && mTitlePaint != null && mCurTitleProperty != null && mCurTitleProperty.mAlpha != 0) { CharSequence buf = getHint(); if (buf != null) { mTitlePaint.setTextSize(mCurTitleProperty.mTextSize); int color = getCurrentTitleTextColor(); int alpha = GeniusUi.modulateAlpha(Color.alpha(color), mCurTitleProperty.mAlpha); mTitlePaint.setColor(color); mTitlePaint.setAlpha(alpha); canvas.drawText( buf, 0, buf.length(), mCurTitleProperty.mPaddingLeft, mCurTitleProperty.mPaddingTop + mCurTitleProperty.mTextSize, mTitlePaint); } } super.onDraw(canvas); }
@Override public void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawRect( this.getWidth() - 55 * escala, 20 * escala, this.getWidth() - 5 * escala, 45 * escala, p1); canvas.drawText( "" + this.getText().toString().length(), this.getWidth() - 52 * escala, 40 * escala, p2); }
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); int count = getLineCount(); Rect rect = mRect; Paint paint = mPaint; for (int index = 0; index < count; index++) { int baseline = getLineBounds(index, rect); canvas.drawLine(rect.left, baseline + 1, rect.right, baseline + 1, paint); } }
@Override public void onDraw(Canvas canvas) { super.onDraw(canvas); // Dibujamos el fondo negro del contador-cuadrado canvas.drawRect( this.getWidth() - 30 * escala, 5 * escala, this.getWidth() - 5 * escala, 20 * escala, p1); // Dibujamos el nĂºmero de caracteres sobre el contador canvas.drawText( "" + this.getText().toString().length(), this.getWidth() - 28 * escala, 17 * escala, p2); }
@Override protected void onDraw(Canvas canvas) { int count = getLineCount(); Rect r = mRect; Paint paint = mPaint; for (int i = 0; i < count; i++) { int baseline = getLineBounds(i, r); canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint); } super.onDraw(canvas); }
protected void onDraw(Canvas canvas) { canvas.drawLine(8, height - 5, width - 8, height - 5, mPaintUnderline); // draw // underline // canvas.drawLine(8, height - 5, 8, height - 10, mPaintUnderline); // draw // left // corner Path path = new Path(); path.setFillType(Path.FillType.EVEN_ODD); path.moveTo(width - 7, height - 4); path.lineTo(width - 25, height - 4); path.lineTo(width - 7, height - 25); // path.lineTo(width - 8, height -5); path.close(); canvas.drawPath(path, mPaintTriangle); super.onDraw(canvas); }
@Override protected void onDraw(Canvas canvas) { int height = getHeight(); int line_height = getLineHeight(); int count = height / line_height; if (getLineCount() > count) count = getLineCount(); // for long text with scrolling Rect r = mRect; Paint paint = mPaint; int baseline = getLineBounds(0, r); // first line for (int i = 0; i < count; i++) { canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint); baseline += getLineHeight(); // next line } super.onDraw(canvas); }
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint p = getPaint(); p.getTextBounds(s, 0, s.length(), mTextBounds); getDrawingRect(mButtonRect); mButtonRect.top += 10; mButtonRect.bottom -= 10; mButtonRect.left = (int) (getWidth() - mTextBounds.width() - 18); mButtonRect.right = getWidth() - 10; btn_rect = mButtonRect; if (s.equals(optionOneString)) p.setColor(optionOneColor); else p.setColor(optionTwoColor); canvas.drawRect(mButtonRect, p); p.setColor(Color.GRAY); canvas.drawText(s, mButtonRect.left + 3, mButtonRect.bottom - (mTextBounds.height() / 2), p); invalidate(); }
@Override public void onDraw(Canvas canvas) { float lineHeight = getLineHeight(); int currentLine = getCurrentLine(); if (isFocused()) { // Draw line highlight around the line that the cursor is on canvas.drawRect( getScrollX(), currentLine * lineHeight, canvas.getWidth() + getScrollX(), (currentLine + 1) * lineHeight, lineHighlight); } // Draw base text super.onDraw(canvas); // If the syntax highlighter hasn't run yet... // Make sure this doesn't break if (tokens == null) { // Check again invalidate(); return; } if (PreferenceManager.getDefaultSharedPreferences(context) .getBoolean("syntax_highlight", true)) { // ScrollView doesn't like to let us know when it has scrolled... // ScrollView scroller = (ScrollView) ((APDE) // context.getApplicationContext()).getEditor().findViewById(R.id.code_scroller); int topVis = 0; // (int) Math.max(scroller.getScrollY() / getLineHeight() - 1, 0); //inclusive int bottomVis = getLineCount(); // (int) Math.floor(Math.min((scroller.getScrollY() + // scroller.getHeight()) / getLineHeight() + 1, getLineCount())); // //exclusive for (int i = 0; i < tokens.length; i++) { // Only draw this if we need to if (tokens[i].lineNum >= topVis && tokens[i].isCustomPaint) tokens[i].display(canvas); else if (tokens[i].lineNum > bottomVis) break; } // "{}", "()", "[]" open / close matching // Make sure we don't crash if the bracket matcher hasn't updated yet and we are deleting a // lot of text... if (matchingBracket != -1 && matchingBracket < getText().length()) { float xOffset = getCompoundPaddingLeft(); // TODO hopefully no one uses Arabic (right-aligned // localities)... because getCompoundPaddingStart() was // introduced in a later API level float charWidth = getPaint().measureText("m"); // Calculate coordinates float x = Math.max(xOffset + getLayout().getPrimaryHorizontal(matchingBracket), 1); float y = lineHeight * getLayout().getLineForOffset(matchingBracket); canvas.drawRect(x, y, x + charWidth, y + lineHeight, bracketMatch); } float xOffset = getCompoundPaddingLeft(); float charWidth = getPaint().measureText("m"); float radius = TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 3, context.getResources().getDisplayMetrics()); // Draw the highlight boxes for (Highlight highlight : highlights) { if (highlight.pos != -1 && highlight.pos + highlight.len <= getText().length()) { // Calculate coordinates float x = Math.max(xOffset + getLayout().getPrimaryHorizontal(highlight.pos), 1); float y = lineHeight * getLayout().getLineForOffset(highlight.pos); canvas.drawRoundRect( new RectF(x, y, x + charWidth * highlight.len, y + lineHeight), radius, radius, highlight.paint); } } } // Now that we've multi-threaded the new syntax highlighter, we don't need the old one // It's still here in memory... }
protected void onDraw(Canvas canvas) { super.onDraw(canvas); }