Example usage for android.content.res TypedArray getFloat

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

Introduction

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

Prototype

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

Source Link

Document

Retrieve the float value for the attribute at index.

Usage

From source file:com.rbware.github.androidcouchpotato.widget.GuidedActionsStylist.java

/**
 * Creates a view appropriate for displaying a list of GuidedActions, using the provided
 * inflater and container./*ww w  .j a  v a 2 s.co m*/
 * <p>
 * <i>Note: Does not actually add the created view to the container; the caller should do
 * this.</i>
 * @param inflater The layout inflater to be used when constructing the view.
 * @param container The view group to be passed in the call to
 * <code>LayoutInflater.inflate</code>.
 * @return The view to be added to the caller's view hierarchy.
 */
public View onCreateView(LayoutInflater inflater, final ViewGroup container) {
    TypedArray ta = inflater.getContext().getTheme()
            .obtainStyledAttributes(R.styleable.LeanbackGuidedStepTheme);
    float keylinePercent = ta.getFloat(R.styleable.LeanbackGuidedStepTheme_guidedStepKeyline, 40);
    mMainView = (ViewGroup) inflater.inflate(onProvideLayoutId(), container, false);
    mContentView = mMainView
            .findViewById(mButtonActions ? R.id.guidedactions_content2 : R.id.guidedactions_content);
    mBgView = mMainView.findViewById(
            mButtonActions ? R.id.guidedactions_list_background2 : R.id.guidedactions_list_background);
    if (mMainView instanceof VerticalGridView) {
        mActionsGridView = (VerticalGridView) mMainView;
    } else {
        mActionsGridView = (VerticalGridView) mMainView
                .findViewById(mButtonActions ? R.id.guidedactions_list2 : R.id.guidedactions_list);
        if (mActionsGridView == null) {
            throw new IllegalStateException("No ListView exists.");
        }
        mActionsGridView.setWindowAlignmentOffsetPercent(keylinePercent);
        mActionsGridView.setWindowAlignment(VerticalGridView.WINDOW_ALIGN_NO_EDGE);
        if (!mButtonActions) {
            mSubActionsGridView = (VerticalGridView) mMainView.findViewById(R.id.guidedactions_sub_list);
            mSubActionsBackground = mMainView.findViewById(R.id.guidedactions_sub_list_background);
        }
    }
    mActionsGridView.setFocusable(false);
    mActionsGridView.setFocusableInTouchMode(false);

    // Cache widths, chevron alpha values, max and min text lines, etc
    Context ctx = mMainView.getContext();
    TypedValue val = new TypedValue();
    mEnabledChevronAlpha = getFloat(ctx, val, R.attr.guidedActionEnabledChevronAlpha);
    mDisabledChevronAlpha = getFloat(ctx, val, R.attr.guidedActionDisabledChevronAlpha);
    mTitleMinLines = getInteger(ctx, val, R.attr.guidedActionTitleMinLines);
    mTitleMaxLines = getInteger(ctx, val, R.attr.guidedActionTitleMaxLines);
    mDescriptionMinLines = getInteger(ctx, val, R.attr.guidedActionDescriptionMinLines);
    mVerticalPadding = getDimension(ctx, val, R.attr.guidedActionVerticalPadding);
    mDisplayHeight = ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()
            .getHeight();

    mEnabledTextAlpha = Float
            .valueOf(ctx.getResources().getString(R.string.lb_guidedactions_item_unselected_text_alpha));
    mDisabledTextAlpha = Float
            .valueOf(ctx.getResources().getString(R.string.lb_guidedactions_item_disabled_text_alpha));
    mEnabledDescriptionAlpha = Float.valueOf(
            ctx.getResources().getString(R.string.lb_guidedactions_item_unselected_description_text_alpha));
    mDisabledDescriptionAlpha = Float.valueOf(
            ctx.getResources().getString(R.string.lb_guidedactions_item_disabled_description_text_alpha));
    return mMainView;
}

From source file:com.android.andryyu.lifehelper.widget.RippleView.java

/**
 * Method that initializes all fields and sets listeners
 *
 * @param context Context used to create this view
 * @param attrs   Attribute used to initialize fields
 *///www. j  a  v  a2s  . co  m
