Example usage for android.graphics Paint setTextSize

List of usage examples for android.graphics Paint setTextSize

Introduction

In this page you can find the example usage for android.graphics Paint setTextSize.

Prototype

public void setTextSize(float textSize) 

Source Link

Document

Set the paint's text size.

Usage

From source file:com.olacabs.customer.ui.TrackRideActivity.java

private Bitmap m13911a(int i, String str) {
    int i2 = 50;//ww w. j  a v a  2  s .co  m
    Typeface createFromAsset = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
    int i3 = (int) getResources().getDisplayMetrics().scaledDensity;
    int i4 = i3 * 60;
    int i5 = i3 * 76;
    Config config = Config.ARGB_8888;
    if (i4 <= 0) {
        i4 = 50;
    }
    if (i5 > 0) {
        i2 = i5;
    }
    Bitmap createScaledBitmap = Bitmap
            .createScaledBitmap(BitmapFactoryInstrumentation.decodeResource(getResources(), i), i4, i2, true);
    Canvas canvas = new Canvas(createScaledBitmap);
    float f = (float) (i4 / 2);
    float f2 = (float) (i4 / 2);
    Paint paint = new Paint(1);
    paint.setColor(Color.parseColor("#d4db28"));
    paint.setStyle(Style.FILL);
    paint.setTextSize((float) (i3 * 18));
    paint.setTypeface(createFromAsset);
    if (str.length() == 3) {
        canvas.drawText(str, f - ((float) (i3 * 15)), f2, paint);
    } else if (str.length() == 2) {
        canvas.drawText(str, f - ((float) (i3 * 10)), f2, paint);
    } else if (str.length() == 1) {
        canvas.drawText(str, f - ((float) (i3 * 6)), f2, paint);
    }
    paint.setTextSize((float) (i3 * 16));
    canvas.drawText(" min ", f - ((float) (i3 * 18)), f2 + ((float) (i3 * 15)), paint);
    return createScaledBitmap;
}

From source file:com.binu.LogarithmicGraph.DrawGraphAsyncTask.java

