Beispiel #1
0
  public void init(HTextView hTextView, AttributeSet attrs, int defStyle) {
    mHTextView = hTextView;

    mText = "";
    mOldText = "";

    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(textColor);
    paint.setStyle(Paint.Style.FILL);

    oldPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    oldPaint.setColor(textColor);
    oldPaint.setStyle(Paint.Style.FILL);

    backPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    backPaint.setColor(((ColorDrawable) mHTextView.getBackground()).getColor());
    backPaint.setStyle(Paint.Style.FILL);

    metrics = new DisplayMetrics();
    WindowManager windowManger =
        (WindowManager) hTextView.getContext().getSystemService(Context.WINDOW_SERVICE);
    windowManger.getDefaultDisplay().getMetrics(metrics);

    textSize = hTextView.getTextSize();

    sparkBitmap = BitmapFactory.decodeResource(hTextView.getResources(), R.drawable.fire);
  }