private void init(final Context context, final AttributeSet attrs) {
    if (isInEditMode())
        return;

    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView);
    rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color, Color.parseColor("#33626262"));
    rippleType = typedArray.getInt(R.styleable.RippleView_rv_type, 0);
    hasToZoom = typedArray.getBoolean(R.styleable.RippleView_rv_zoom, false);
    isCentered = typedArray.getBoolean(R.styleable.RippleView_rv_centered, false);
    rippleDuration = typedArray.getInteger(R.styleable.RippleView_rv_rippleDuration, rippleDuration);
    frameRate = typedArray.getInteger(R.styleable.RippleView_rv_framerate, frameRate);
    rippleAlpha = typedArray.getInteger(R.styleable.RippleView_rv_alpha, rippleAlpha);
    ripplePadding = typedArray.getDimensionPixelSize(R.styleable.RippleView_rv_ripplePadding, 0);
    canvasHandler = new Handler();
    zoomScale = typedArray.getFloat(R.styleable.RippleView_rv_zoomScale, 1.03f);
    zoomDuration = typedArray.getInt(R.styleable.RippleView_rv_zoomDuration, 200);
    isListMode = typedArray.getBoolean(R.styleable.RippleView_rv_listMode, false);
    typedArray.recycle();
    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(rippleColor);
    paint.setAlpha(rippleAlpha);
    this.setWillNotDraw(false);

    gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public void onLongPress(MotionEvent event) {
            super.onLongPress(event);
            animateRipple(event);
            sendClickEvent(true);
            lastLongPressX = (int) event.getX();
            lastLongPressY = (int) event.getY();
            rippleStatus = RIPPLE_LONG_PRESS;
        }

        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
            return true;
        }

        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            return true;
        }
    });

    this.setDrawingCacheEnabled(true);
    this.setClickable(true);
    this.touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
}

From source file:uk.co.brightec.ratetheapp.RateTheApp.java

private void loadAttributes(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.RateTheApp, defStyleAttr,
            defStyleRes);/* w  ww  .  java 2s .c  o m*/

    // Instance name for this rating bar
    mInstanceName = PREF_RATETHEAPP_PREFIX;
    String instanceName = a.getString(R.styleable.RateTheApp_rateTheAppName);
    if (instanceName != null) {
        mInstanceName += "_" + instanceName;
    }

    // Title Text Appearance
    mTitleTextAppearanceResId = a.getResourceId(R.styleable.RateTheApp_rateTheAppTitleTextAppearance,
            R.style.RateTheAppTitleTextAppearance);
    mTitleStr = a.getString(R.styleable.RateTheApp_rateTheAppTitleText);

    // Message Text Appearance
    mMessageTextAppearanceResId = a.getResourceId(R.styleable.RateTheApp_rateTheAppMessageTextAppearance,
            R.style.RateTheAppMessageTextAppearance);
    mMessageStr = a.getString(R.styleable.RateTheApp_rateTheAppMessageText);

    // Stars & Rating
    mNumberOfStars = a.getInt(R.styleable.RateTheApp_rateTheAppNumberOfStars, DEFAULT_NUMBER_OF_STARS);
    mStepSize = a.getFloat(R.styleable.RateTheApp_rateTheAppStepSize, DEFAULT_STEP_SIZE);
    mDefaultRating = a.getFloat(R.styleable.RateTheApp_rateTheAppDefaultRating, DEFAULT_RATING);
    mSelectedStarColour = a.getColor(R.styleable.RateTheApp_rateTheAppSelectedStarColor,
            ContextCompat.getColor(getContext(), R.color.RateTheApp_SelectedStarColor));
    mUnselectedStarColour = a.getColor(R.styleable.RateTheApp_rateTheAppUnselectedStarColor,
            ContextCompat.getColor(getContext(), R.color.RateTheApp_UnselectedStarColor));
    mDrawableResUnSelected = a.getResourceId(R.styleable.RateTheApp_rateTheAppStarUnSelectedDrawable,
            R.drawable.ic_rating_star_border_grey_36dp);
    mDrawableResSelected = a.getResourceId(R.styleable.RateTheApp_rateTheAppStarSelectedDrawable,
            R.drawable.ic_rating_star_green_36dp);

    mSaveRating = a.getBoolean(R.styleable.RateTheApp_rateTheAppSaveRating, true);

    a.recycle();
}

From source file:com.dl7.commonlib.views.RippleView.java

