Example usage for android.content.res TypedArray getDimension

List of usage examples for android.content.res TypedArray getDimension

Introduction

In this page you can find the example usage for android.content.res TypedArray getDimension.

Prototype

public float getDimension(@StyleableRes int index, float defValue) 

Source Link

Document

Retrieve a dimensional unit attribute at index.

Usage

From source file:com.doomy.library.Internal.Marker.java

public Marker(Context context, AttributeSet attrs, int defStyleAttr, String maxValue) {
    super(context, attrs, defStyleAttr);
    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSeekBar,
            R.attr.discreteSeekBarStyle, R.style.DefaultSeekBar);

    int padding = (int) (PADDING_DP * displayMetrics.density) * 2;
    int textAppearanceId = a.getResourceId(R.styleable.DiscreteSeekBar_dsb_indicatorTextAppearance,
            R.style.DefaultIndicatorTextAppearance);
    mNumber = new TextView(context);
    //Add some padding to this textView so the bubble has some space to breath
    mNumber.setPadding(padding, 0, padding, 0);
    mNumber.setTextAppearance(context, textAppearanceId);
    mNumber.setGravity(Gravity.CENTER);//ww w  .j  a  v  a  2  s . c  om
    mNumber.setText(maxValue);
    mNumber.setMaxLines(1);
    mNumber.setSingleLine(true);
    SeekBarCompat.setTextDirection(mNumber, TEXT_DIRECTION_LOCALE);
    mNumber.setVisibility(View.INVISIBLE);

    //add some padding for the elevation shadow not to be clipped
    //I'm sure there are better ways of doing this...
    setPadding(padding, padding, padding, padding);

    resetSizes(maxValue);

    mSeparation = (int) (SEPARATION_DP * displayMetrics.density);
    int thumbSize = (int) (ThumbDrawable.DEFAULT_SIZE_DP * displayMetrics.density);
    ColorStateList color = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_indicatorColor);
    mMarkerDrawable = new MarkerDrawable(color, thumbSize);
    mMarkerDrawable.setCallback(this);
    mMarkerDrawable.setMarkerListener(this);
    mMarkerDrawable.setExternalOffset(padding);

    //Elevation for anroid 5+
    float elevation = a.getDimension(R.styleable.DiscreteSeekBar_dsb_indicatorElevation,
            ELEVATION_DP * displayMetrics.density);
    ViewCompat.setElevation(this, elevation);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        SeekBarCompat.setOutlineProvider(this, mMarkerDrawable);
    }
    a.recycle();
}

From source file:com.lab47billion.appchooser.HorizontalPicker.java