@Override
protected Object doInBackground(Object[] params) {

    Bitmap bitmapBackground = Bitmap.createBitmap(mViewWidth, mViewHeight, Bitmap.Config.ARGB_8888);

    Canvas canvasBackground = new Canvas(bitmapBackground);
    Paint paint = new Paint();
    paint.setStrokeWidth(1f);//from  w ww.j a  va  2s . c  o m
    int starty = 0;
    int endy = mViewHeight;
    canvasBackground.drawColor(Color.BLACK);
    double ratio = Math.pow(Math.E, Math.log(MAX_FREQUENCY / MIN_FREQUENCY) / mViewWidth);
    mLogScaledX_values = new double[mViewWidth];
    for (int i = 0; i < mViewWidth; i++) {
        if (i == 0) {
            mLogScaledX_values[i] = 20;
        } else {
            mLogScaledX_values[i] = mLogScaledX_values[i - 1] * ratio;
        }
    }

    //Major lines
    for (int i = 0; i < MAJOR_GRIDLINE_POINTS.length; i++) {
        paint.setColor(ContextCompat.getColor(mContext, R.color.graph_grid_color));
        float xStart = (float) findNearestNumberPosition(mLogScaledX_values, MAJOR_GRIDLINE_POINTS[i]);
        float textSize = (getPixelDensity(mContext) * mLabelTextSize) / 480;
        paint.setTextSize(textSize);
        Log.i("Density", "" + getPixelDensity(mContext));
        if (Math.round(MAJOR_GRIDLINE_POINTS[i]) == 20) {
            if (isShowLabels())
                canvasBackground.drawText(getFormattedLabel(MAJOR_GRIDLINE_POINTS[i]),
                        xStart + (getPixelDensity(mContext) * 10) / 480,
                        endy - (getPixelDensity(mContext) * 10) / 480, paint);
        } else if (Math.round(MAJOR_GRIDLINE_POINTS[i]) == 20000) {
            if (isShowLabels())
                canvasBackground.drawText(getFormattedLabel(MAJOR_GRIDLINE_POINTS[i]),
                        xStart - (getPixelDensity(mContext) * 70) / 480,
                        endy - (getPixelDensity(mContext) * 10) / 480, paint);
        } else {
            if (isShowLabels())
                canvasBackground.drawText(getFormattedLabel(MAJOR_GRIDLINE_POINTS[i]),
                        xStart - (getPixelDensity(mContext) * 30) / 480,
                        endy - (getPixelDensity(mContext) * 10) / 480, paint);
            canvasBackground.drawLine(xStart, starty, xStart + 1, endy, paint);
        }
    }

    //Minor lines
    for (int i = 0; i < MINOR_GRIDLINE_POINTS.length; i++) {
        paint.setColor(ContextCompat.getColor(mContext, R.color.graph_grid_color_dull));
        float xStart = (float) findNearestNumberPosition(mLogScaledX_values, MINOR_GRIDLINE_POINTS[i]);
        canvasBackground.drawLine(xStart, starty, xStart + 1, endy, paint);

        if (isShowLabels()) {
            paint.setColor(ContextCompat.getColor(mContext, R.color.graph_grid_color));
            if (MINOR_GRIDLINE_POINTS[i] == 50 || MINOR_GRIDLINE_POINTS[i] == 500
                    || MINOR_GRIDLINE_POINTS[i] == 5000)
                canvasBackground.drawText(getFormattedLabel(MINOR_GRIDLINE_POINTS[i]),
                        xStart - (getPixelDensity(mContext) * 30) / 480,
                        endy - (getPixelDensity(mContext) * 10) / 480, paint);
        }
    }

    float[] Y_points = calculateGraphYAxis();
    float div = mViewHeight / (Y_points.length - 1);
    //Level lines
    for (int i = 0; i < Y_points.length - 1; i++) {
        paint.setColor(ContextCompat.getColor(mContext, R.color.graph_grid_color_dull));
        canvasBackground.drawLine(0, div * (i + 1), mViewWidth, (div * (i + 1)) + 1, paint);
    }

    //Level labels
    if (isShowLabels()) {
        for (int i = 0; i < Y_points.length; i++) {
            paint.setColor(ContextCompat.getColor(mContext, R.color.graph_grid_color));
            if (i == 0)
                canvasBackground.drawText("dB", 0, (div * i) + (getPixelDensity(mContext) * 50) / 480, paint);
            else if (i == Y_points.length - 1)
                canvasBackground.drawText("", 0, div * i, paint);
            else
                canvasBackground.drawText("" + Math.round(Y_points[i]), 0, div * i, paint);
        }
    }

    BitmapDrawable drawable = new BitmapDrawable(mContext.getResources(), bitmapBackground);
    mDrawableBackground = drawable;

    //Plotting the curve points

    Bitmap bitmapForeground = Bitmap.createBitmap(mViewWidth, mViewHeight, Bitmap.Config.ARGB_8888);
    Canvas canvasForeground = new Canvas(bitmapForeground);
    Paint plotPaint = new Paint();
    plotPaint.setStyle(Paint.Style.STROKE);
    plotPaint.setStrokeCap(Paint.Cap.ROUND);
    plotPaint.setStrokeWidth(PLOT_THICKNESS);
    plotPaint.setAntiAlias(true);
    plotPaint.setColor(ContextCompat.getColor(mContext, R.color.graph_plot_color));

    for (int i = 0; i < X_values.length; i++) {
        //            canvasForeground.drawCircle(i, mViewHeight - mPlotPoint[i], 2f, plotPaint);
        /*float startX, float startY, float stopX, float stopY,
        @NonNull Paint paint*/
        float startX = (float) getGetPixelValueForX(X_values[i]);
        float startY = mViewHeight
                - getPixelValueFromdB((int) GAIN_MAX, (int) GAIN_MIN, mViewHeight, Y_values[i]);
        float stopX;
        float stopY;
        if (i == X_values.length - 1) {
            stopX = (float) getGetPixelValueForX(X_values[i]);
            stopY = mViewHeight - getPixelValueFromdB((int) GAIN_MAX, (int) GAIN_MIN, mViewHeight, Y_values[i]);
        } else {
            stopX = (float) getGetPixelValueForX(X_values[i + 1]);
            stopY = mViewHeight
                    - getPixelValueFromdB((int) GAIN_MAX, (int) GAIN_MIN, mViewHeight, Y_values[i + 1]);
        }

        canvasForeground.drawLine(startX, startY, stopX, stopY, plotPaint);

    }

    BitmapDrawable drawableFore = new BitmapDrawable(mContext.getResources(), bitmapForeground);
    mDrawableForeground = drawableFore;
    return null;
}