/**
 * Method that initializes all fields and sets listeners
 *
 * @param context Context used to create this view
 * @param attrs Attribute used to initialize fields
 *///  www  .  jav a 2s.com
private void init(final Context context, final AttributeSet attrs) {
    if (isInEditMode())
        return;

    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView);
    rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color,
            ContextCompat.getColor(context, R.color.rippelColor));
    rippleType = typedArray.getInt(R.styleable.RippleView_rv_type, 0);
    hasToZoom = typedArray.getBoolean(R.styleable.RippleView_rv_zoom, false);
    isCentered = typedArray.getBoolean(R.styleable.RippleView_rv_centered, false);
    rippleDuration = typedArray.getInteger(R.styleable.RippleView_rv_rippleDuration, rippleDuration);
    frameRate = typedArray.getInteger(R.styleable.RippleView_rv_framerate, frameRate);
    rippleAlpha = typedArray.getInteger(R.styleable.RippleView_rv_alpha, rippleAlpha);
    ripplePadding = typedArray.getDimensionPixelSize(R.styleable.RippleView_rv_ripplePadding, 0);
    canvasHandler = new Handler();
    zoomScale = typedArray.getFloat(R.styleable.RippleView_rv_zoomScale, 1.03f);
    zoomDuration = typedArray.getInt(R.styleable.RippleView_rv_zoomDuration, 200);
    isListMode = typedArray.getBoolean(R.styleable.RippleView_rv_listMode, false);
    typedArray.recycle();
    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(rippleColor);
    paint.setAlpha(rippleAlpha);
    this.setWillNotDraw(false);

    gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public void onLongPress(MotionEvent event) {
            super.onLongPress(event);
            animateRipple(event);
            sendClickEvent(true);
            lastLongPressX = (int) event.getX();
            lastLongPressY = (int) event.getY();
            rippleStatus = RIPPLE_LONG_PRESS;
        }

        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
            return true;
        }

        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            return true;
        }
    });

    this.setDrawingCacheEnabled(true);
    this.setClickable(true);
    this.touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
}

From source file:com.tr4android.support.extension.widget.FloatingActionMenu.java

private void init(Context context, AttributeSet attributeSet) {
    mButtonSpacing = getResources().getDimensionPixelSize(R.dimen.fam_spacing);
    mLabelsMargin = getResources().getDimensionPixelSize(R.dimen.fam_label_spacing);
    mLabelsVerticalOffset = 0;/*from  w  w w  . j av  a2  s.co  m*/

    TypedArray attr = context.obtainStyledAttributes(attributeSet, R.styleable.FloatingActionMenu, 0, 0);
    mExpandDirection = attr.getInt(R.styleable.FloatingActionMenu_fabMenuExpandDirection, EXPAND_UP);
    mLabelsPosition = attr.getInt(R.styleable.FloatingActionMenu_fabMenuLabelPosition, LABELS_ON_LEFT_SIDE);
    mLabelsStyle = attr.getResourceId(R.styleable.FloatingActionMenu_fabMenuLabelStyle, 0);
    int mCloseDrawableResourceId = attr.getResourceId(R.styleable.FloatingActionMenu_fabMenuCloseIconSrc, 0);
    mCloseDrawable = mCloseDrawableResourceId == 0 ? null
            : AppCompatDrawableManager.get().getDrawable(getContext(), mCloseDrawableResourceId);
    mCloseAngle = attr.getFloat(R.styleable.FloatingActionMenu_fabMenuCloseIconAngle, 0);
    mButtonSpacing = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_fabMenuSpacing, mButtonSpacing);
    attr.recycle();

    if (mLabelsStyle != 0 && expandsHorizontally()) {
        throw new IllegalStateException("Action labels in horizontal expand orientation is not supported.");
    }

    // So we can catch the back button
    setFocusableInTouchMode(true);
}

From source file:com.roughike.bottombar.BottomBar.java