public HorizontalPicker(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    _context = context;/*from   w  w w. j  av  a 2s  .  c om*/

    // create the selector wheel paint
    TextPaint paint = new TextPaint();
    paint.setAntiAlias(true);
    mTextPaint = paint;

    TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.HorizontalPicker, defStyle, 0);

    CharSequence[] values;
    int ellipsize = 3; // END default value
    int sideItems = mSideItems;

    try {
        mTextColor = a.getColorStateList(R.styleable.HorizontalPicker_android_textColor);
        if (mTextColor == null) {
            mTextColor = ColorStateList.valueOf(0xFF000000);
        }

        values = a.getTextArray(R.styleable.HorizontalPicker_values);
        ellipsize = a.getInt(R.styleable.HorizontalPicker_android_ellipsize, ellipsize);
        mDividerSize = a.getDimension(R.styleable.HorizontalPicker_dividerSize, mDividerSize);
        mNormalTextSize = a.getDimension(R.styleable.HorizontalPicker_normalTextSize, 20);
        mSelectedTextSize = a.getDimension(R.styleable.HorizontalPicker_selectedTextSize, -1);
        sideItems = a.getInt(R.styleable.HorizontalPicker_sideItems, sideItems);

        if (mNormalTextSize > -1) {
            setTextSize(mNormalTextSize);
        }
        if (mSelectedTextSize == -1) {
            mSelectedTextSize = mNormalTextSize;
        }

    } finally {
        a.recycle();
    }

    switch (ellipsize) {
    case 1:
        setEllipsize(TextUtils.TruncateAt.START);
        break;
    case 2:
        setEllipsize(TextUtils.TruncateAt.MIDDLE);
        break;
    case 3:
        setEllipsize(TextUtils.TruncateAt.END);
        break;
    case 4:
        setEllipsize(TextUtils.TruncateAt.MARQUEE);
        break;
    }

    Paint.FontMetricsInt fontMetricsInt = mTextPaint.getFontMetricsInt();
    mBoringMetrics = new BoringLayout.Metrics();
    mBoringMetrics.ascent = fontMetricsInt.ascent;
    mBoringMetrics.bottom = fontMetricsInt.bottom;
    mBoringMetrics.descent = fontMetricsInt.descent;
    mBoringMetrics.leading = fontMetricsInt.leading;
    mBoringMetrics.top = fontMetricsInt.top;
    mBoringMetrics.width = mItemWidth;

    setWillNotDraw(false);

    mFlingScrollerX = new OverScroller(context);
    mAdjustScrollerX = new OverScroller(context, new DecelerateInterpolator(2.5f));

    // initialize constants
    ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity()
            / SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT;
    mOverscrollDistance = configuration.getScaledOverscrollDistance();

    mPreviousScrollerX = Integer.MIN_VALUE;

    setValues(values);
    setSideItems(sideItems);

    /*mTouchHelper = new PickerTouchHelper(this);
    ViewCompat.setAccessibilityDelegate(this, mTouchHelper);*/

}

From source file:com.yzy.supercleanmaster.views.SlidingLayer.java

/**
 * Constructor for the sliding layer.<br>
 * By default this panel will/*from  ww  w  .  j a v  a2 s  .com*/
 * <ol>
 * <li>{@link #setStickTo(int)} with param {@link #STICK_TO_RIGHT}</li>
 * <li>Use no shadow drawable. (i.e. with size of 0)</li>
 * <li>Close when the panel is tapped</li>
 * <li>Open when the offset is tapped, but will have an offset of 0</li>
 * </ol>
 *
 * @param context  a reference to an existing context
 * @param attrs    attribute set constructed from attributes set in android .xml file
 * @param defStyle style res id
 */
public SlidingLayer(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    // Style
    final TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SlidingLayer);

    // Set the side of the screen
    setStickTo(ta.getInt(R.styleable.SlidingLayer_stickTo, STICK_TO_TOP));

    // Sets the shadow drawable
    int shadowRes = ta.getResourceId(R.styleable.SlidingLayer_shadowDrawable, INVALID_VALUE);
    if (shadowRes != INVALID_VALUE) {
        setShadowDrawable(shadowRes);
    }

    // Sets the shadow size
    mShadowSize = (int) ta.getDimension(R.styleable.SlidingLayer_shadowSize, 0);

    // Sets the ability to open or close the layer by tapping in any empty space
    changeStateOnTap = ta.getBoolean(R.styleable.SlidingLayer_changeStateOnTap, true);

    // How much of the view sticks out when closed
    mOffsetDistance = ta.getDimensionPixelOffset(R.styleable.SlidingLayer_offsetDistance, 0);

    // Sets the size of the preview summary, if any
    mPreviewOffsetDistance = ta.getDimensionPixelOffset(R.styleable.SlidingLayer_previewOffsetDistance,
            INVALID_VALUE);

    // If showing offset is greater than preview mode offset dimension, exception is thrown
    checkPreviewModeConsistency();

    ta.recycle();

    init();
}

From source file:in.sc9.discreteslider.internal.Marker.java