From source file:com.google.corp.productivity.specialprojects.android.samples.fft.AnalyzeActivity.java

public PopupWindow popupMenuCreate(String[] popUpContents, int resId) {

    // initialize a pop up window type
    PopupWindow popupWindow = new PopupWindow(this);

    // the drop down list is a list view
    ListView listView = new ListView(this);

    // set our adapter and pass our pop up window contents
    ArrayAdapter<String> aa = popupMenuAdapter(popUpContents);
    listView.setAdapter(aa);//from  ww  w .  jav a 2 s .  c om

    // set the item click listener
    listView.setOnItemClickListener(this);

    listView.setTag(resId); // button res ID, so we can trace back which button is pressed

    // get max text width
    Paint mTestPaint = new Paint();
    mTestPaint.setTextSize(listItemTextSize);
    float w = 0;
    float wi; // max text width in pixel
    for (int i = 0; i < popUpContents.length; i++) {
        String sts[] = popUpContents[i].split("::");
        String st = sts[0];
        if (sts.length == 2 && sts[1].equals("0")) {
            mTestPaint.setTextSize(listItemTitleTextSize);
            wi = mTestPaint.measureText(st);
            mTestPaint.setTextSize(listItemTextSize);
        } else {
            wi = mTestPaint.measureText(st);
        }
        if (w < wi) {
            w = wi;
        }
    }

    // left and right padding, at least +7, or the whole app will stop respond, don't know why
    w = w + 20 * DPRatio;
    if (w < 60) {
        w = 60;
    }

    // some other visual settings
    popupWindow.setFocusable(true);
    popupWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
    // Set window width according to max text width
    popupWindow.setWidth((int) w);
    // also set button width
    ((Button) findViewById(resId)).setWidth((int) (w + 2 * DPRatio));
    // Set the text on button in updatePreferenceSaved()

    // set the list view as pop up window content
    popupWindow.setContentView(listView);

    return popupWindow;
}

From source file:in.sc9.discreteslider.DiscreteSlider.java

private void drawTextArray(Canvas canvas, int thumbWidth, int halfThumb, float yPos, int left, float intervel) {
    int lenTextArray = textArray.length;
    if (lenTextArray == 0)
        return;//w w w. j a  v  a 2s  .co m

    float currentLeft = left;

    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setTextAlign(Paint.Align.LEFT);
    paint.setColor(mtextColor);
    paint.setTextSize(mTextSize);
    //paint.setTypeface(); //TODO setTypeface in Discrete Seek Bar
    //elloWorldTextView2.setTextSize(activity.pixelsToSp(activity, textSize));
    //paint.m

    for (int i = 0; i < lenTextArray; i++) {
        /*if((int)getThumbValue(0)==i*(int)scaleStep)
        paint.setColor(Color.parseColor("#ffff0000"));
        else
        paint.setColor(Color.parseColor("#ff22445b"));*/

        float textLen = paint.measureText(textArray[i]);

        if (i == 0) {
            if (textStyle != NONE && (textStyle == ODD || textStyle == EXTREMES || textStyle == ALL))
                canvas.drawText(textArray[i], currentLeft, yPos, paint);
        } else if (i == lenTextArray - 1) {
            if (textStyle != NONE)
                if ((textStyle == ALL) || (i % 2 == 0 && textStyle == ODD) || (i % 2 != 0 && textStyle == EVEN)
                        || (textStyle == EXTREMES))
                    canvas.drawText(textArray[i], currentLeft - textLen, yPos, paint);
        } else {
            if (textStyle != 0 && textStyle != 3) {
                if ((textStyle == ALL) || (i % 2 == 0 && textStyle == ODD) || (i % 2 != 0 && textStyle == EVEN))
                    canvas.drawText(textArray[i], currentLeft - (textLen / 2), yPos, paint);
            }
        }
        currentLeft += intervel;
    }
}

From source file:com.android.gallery3d.filtershow.imageshow.ImageShow.java