private void populateAttributes(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    primaryColor = MiscUtils.getColor(getContext(), R.attr.colorPrimary);
    screenWidth = MiscUtils.getScreenWidth(getContext());
    tenDp = MiscUtils.dpToPixel(getContext(), 10);
    maxFixedItemWidth = MiscUtils.dpToPixel(getContext(), 168);

    TypedArray ta = context.getTheme().obtainStyledAttributes(attrs, R.styleable.BottomBar, defStyleAttr,
            defStyleRes);//  ww w. j  a va 2s  .co m

    try {
        tabXmlResource = ta.getResourceId(R.styleable.BottomBar_bb_tabXmlResource, 0);
        isTabletMode = ta.getBoolean(R.styleable.BottomBar_bb_tabletMode, false);
        behaviors = ta.getInteger(R.styleable.BottomBar_bb_behavior, BEHAVIOR_NONE);
        inActiveTabAlpha = ta.getFloat(R.styleable.BottomBar_bb_inActiveTabAlpha,
                isShiftingMode() ? DEFAULT_INACTIVE_SHIFTING_TAB_ALPHA : 1);
        activeTabAlpha = ta.getFloat(R.styleable.BottomBar_bb_activeTabAlpha, 1);

        @ColorInt
        int defaultInActiveColor = isShiftingMode() ? Color.WHITE
                : ContextCompat.getColor(context, R.color.bb_inActiveBottomBarItemColor);
        int defaultActiveColor = isShiftingMode() ? Color.WHITE : primaryColor;

        longPressHintsEnabled = ta.getBoolean(R.styleable.BottomBar_bb_longPressHintsEnabled, true);
        inActiveTabColor = ta.getColor(R.styleable.BottomBar_bb_inActiveTabColor, defaultInActiveColor);
        activeTabColor = ta.getColor(R.styleable.BottomBar_bb_activeTabColor, defaultActiveColor);
        badgeBackgroundColor = ta.getColor(R.styleable.BottomBar_bb_badgeBackgroundColor, Color.RED);
        hideBadgeWhenActive = ta.getBoolean(R.styleable.BottomBar_bb_badgesHideWhenActive, true);
        titleTextAppearance = ta.getResourceId(R.styleable.BottomBar_bb_titleTextAppearance, 0);
        titleTypeFace = getTypeFaceFromAsset(ta.getString(R.styleable.BottomBar_bb_titleTypeFace));
        showShadow = ta.getBoolean(R.styleable.BottomBar_bb_showShadow, true);
    } finally {
        ta.recycle();
    }
}

From source file:org.florescu.android.rangeseekbar.RangeSeekBar.java

@SuppressWarnings("unchecked")
private T extractNumericValueFromAttributes(TypedArray a, int attribute, int defaultValue) {
    TypedValue tv = a.peekValue(attribute);
    if (tv == null) {
        return (T) Integer.valueOf(defaultValue);
    }//from  ww w .  j a  va2s.c om

    int type = tv.type;
    if (type == TypedValue.TYPE_FLOAT) {
        return (T) Float.valueOf(a.getFloat(attribute, defaultValue));
    } else {
        return (T) Integer.valueOf(a.getInteger(attribute, defaultValue));
    }
}

From source file:com.plugin.weight.ripple.RippleLayoutView.java

/**
 * Method that initializes all fields and sets listeners
 *
 * @param context Context used to create this view
 * @param attrs   Attribute used to initialize fields
 *///from  www .j av a  2  s.  co m
private void init(final Context context, final AttributeSet attrs) {
    if (isInEditMode())
        return;

    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleLayoutView);
    rippleColor = typedArray.getColor(R.styleable.RippleLayoutView_rv_color,
            ContextCompat.getColor(context, R.color.rippelColor));//?
    rippleType = typedArray.getInt(R.styleable.RippleLayoutView_rv_type, 0);//?
    hasToZoom = typedArray.getBoolean(R.styleable.RippleLayoutView_rv_zoom, false);//?
    isCentered = typedArray.getBoolean(R.styleable.RippleLayoutView_rv_centered, false);//?
    rippleDuration = typedArray.getInteger(R.styleable.RippleLayoutView_rv_rippleDuration, rippleDuration);
    frameRate = typedArray.getInteger(R.styleable.RippleLayoutView_rv_framerate, frameRate);
    rippleAlpha = typedArray.getInteger(R.styleable.RippleLayoutView_rv_alpha, rippleAlpha);
    ripplePadding = typedArray.getDimensionPixelSize(R.styleable.RippleLayoutView_rv_ripplePadding, 0);
    canvasHandler = new Handler();
    zoomScale = typedArray.getFloat(R.styleable.RippleLayoutView_rv_zoomScale, 1.03f);
    zoomDuration = typedArray.getInt(R.styleable.RippleLayoutView_rv_zoomDuration, 200);
    typedArray.recycle();
    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(rippleColor);
    paint.setAlpha(rippleAlpha);
    this.setWillNotDraw(false);

    gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public void onLongPress(MotionEvent event) {
            super.onLongPress(event);
            animateRipple(event);
            sendClickEvent(true);
        }

        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
            return true;
        }

        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            return true;
        }
    });

    this.setDrawingCacheEnabled(true);
    this.setClickable(true);
}