public Marker(Context context, AttributeSet attrs, int defStyleAttr, String maxValue) {
    super(context, attrs, defStyleAttr);
    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSlider,
            R.attr.discreteSeekBarStyle, R.style.Widget_DiscreteSeekBar);

    int padding = (int) (PADDING_DP * displayMetrics.density) * 2;
    int textAppearanceId = a.getResourceId(R.styleable.DiscreteSlider_dsb_indicatorTextAppearance,
            R.style.Widget_DiscreteIndicatorTextAppearance);
    mNumber = new TextView(context);
    //Add some padding to this textView so the bubble has some space to breath
    mNumber.setPadding(padding, 0, padding, 0);
    mNumber.setTextAppearance(context, textAppearanceId);
    mNumber.setGravity(Gravity.CENTER);//from  w w  w .j  av a2  s  . c  o  m
    mNumber.setText(maxValue);
    mNumber.setMaxLines(1);
    mNumber.setSingleLine(true);
    SeekBarCompat.setTextDirection(mNumber, TEXT_DIRECTION_LOCALE);
    mNumber.setVisibility(View.INVISIBLE);

    //add some padding for the elevation shadow not to be clipped
    //I'm sure there are better ways of doing this...
    setPadding(padding, padding, padding, padding);

    resetSizes(maxValue);

    mSeparation = (int) (SEPARATION_DP * displayMetrics.density);
    int thumbSize = (int) (ThumbDrawable.DEFAULT_SIZE_DP * displayMetrics.density);
    ColorStateList color = a.getColorStateList(R.styleable.DiscreteSlider_dsb_indicatorColor);
    mMarkerDrawable = new MarkerDrawable(color, thumbSize);
    mMarkerDrawable.setCallback(this);
    mMarkerDrawable.setMarkerListener(this);
    mMarkerDrawable.setExternalOffset(padding);

    //Elevation for anroid 5+
    float elevation = a.getDimension(R.styleable.DiscreteSlider_dsb_indicatorElevation,
            ELEVATION_DP * displayMetrics.density);
    ViewCompat.setElevation(this, elevation);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        SeekBarCompat.setOutlineProvider(this, mMarkerDrawable);
    }
    a.recycle();
}

From source file:com.jinzht.pro.discreteseekbar.internal.Marker.java

public Marker(Context context, AttributeSet attrs, int defStyleAttr, String maxValue) {
    super(context, attrs, defStyleAttr);
    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSeekBar,
            R.attr.discreteSeekBarStyle, R.style.Widget_DiscreteSeekBar);

    int padding = (int) (PADDING_DP * displayMetrics.density) * 2;
    int textAppearanceId = a.getResourceId(R.styleable.DiscreteSeekBar_dsb_indicatorTextAppearance,
            R.style.Widget_DiscreteIndicatorTextAppearance);
    mNumber = new TextView(context);
    //Add some padding to this textView so the bubble has some space to breath
    mNumber.setPadding(padding, 0, padding, 0);
    mNumber.setTextAppearance(context, textAppearanceId);
    mNumber.setGravity(Gravity.CENTER);/* w  w w.  j av  a2  s  . com*/
    mNumber.setText(maxValue);
    mNumber.setMaxLines(1);
    mNumber.setSingleLine(true);
    SeekBarCompat.setTextDirection(mNumber, TEXT_DIRECTION_LOCALE);
    mNumber.setVisibility(View.INVISIBLE);

    //add some padding for the elevation shadow not to be clipped
    //I'm sure there are better ways of doing this...
    setPadding(padding, padding, padding, padding);

    resetSizes(maxValue);

    mSeparation = (int) (SEPARATION_DP * displayMetrics.density);
    int thumbSize = (int) (ThumbDrawable.DEFAULT_SIZE_DP * displayMetrics.density);
    ColorStateList color = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_indicatorColor);
    mMarkerDrawable = new MarkerDrawable(color, thumbSize);
    mMarkerDrawable.setCallback(this);
    mMarkerDrawable.setMarkerListener(this);
    mMarkerDrawable.setExternalOffset(padding);

    //Elevation for anroid 5+
    float elevation = a.getDimension(R.styleable.DiscreteSeekBar_dsb_indicatorElevation,
            ELEVATION_DP * displayMetrics.density);
    ViewCompat.setElevation(this, elevation);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        SeekBarCompat.setOutlineProvider(this, mMarkerDrawable);
    }
    a.recycle();
}