public void drawCompareImage(Canvas canvas, Bitmap image) {
    MasterImage master = MasterImage.getImage();
    boolean showsOriginal = master.showsOriginal();
    if (!showsOriginal && !mTouchShowOriginal)
        return;/*  w  ww.j  a v  a  2 s  .co m*/
    canvas.save();
    if (image != null) {
        if (mShowOriginalDirection == 0) {
            if (Math.abs(mTouch.y - mTouchDown.y) > Math.abs(mTouch.x - mTouchDown.x)) {
                mShowOriginalDirection = UNVEIL_VERTICAL;
            } else {
                mShowOriginalDirection = UNVEIL_HORIZONTAL;
            }
        }

        int px = 0;
        int py = 0;
        if (mShowOriginalDirection == UNVEIL_VERTICAL) {
            px = mImageBounds.width();
            py = mTouch.y - mImageBounds.top;
        } else {
            px = mTouch.x - mImageBounds.left;
            py = mImageBounds.height();
            if (showsOriginal) {
                px = mImageBounds.width();
            }
        }

        Rect d = new Rect(mImageBounds.left, mImageBounds.top, mImageBounds.left + px, mImageBounds.top + py);
        if (mShowOriginalDirection == UNVEIL_HORIZONTAL) {
            if (mTouchDown.x - mTouch.x > 0) {
                d.set(mImageBounds.left + px, mImageBounds.top, mImageBounds.right, mImageBounds.top + py);
            }
        } else {
            if (mTouchDown.y - mTouch.y > 0) {
                d.set(mImageBounds.left, mImageBounds.top + py, mImageBounds.left + px, mImageBounds.bottom);
            }
        }
        canvas.clipRect(d);
        Matrix m = master.computeImageToScreen(image, 0, false);
        canvas.drawBitmap(image, m, mPaint);
        Paint paint = new Paint();
        paint.setColor(Color.BLACK);
        paint.setStrokeWidth(3);

        if (mShowOriginalDirection == UNVEIL_VERTICAL) {
            canvas.drawLine(mImageBounds.left, mTouch.y, mImageBounds.right, mTouch.y, paint);
        } else {
            canvas.drawLine(mTouch.x, mImageBounds.top, mTouch.x, mImageBounds.bottom, paint);
        }

        Rect bounds = new Rect();
        paint.setAntiAlias(true);
        paint.setTextSize(mOriginalTextSize);
        paint.getTextBounds(mOriginalText, 0, mOriginalText.length(), bounds);
        paint.setColor(Color.BLACK);
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(3);
        canvas.drawText(mOriginalText, mImageBounds.left + mOriginalTextMargin,
                mImageBounds.top + bounds.height() + mOriginalTextMargin, paint);
        paint.setStyle(Paint.Style.FILL);
        paint.setStrokeWidth(1);
        paint.setColor(Color.WHITE);
        canvas.drawText(mOriginalText, mImageBounds.left + mOriginalTextMargin,
                mImageBounds.top + bounds.height() + mOriginalTextMargin, paint);
    }
    canvas.restore();
}

From source file:com.appeaser.sublimepickerlibrary.timepicker.RadialTimePickerView.java

/**
 * Draw the 12 text values at the positions specified by the textGrid parameters.
 *//*from w  w w . j a va  2  s. com*/
private void drawTextElements(Canvas canvas, float textSize, Typeface typeface, ColorStateList textColor,
        String[] texts, float[] textX, float[] textY, Paint paint, int alpha, boolean showActivated,
        int activatedDegrees, boolean activatedOnly) {
    paint.setTextSize(textSize);
    paint.setTypeface(typeface);

    // The activated index can touch a range of elements.
    final float activatedIndex = activatedDegrees / (360.0f / NUM_POSITIONS);
    final int activatedFloor = (int) activatedIndex;
    final int activatedCeil = ((int) Math.ceil(activatedIndex)) % NUM_POSITIONS;

    for (int i = 0; i < 12; i++) {
        final boolean activated = (activatedFloor == i || activatedCeil == i);
        if (activatedOnly && !activated) {
            continue;
        }

        final int stateMask = SUtils.STATE_ENABLED | (showActivated && activated ? SUtils.STATE_ACTIVATED : 0);
        final int color = textColor.getColorForState(SUtils.resolveStateSet(stateMask), 0);
        paint.setColor(color);
        paint.setAlpha(getMultipliedAlpha(color, alpha));

        canvas.drawText(texts[i], textX[i], textY[i], paint);
    }
}