From source file:net.opacapp.multilinecollapsingtoolbar.CollapsingTextHelper.java

void setExpandedTextAppearance(int resId) {
    TypedArray a = mView.getContext().obtainStyledAttributes(resId,
            android.support.v7.appcompat.R.styleable.TextAppearance);
    if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
        mExpandedTextColor = a.getColor(
                android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor, mExpandedTextColor);
    }/*from w  w w .j a  v  a 2  s .c  o m*/
    if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
        mExpandedTextSize = a.getDimensionPixelSize(
                android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,
                (int) mExpandedTextSize);
    }
    mExpandedShadowColor = a.getInt(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor,
            0);
    mExpandedShadowDx = a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx, 0);
    mExpandedShadowDy = a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy, 0);
    mExpandedShadowRadius = a
            .getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius, 0);
    a.recycle();

    if (Build.VERSION.SDK_INT >= 16) {
        mExpandedTypeface = readFontFamilyTypeface(resId);
    }

    recalculate();
}

From source file:am.widget.indicatortabstrip.IndicatorTabStrip.java

public IndicatorTabStrip(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setItemClickable(true);/* www .  ja v  a2  s.  c  o m*/
    setClickSmoothScroll(true);
    final float density = getResources().getDisplayMetrics().density;
    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    mTextPaint.setTextAlign(Align.CENTER);
    if (Build.VERSION.SDK_INT > 4) {
        updateTextPaintDensity();
    }
    mTagLocation = new TagLocation(TagLocation.LOCATION_EDGE);
    final TypedArray a = context.obtainStyledAttributes(attrs, ATTRS);
    int n = a.getIndexCount();
    int textSize = (int) (DEFAULT_TEXT_SIZE * density);
    ColorStateList textColors = null;
    Drawable divider = null;
    for (int i = 0; i < n; i++) {
        int attr = a.getIndex(i);
        switch (attr) {
        case 0:
            textSize = a.getDimensionPixelSize(attr, textSize);
            break;
        case 1:
            textColors = a.getColorStateList(attr);
            break;
        case 2:
            divider = a.getDrawable(attr);
            break;
        }
    }
    a.recycle();
    float scale = 1;
    Drawable itemBackground = null;
    ColorStateList gradient = null;
    Drawable indicator = null;
    int indicatorWidthMode = INDICATOR_WIDTH_MODE_SET;
    int indicatorPadding = 0;
    int indicatorWidth = INDICATOR_WIDTH_BY_DRAWABLE;
    int indicatorHeight = INDICATOR_HEIGHT_BY_DRAWABLE;
    Drawable interval = null;
    int minItemWidth = (int) (DEFAULT_ITEM_WIDTH * density);
    int minItemHeight = (int) (DEFAULT_ITEM_HEIGHT * density);
    int tagTextSize = (int) (DEFAULT_TAG_TEXT_SIZE * density);
    int tagTextColor = DEFAULT_TAG_TEXT_COLOR;
    Drawable tagBackground = getDefaultTagBackground();
    int tagMinSizeMode = TAG_MIN_SIZE_MODE_HAS_TEXT;
    int tagMinWidth = (int) (DEFAULT_TAG_MIN_SIZE * density);
    int tagMinHeight = (int) (DEFAULT_TAG_MIN_SIZE * density);
    int tagPaddingLeft = 0;
    int tagPaddingTop = 0;
    int tagPaddingRight = 0;
    int tagPaddingBottom = 0;
    int tagMarginLeft = 0;
    int tagMarginTop = 0;
    int tagMarginRight = 0;
    int tagMarginBottom = 0;
    TypedArray custom = context.obtainStyledAttributes(attrs, R.styleable.IndicatorTabStrip);
    textSize = custom.getDimensionPixelSize(R.styleable.IndicatorTabStrip_ttsTextSize, textSize);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsTextColor))
        textColors = custom.getColorStateList(R.styleable.IndicatorTabStrip_ttsTextColor);
    scale = custom.getFloat(R.styleable.IndicatorTabStrip_ttsTextScale, scale);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsBackground))
        itemBackground = custom.getDrawable(R.styleable.IndicatorTabStrip_ttsBackground);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsGradient))
        gradient = custom.getColorStateList(R.styleable.IndicatorTabStrip_ttsGradient);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsDivider))
        divider = custom.getDrawable(R.styleable.IndicatorTabStrip_ttsDivider);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsIndicator))
        indicator = custom.getDrawable(R.styleable.IndicatorTabStrip_ttsIndicator);
    indicatorWidthMode = custom.getInt(R.styleable.IndicatorTabStrip_ttsIndicatorWidthMode, indicatorWidthMode);
    indicatorPadding = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsIndicatorPadding,
            indicatorPadding);
    indicatorWidth = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsIndicatorWidth,
            indicatorWidth);
    indicatorHeight = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsIndicatorHeight,
            indicatorHeight);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsInterval))
        interval = custom.getDrawable(R.styleable.IndicatorTabStrip_ttsInterval);
    minItemWidth = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsMinItemWidth, minItemWidth);
    minItemHeight = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsMinItemHeight,
            minItemHeight);
    tagTextSize = custom.getDimensionPixelSize(R.styleable.IndicatorTabStrip_ttsTagTextSize, tagTextSize);
    tagTextColor = custom.getColor(R.styleable.IndicatorTabStrip_ttsTagTextColor, tagTextColor);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsTagBackground))
        tagBackground = custom.getDrawable(R.styleable.IndicatorTabStrip_ttsTagBackground);
    tagMinSizeMode = custom.getInt(R.styleable.IndicatorTabStrip_ttsTagMinSizeMode, tagMinSizeMode);
    tagMinWidth = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMinWidth, tagMinWidth);
    tagMinHeight = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMinHeight, tagMinHeight);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsTagPadding)) {
        final int padding = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagPadding, 0);
        tagPaddingLeft = padding;
        tagPaddingTop = padding;
        tagPaddingRight = padding;
        tagPaddingBottom = padding;
    }
    tagPaddingLeft = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagPaddingLeft,
            tagPaddingLeft);
    tagPaddingTop = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagPaddingTop,
            tagPaddingTop);
    tagPaddingRight = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagPaddingRight,
            tagPaddingRight);
    tagPaddingBottom = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagPaddingBottom,
            tagPaddingBottom);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsTagMargin)) {
        final int margin = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMargin, 0);
        tagMarginLeft = margin;
        tagMarginTop = margin;
        tagMarginRight = margin;
        tagMarginBottom = margin;
    }
    tagMarginLeft = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMarginLeft,
            tagMarginLeft);
    tagMarginTop = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMarginTop, tagMarginTop);
    tagMarginRight = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMarginRight,
            tagMarginRight);
    tagMarginBottom = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMarginBottom,
            tagMarginBottom);
    custom.recycle();
    setTextSize(textSize);
    if (textColors != null) {
        setTextColor(textColors);
    } else {
        setTextColor(DEFAULT_TEXT_COLOR);
    }
    setTextScale(scale);
    setItemBackground(itemBackground);
    setGradient(gradient);
    setDivider(divider);
    setIndicator(indicator);
    setIndicatorWidthMode(indicatorWidthMode);
    setIndicatorPadding(indicatorPadding);
    setIndicatorWidth(indicatorWidth);
    setIndicatorHeight(indicatorHeight);
    setInterval(interval);
    setMinItemWidth(minItemWidth);
    setMinItemHeight(minItemHeight);
    setTagTextSize(tagTextSize);
    setTagTextColor(tagTextColor);
    setTagBackground(tagBackground);
    setTagMinSizeMode(tagMinSizeMode);
    setTagMinWidth(tagMinWidth);
    setTagMinHeight(tagMinHeight);
    setTagPadding(tagPaddingLeft, tagPaddingTop, tagPaddingRight, tagPaddingBottom);
    setTagMargin(tagMarginLeft, tagMarginTop, tagMarginRight, tagMarginBottom);
}