From source file:com.mightyworkouts.seekbar.internal.Marker.java

public Marker(Context context, AttributeSet attrs, int defStyleAttr, String maxValue) {
    super(context, attrs, defStyleAttr);
    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSeekBar,
            R.attr.discreteSeekBarStyle, R.style.Widget_DiscreteSeekBar);

    int padding = (int) (PADDING_DP * displayMetrics.density) * 2;
    int textAppearanceId = a.getResourceId(R.styleable.DiscreteSeekBar_dsb_indicatorTextAppearance,
            R.style.Widget_DiscreteIndicatorTextAppearance);
    mNumber = new TextView(context);
    //Add some padding to this textView so the bubble has some space to breath
    mNumber.setPadding(padding, 0, padding, 0);
    mNumber.setTextAppearance(context, textAppearanceId);
    mNumber.setGravity(Gravity.CENTER);//w  ww  . java 2  s  . c  om
    mNumber.setText(maxValue);
    mNumber.setMaxLines(1);
    mNumber.setSingleLine(true);
    SeekBarCompat.setTextDirection(mNumber, TEXT_DIRECTION_LOCALE);
    mNumber.setVisibility(View.INVISIBLE);

    //add some padding for the elevation shadow not to be clipped
    //I'm sure there are better ways of doing this...
    setPadding(padding, padding, padding, padding);

    resetSizes(maxValue);

    mSeparation = (int) (SEPARATION_DP * displayMetrics.density);
    int thumbSize = (int) (ThumbDrawable.DEFAULT_SIZE_DP * displayMetrics.density);
    ColorStateList color = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_indicatorColor);
    mMarkerDrawable = new MarkerDrawable(context, color, thumbSize);
    mMarkerDrawable.setCallback(this);
    mMarkerDrawable.setMarkerListener(this);
    mMarkerDrawable.setExternalOffset(padding);

    //Elevation for anroid 5+
    float elevation = a.getDimension(R.styleable.DiscreteSeekBar_dsb_indicatorElevation,
            ELEVATION_DP * displayMetrics.density);
    ViewCompat.setElevation(this, elevation);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        SeekBarCompat.setOutlineProvider(this, mMarkerDrawable);
    }
    a.recycle();
}

From source file:com.pt.treasuretrash.widget.SlidingLayer.java

/**
 * Constructor for the sliding layer.<br>
 * By default this panel will//from   w  ww. j  av  a 2s . c o  m
 * <ol>
 * <li>{@link #setStickTo(int)} with param {@link #STICK_TO_AUTO}</li>
 * <li>Use no shadow drawable. (i.e. with width of 0)</li>
 * <li>Close when the panel is tapped</li>
 * <li>Open when the offset is tapped, but will have an offset of 0</li>
 * </ol>
 * 
 * @param context
 *            a reference to an existing context
 * @param attrs
 *            attribute set constructed from attributes set in android .xml
 *            file
 * @param defStyle
 *            style res id
 */
public SlidingLayer(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    // Style
    final TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SlidingLayer);

    // Set the side of the screen
    setStickTo(ta.getInt(R.styleable.SlidingLayer_stickTo, STICK_TO_AUTO));

    // Sets the shadow drawable
    int shadowRes = ta.getResourceId(R.styleable.SlidingLayer_shadowDrawable, -1);
    if (shadowRes != -1) {
        setShadowDrawable(shadowRes);
    }

    // Sets the shadow width
    setShadowWidth((int) ta.getDimension(R.styleable.SlidingLayer_shadowWidth, 0));

    // Sets the ability to close the layer by tapping in any empty space
    closeOnTapEnabled = ta.getBoolean(R.styleable.SlidingLayer_closeOnTapEnabled, true);
    // Sets the ability to open the layout by tapping on any of the exposed
    // closed layer
    openOnTapEnabled = ta.getBoolean(R.styleable.SlidingLayer_openOnTapEnabled, true);

    // How much of the view sticks out when closed
    setOffsetWidth(ta.getDimensionPixelOffset(R.styleable.SlidingLayer_offsetWidth, 0));

    ta.recycle();

    init();
}