From source file:com.cssweb.android.view.KlineMini.java

public void drawQuoteWin(Canvas canvas, JSONObject quoteData, int idx) throws JSONException {
    Paint mPaint = new Paint();
    mPaint.setTextAlign(Paint.Align.LEFT);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setTypeface(Typeface.DEFAULT_BOLD);
    mPaint.setAntiAlias(true);/*from   w  ww  .  j  a  va  2  s  .  co m*/

    mPaint.setColor(GlobalColor.colorKlinePopub);
    mPaint.setTextSize(sTextSize);
    canvas.drawText(":", 0, axisLabelHeight, mPaint);
    canvas.drawText(":", 0, axisLabelHeight * 3, mPaint);
    canvas.drawText(":", 0, axisLabelHeight * 5, mPaint);
    canvas.drawText(":", 0, axisLabelHeight * 7, mPaint);
    canvas.drawText(":", 0, axisLabelHeight * 9, mPaint);
    canvas.drawText(":", 0, axisLabelHeight * 11, mPaint);

    mPaint.setTextAlign(Paint.Align.RIGHT);
    String qt = quoteData.getJSONArray("K").getJSONArray(idx).getString(0);
    double jrkp = quoteData.getJSONArray("K").getJSONArray(idx).getDouble(1);
    double zg = quoteData.getJSONArray("K").getJSONArray(idx).getDouble(2);
    double zd = quoteData.getJSONArray("K").getJSONArray(idx).getDouble(3);
    double sp = quoteData.getJSONArray("K").getJSONArray(idx).getDouble(4);
    double preclose;
    if ("cf".equals(exchange) || "dc".equals(exchange) || "sf".equals(exchange) || "cz".equals(exchange)) {
        switch (idx) {
        case 0:
            preclose = quoteData.getJSONArray("K").getJSONArray(idx).getDouble(7);
            break;
        default:
            preclose = quoteData.getJSONArray("K").getJSONArray(idx - 1).getDouble(7);
            break;
        }
        if (quoteData.getJSONArray("K").length() == 1) {
            preclose = quoteData.getJSONArray("K").getJSONArray(0).getDouble(7);
        }
    } else {
        switch (idx) {
        case 0:
            preclose = quoteData.getJSONArray("K").getJSONArray(idx).getDouble(4);
            break;
        default:
            preclose = quoteData.getJSONArray("K").getJSONArray(idx - 1).getDouble(4);
            break;
        }
        if (quoteData.getJSONArray("K").length() == 1) {
            preclose = quoteData.getDouble("zrsp");//quoteData.getJSONArray("K").getJSONArray(0).getDouble(4);
        }
    }
    //      if(quoteData.getJSONArray("K").length()==1 && quoteData.getJSONObject("todayData")!=null){
    //         preclose = quoteData.getJSONObject("todayData").getDouble("zrsp");
    //      }
    mPaint.setColor(getcolor(jrkp, preclose));
    canvas.drawText(Utils.dataFormation(jrkp, stockdigit), klineX, axisLabelHeight * 2, mPaint);
    mPaint.setColor(getcolor(zg, preclose));
    canvas.drawText(Utils.dataFormation(zg, stockdigit), klineX, axisLabelHeight * 4, mPaint);
    mPaint.setColor(getcolor(zd, preclose));
    canvas.drawText(Utils.dataFormation(zd, stockdigit), klineX, axisLabelHeight * 6, mPaint);
    mPaint.setColor(getcolor(sp, preclose));
    canvas.drawText(Utils.dataFormation(sp, stockdigit), klineX, axisLabelHeight * 8, mPaint);
    double zhangdie = sp - preclose;
    if (zhangdie > 0)
        mPaint.setColor(GlobalColor.colorpriceUp);
    else if (zhangdie < 0)
        mPaint.setColor(GlobalColor.colorPriceDown);
    else
        mPaint.setColor(GlobalColor.colorPriceEqual);
    canvas.drawText(Utils.dataFormation(zhangdie, 1), klineX, axisLabelHeight * 10, mPaint);
    if (quoteData.getString("period").equals("min5") || quoteData.getString("period").equals("min15")
            || quoteData.getString("period").equals("min30") || quoteData.getString("period").equals("min60")) {
        qt = qt.substring(4, 6) + '/' + qt.substring(6, 8) + ' ' + qt.substring(8);
    } else {
        qt = qt.substring(2, 4) + qt.substring(4, 6) + qt.substring(6, 8);
    }
    mPaint.setColor(GlobalColor.colorLabelName);
    canvas.drawText(qt, klineX, axisLabelHeight * 12, mPaint);
}

