public void textChanged(String s) { // TODO Auto-generated method stub searched = new ArrayList<Match>(); for (Object o : matches.toArray()) { Match m = (Match) o; if ((m.getMatchNum() + "").contains(s)) searched.add(m); } requestLayout(); invalidate(); }
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); paint = new Paint(); paint.setAntiAlias(true); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setStrokeWidth(0); paint.setTextSize(25); Rect bounds = new Rect(); float bottom = 0; paint.setARGB(255, 255, 255, 255); if (searched == null) return; for (Match m : searched) { float start = bottom; String s = "Match 216498464"; canvas.drawLine(5, bottom, getWidth() - 5, bottom, paint); paint.getTextBounds(s.toUpperCase(), 0, s.length(), bounds); paint.setARGB(255, 255, 255, 255); s = "Match " + m.getMatchNum(); canvas.drawText(s, 10, bottom + bounds.height() + 5, paint); bottom = bottom + bounds.height() + 10; s = "123654987"; paint.getTextBounds(s.toUpperCase(), 0, s.length(), bounds); paint.setARGB(255, 255, 0, 0); canvas.drawRoundRect( new RectF(getWidth() / 4 - 5, bottom, getWidth(), bottom + bounds.height() + 10), 6, 6, paint); paint.setARGB(255, 255, 255, 255); bottom = bottom + bounds.height() + 10; s = m.getRedTeam()[0].getNumber() + ""; canvas.drawText(s, getWidth() / 4, bottom - 5, paint); s = m.getRedTeam()[1].getNumber() + ""; canvas.drawText(s, getWidth() / 2, bottom - 5, paint); s = m.getRedTeam()[2].getNumber() + ""; canvas.drawText(s, getWidth() / 4 * 3, bottom - 5, paint); paint.setARGB(255, 0, 0, 255); canvas.drawRoundRect( new RectF(getWidth() / 4 - 5, bottom, getWidth(), bottom + bounds.height() + 10), 6, 6, paint); paint.setARGB(255, 255, 255, 255); bottom = bottom + bounds.height() + 10; canvas.drawText(s, getWidth() / 4, bottom - 5, paint); s = m.getBlueTeam()[0].getNumber() + ""; canvas.drawText(s, getWidth() / 2, bottom - 5, paint); s = m.getBlueTeam()[1].getNumber() + ""; canvas.drawText(s, getWidth() / 4 * 3, bottom - 5, paint); s = m.getBlueTeam()[2].getNumber() + ""; bottom += 5; } height = Math.round(bottom + 1); }