From source file:com.runzii.lib.widgets.behavior.BottomSheetAnchorBehavior.java

/**
 * Default constructor for inflating BottomSheetBehaviors from layout.
 *
 * @param context The {@link Context}.//from   w w w . j av a  2s .  c  o  m
 * @param attrs   The {@link AttributeSet}.
 */
public BottomSheetAnchorBehavior(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BottomSheetBehavior_Layout);
    TypedValue value = a.peekValue(R.styleable.BottomSheetBehavior_Layout_behavior_peekHeight);
    if (value != null && value.data == PEEK_HEIGHT_AUTO) {
        setPeekHeight(value.data);
    } else {
        setPeekHeight(a.getDimensionPixelSize(R.styleable.BottomSheetBehavior_Layout_behavior_peekHeight,
                PEEK_HEIGHT_AUTO));
    }
    setHideable(a.getBoolean(R.styleable.BottomSheetBehavior_Layout_behavior_hideable, false));
    setSkipCollapsed(a.getBoolean(
            android.support.design.R.styleable.BottomSheetBehavior_Layout_behavior_skipCollapsed, false));
    a.recycle();

    /**
     * Getting the anchorPoint...
     */
    mAnchorPoint = DEFAULT_ANCHOR_POINT;
    a = context.obtainStyledAttributes(attrs, R.styleable.BottomSheetAnchorBehavior);
    if (attrs != null)
        mAnchorPoint = (int) a.getDimension(R.styleable.BottomSheetAnchorBehavior_anchor_point, 0);
    a.recycle();

    ViewConfiguration configuration = ViewConfiguration.get(context);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}

From source file:com.hb.hkm.slidinglayer.SlidLayer.java

/**
 * Constructor for the sliding layer.<br>
 * By default this panel will//from  w w  w  .jav  a  2s . c  o  m
 * <ol>
 * <li>{@link #setStickTo(int)} with param {@link #STICK_TO_RIGHT}</li>
 * <li>Use no shadow drawable. (i.e. with size of 0)</li>
 * <li>Close when the panel is tapped</li>
 * <li>Open when the offset is tapped, but will have an offset of 0</li>
 * </ol>
 *
 * @param context  a reference to an existing context
 * @param attrs    attribute set constructed from attributes set in android .xml file
 * @param defStyle style res id
 */
public SlidLayer(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    // Style
    final TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SlidLayer);

    // Set the side of the screen
    setStickTo(ta.getInt(R.styleable.SlidLayer_stickTo, STICK_TO_RIGHT));

    // Sets the shadow drawable
    int shadowRes = ta.getResourceId(R.styleable.SlidLayer_shadowDrawable, INVALID_VALUE);
    if (shadowRes != INVALID_VALUE) {
        setShadowDrawable(shadowRes);
    }

    // Sets the shadow size
    mShadowSize = (int) ta.getDimension(R.styleable.SlidLayer_shadowSize, 0);

    // Sets the ability to open or close the layer by tapping in any empty space
    changeStateOnTap = ta.getBoolean(R.styleable.SlidLayer_changeStateOnTap, true);

    // How much of the view sticks out when closed
    mOffsetDistance = ta.getDimensionPixelOffset(R.styleable.SlidLayer_offsetDistance, 0);

    // Sets the size of the preview summary, if any
    mPreviewOffsetDistance = ta.getDimensionPixelOffset(R.styleable.SlidLayer_previewOffsetDistance,
            INVALID_VALUE);

    // If showing offset is greater than preview mode offset dimension, exception is thrown
    checkPreviewModeConsistency();

    ta.recycle();

    init();
}