From source file:com.appeaser.sublimepickerlibrary.datepicker.SimpleMonthView.java

/**
 * Applies the specified text appearance resource to a paint, returning the
 * text color if one is set in the text appearance.
 *
 * @param p     the paint to modify/*from   ww w  .j  av  a 2s .c  o  m*/
 * @param resId the resource ID of the text appearance
 * @return the text color, if available
 */
private ColorStateList applyTextAppearance(Paint p, int resId) {
    // Workaround for inaccessible R.styleable.TextAppearance_*
    TextView tv = new TextView(mContext);
    if (SUtils.isApi_23_OrHigher()) {
        tv.setTextAppearance(resId);
    } else {
        //noinspection deprecation
        tv.setTextAppearance(mContext, resId);
    }

    p.setTypeface(tv.getTypeface());
    p.setTextSize(tv.getTextSize());

    final ColorStateList textColor = tv.getTextColors();

    if (textColor != null) {
        final int enabledColor = textColor.getColorForState(ENABLED_STATE_SET, 0);
        p.setColor(enabledColor);
    }

    return textColor;
}

From source file:net.droidsolutions.droidcharts.core.renderer.xy.AbstractXYItemRenderer.java

/**
 * Draws an item label.//from  w  w w .j a v  a  2 s  .  co  m
 *
 * @param g2  the graphics device.
 * @param orientation  the orientation.
 * @param dataset  the dataset.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 * @param x  the x coordinate (in Java2D space).
 * @param y  the y coordinate (in Java2D space).
 * @param negative  indicates a negative value (which affects the item
 *                  label position).
 */
protected void drawItemLabel(Canvas g2, PlotOrientation orientation, XYDataset dataset, int series, int item,
        double x, double y, boolean negative) {

    XYItemLabelGenerator generator = getItemLabelGenerator(series, item);
    if (generator != null) {
        Font labelFont = getItemLabelFont(series, item);
        Paint paint = getItemLabelPaint(series, item);
        paint.setTypeface(labelFont.getTypeFace());
        paint.setTextSize(labelFont.getSize());
        String label = generator.generateLabel(dataset, series, item);

        // get the label position..
        ItemLabelPosition position = null;
        if (!negative) {
            position = getPositiveItemLabelPosition(series, item);
        } else {
            position = getNegativeItemLabelPosition(series, item);
        }

        // work out the label anchor point...
        Point2D anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), x, y, orientation);
        TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(), position.getRotationAnchor(), paint);
    }

}

From source file:com.tr4android.support.extension.picker.time.RadialTimePickerView.java

/**
 * Draw the 12 text values at the positions specified by the textGrid parameters.
 *///from w  ww  .  j  av  a 2s. c om
private void drawTextElements(Canvas canvas, float textSize, Typeface typeface, ColorStateList textColor,
        String[] texts, float[] textX, float[] textY, Paint paint, int alpha, boolean showActivated,
        int activatedDegrees, boolean activatedOnly) {
    paint.setTextSize(textSize);
    paint.setTypeface(typeface);

    // The activated index can touch a range of elements.
    final float activatedIndex = activatedDegrees / (360.0f / NUM_POSITIONS);
    final int activatedFloor = (int) activatedIndex;
    final int activatedCeil = ((int) Math.ceil(activatedIndex)) % NUM_POSITIONS;

    for (int i = 0; i < 12; i++) {
        final boolean activated = (activatedFloor == i || activatedCeil == i);
        if (activatedOnly && !activated) {
            continue;
        }

        final int[] stateMask = new int[] { android.R.attr.state_enabled,
                (showActivated && activated ? android.R.attr.state_selected : 0) };
        final int color = textColor.getColorForState(stateMask, 0);
        paint.setColor(color);
        paint.setAlpha(getMultipliedAlpha(color, alpha));

        canvas.drawText(texts[i], textX[i], textY[i], paint);
    }
}