From source file:com.dgmltn.ranger.internal.AbsRangeBar.java

public void initialize(TypedArray ta, boolean recycle) {

    Context context = getContext();

    try {/*from   w  w  w. ja va 2s  . c  o m*/
        // Sets the values of the user-defined attributes based on the XML attributes.
        int tickCount = ta.getInt(R.styleable.AbsRangeBar_tickCount, DEFAULT_TICK_COUNT);
        validateTickCount(tickCount);
        mTickCount = tickCount;

        float density = context.getResources().getDisplayMetrics().density;
        mTickSize = ta.getDimension(R.styleable.AbsRangeBar_tickHeight, DEFAULT_TICK_SIZE_DP * density);
        mBarWeight = ta.getDimension(R.styleable.AbsRangeBar_barWeight, DEFAULT_BAR_WEIGHT_DP * density);
        mBarColor = ta.getColor(R.styleable.AbsRangeBar_rangeBarColor, DEFAULT_BAR_COLOR);
        mActiveBarColor = mBarColor;

        int pinTextColor = ta.getColor(R.styleable.AbsRangeBar_textColor, DEFAULT_TEXT_COLOR);
        mFirstPinTextColor = pinTextColor;
        mSecondPinTextColor = pinTextColor;

        int pinColor = ta.getColor(R.styleable.AbsRangeBar_pinColor, DEFAULT_PIN_COLOR);
        mFirstPinColor = pinColor;
        mSecondPinColor = pinColor;

        mSelectorSize = ta.getDimension(R.styleable.AbsRangeBar_selectorSize, DEFAULT_CIRCLE_SIZE_DP * density);
        int selectorColor = ta.getColor(R.styleable.AbsRangeBar_selectorColor, DEFAULT_CONNECTING_LINE_COLOR);
        mFirstSelectorColor = selectorColor;
        mSecondSelectorColor = selectorColor;
        mActiveFirstCircleColor = selectorColor;
        mActiveSecondCircleColor = selectorColor;

        mTickColor = ta.getColor(R.styleable.AbsRangeBar_tickColor, DEFAULT_TICK_COLOR);
        mActiveTickColor = mTickColor;
        mConnectingLineWeight = ta.getDimension(R.styleable.AbsRangeBar_connectingLineWeight,
                DEFAULT_CONNECTING_LINE_WEIGHT_DP * density);

        int connectingLineColor = ta.getColor(R.styleable.AbsRangeBar_connectingLineColor,
                DEFAULT_CONNECTING_LINE_COLOR);
        mFirstConnectingLineColor = connectingLineColor;
        mSecondConnectingLineColor = connectingLineColor;
        mActiveFirstConnectingLineColor = connectingLineColor;
        mActiveSecondConnectingLineColor = connectingLineColor;

        mExpandedPinRadius = ta.getDimension(R.styleable.AbsRangeBar_pinRadius,
                DEFAULT_EXPANDED_PIN_RADIUS_DP * density);
        mPinPadding = ta.getDimension(R.styleable.AbsRangeBar_pinPadding, DEFAULT_PIN_PADDING_DP * density);
        mIsRangeBar = ta.getBoolean(R.styleable.AbsRangeBar_rangeBar, true);
        mArePinsTemporary = ta.getBoolean(R.styleable.AbsRangeBar_temporaryPins, true);

        float scaledDensity = getResources().getDisplayMetrics().scaledDensity;
        mMinPinFont = ta.getDimension(R.styleable.AbsRangeBar_pinMinFont,
                DEFAULT_MIN_PIN_FONT_SP * scaledDensity);
        mMaxPinFont = ta.getDimension(R.styleable.AbsRangeBar_pinMaxFont,
                DEFAULT_MAX_PIN_FONT_SP * scaledDensity);
    } finally {
        if (recycle) {
            ta.recycle();
        }
    }

    initBar();
    initPins(true);
    setTickCount(mTickCount);
}