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.hippo.vectorold.drawable.VectorDrawable.java

private void updateStateFromTypedArray(TypedArray a) throws XmlPullParserException {
    final VectorDrawableState state = mVectorState;
    final VPathRenderer pathRenderer = state.mVPathRenderer;

    // Account for any configuration changes.
    state.mChangingConfigurations |= 0; //a.getChangingConfigurations();

    final int tintMode = a.getInt(R.styleable.VectorDrawable_tintMode, -1);
    if (tintMode != -1) {
        state.mTintMode = DrawableUtils.parseTintMode(tintMode, Mode.SRC_IN);
    }// w ww . j a va2s. co  m

    final ColorStateList tint = a.getColorStateList(R.styleable.VectorDrawable_tint);
    if (tint != null) {
        state.mTint = tint;
    }

    state.mAutoMirrored = a.getBoolean(R.styleable.VectorDrawable_autoMirrored, state.mAutoMirrored);

    pathRenderer.mViewportWidth = a.getFloat(R.styleable.VectorDrawable_viewportWidth,
            pathRenderer.mViewportWidth);
    pathRenderer.mViewportHeight = a.getFloat(R.styleable.VectorDrawable_viewportHeight,
            pathRenderer.mViewportHeight);

    if (pathRenderer.mViewportWidth <= 0) {
        throw new XmlPullParserException(
                a.getPositionDescription() + "<vector> tag requires viewportWidth > 0");
    } else if (pathRenderer.mViewportHeight <= 0) {
        throw new XmlPullParserException(
                a.getPositionDescription() + "<vector> tag requires viewportHeight > 0");
    }

    pathRenderer.mBaseWidth = a.getDimension(R.styleable.VectorDrawable_width, pathRenderer.mBaseWidth);
    pathRenderer.mBaseHeight = a.getDimension(R.styleable.VectorDrawable_height, pathRenderer.mBaseHeight);

    if (pathRenderer.mBaseWidth <= 0) {
        throw new XmlPullParserException(a.getPositionDescription() + "<vector> tag requires width > 0");
    } else if (pathRenderer.mBaseHeight <= 0) {
        throw new XmlPullParserException(a.getPositionDescription() + "<vector> tag requires height > 0");
    }

    final float alphaInFloat = a.getFloat(R.styleable.VectorDrawable_alpha, pathRenderer.getAlpha());
    pathRenderer.setAlpha(alphaInFloat);

    final String name = a.getString(R.styleable.VectorDrawable_name);
    if (name != null) {
        pathRenderer.mRootName = name;
        pathRenderer.mVGTargetsMap.put(name, pathRenderer);
    }
}

From source file:com.jecelyin.android.common.widget.TabLayout.java

public TabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    // Disable the Scroll Bar
    setHorizontalScrollBarEnabled(false);
    // Set us to fill the View port
    setFillViewport(true);//  ww w.  j  a v  a2 s  .c  o  m

    // Add the TabStrip
    mTabStrip = new SlidingTabStrip(context);

    TypedArray a;
    //add divider support
    if (Build.VERSION.SDK_INT >= 11) {
        a = context.getTheme().obtainStyledAttributes(attrs, new int[] { android.R.attr.divider,
                android.R.attr.showDividers, android.R.attr.dividerPadding, }, defStyleAttr, 0);
        mDivider = a.getDrawable(0);
        mShowDividers = a.getInt(1, LinearLayout.SHOW_DIVIDER_NONE);
        mDividerPadding = a.getDimensionPixelSize(2, 0);
        a.recycle();
        //?????
        a = context.getTheme().obtainStyledAttributes(attrs, new int[] { android.R.attr.lineSpacingMultiplier },
                defStyleAttr, 0);
        mSpacingMult = a.getFloat(0, 1.0f);
        a.recycle();

        if (Build.VERSION.SDK_INT >= 14) {
            mTabStrip.setDividerPadding(mDividerPadding);
        } else {
            Rect b = mDivider.getBounds();
            mDivider.setBounds(b.left, b.top, b.right + mDividerPadding * 2, b.bottom);
        }
        mTabStrip.setDividerDrawable(mDivider);
        mTabStrip.setShowDividers(mShowDividers);
    }
    //end

    addView(mTabStrip, LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);

    a = context.obtainStyledAttributes(attrs, R.styleable.TabLayout, defStyleAttr,
            R.style.Widget_Design_TabLayout);

    mTabStrip.setSelectedIndicatorHeight(a.getDimensionPixelSize(R.styleable.TabLayout_tabIndicatorHeight, 0));
    mTabStrip.setSelectedIndicatorColor(a.getColor(R.styleable.TabLayout_tabIndicatorColor, 0));

    mTabTextAppearance = a.getResourceId(R.styleable.TabLayout_tabTextAppearance,
            R.style.TextAppearance_Design_Tab);

    mTabPaddingStart = mTabPaddingTop = mTabPaddingEnd = mTabPaddingBottom = a
            .getDimensionPixelSize(R.styleable.TabLayout_tabPadding, 0);
    mTabPaddingStart = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingStart, mTabPaddingStart);
    mTabPaddingTop = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingTop, mTabPaddingTop);
    mTabPaddingEnd = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingEnd, mTabPaddingEnd);
    mTabPaddingBottom = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingBottom, mTabPaddingBottom);

    if (a.hasValue(R.styleable.TabLayout_tabSelectedTextColor)) {
        mTabSelectedTextColor = a.getColor(R.styleable.TabLayout_tabSelectedTextColor, 0);
        mTabSelectedTextColorSet = true;
    }

    mTabMinWidth = a.getDimensionPixelSize(R.styleable.TabLayout_tabMinWidth, 0);
    mRequestedTabMaxWidth = a.getDimensionPixelSize(R.styleable.TabLayout_tabMaxWidth, 0);
    mTabBackgroundResId = a.getResourceId(R.styleable.TabLayout_tabBackground, 0);
    mContentInsetStart = a.getDimensionPixelSize(R.styleable.TabLayout_tabContentStart, 0);
    mMode = a.getInt(R.styleable.TabLayout_tabMode, MODE_FIXED);
    mTabGravity = a.getInt(R.styleable.TabLayout_tabGravity, GRAVITY_FILL);
    a.recycle();

    // Now apply the tab mode and gravity
    applyModeAndGravity();
}

From source file:com.gm.common.ui.widget.pageindicator.PageIndicatorView.java

private void initSizeAttribute(@NonNull TypedArray typedArray) {
    int orientationIndex = typedArray.getInt(R.styleable.PageIndicatorView_piv_orientation,
            Orientation.HORIZONTAL.ordinal());
    if (orientationIndex == 0) {
        orientation = Orientation.HORIZONTAL;
    } else {//from w w w .j  a v a  2  s . c o m
        orientation = Orientation.VERTICAL;
    }

    radiusPx = (int) typedArray.getDimension(R.styleable.PageIndicatorView_piv_radius,
            DensityUtils.dpToPx(DEFAULT_RADIUS_DP));
    paddingPx = (int) typedArray.getDimension(R.styleable.PageIndicatorView_piv_padding,
            DensityUtils.dpToPx(DEFAULT_PADDING_DP));

    scaleFactor = typedArray.getFloat(R.styleable.PageIndicatorView_piv_scaleFactor,
            ScaleAnimation.DEFAULT_SCALE_FACTOR);
    if (scaleFactor < ScaleAnimation.MIN_SCALE_FACTOR) {
        scaleFactor = ScaleAnimation.MIN_SCALE_FACTOR;

    } else if (scaleFactor > ScaleAnimation.MAX_SCALE_FACTOR) {
        scaleFactor = ScaleAnimation.MAX_SCALE_FACTOR;
    }

    strokePx = (int) typedArray.getDimension(R.styleable.PageIndicatorView_piv_strokeWidth,
            DensityUtils.dpToPx(FillAnimation.DEFAULT_STROKE_DP));
    if (strokePx > radiusPx) {
        strokePx = radiusPx;
    }

    if (animationType != AnimationType.FILL) {
        strokePx = 0;
    }
}

From source file:org.alice.jack_blog.widget.refreshContainer.CanRefreshLayout.java

public CanRefreshLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CanRefreshLayout, defStyleAttr, 0);

    try {/*  ww w  .j a  v  a 2  s . c  o  m*/
        final int N = a.getIndexCount();
        for (int i = 0; i < N; i++) {
            int attr = a.getIndex(i);
            if (attr == R.styleable.CanRefreshLayout_can_enabled_up) {
                setRefreshEnabled(a.getBoolean(attr, true));

            } else if (attr == R.styleable.CanRefreshLayout_can_enabled_down) {
                setLoadMoreEnabled(a.getBoolean(attr, true));

            } else if (attr == R.styleable.CanRefreshLayout_can_style_up) {
                mHeadStyle = a.getInt(attr, CLASSIC);

            } else if (attr == R.styleable.CanRefreshLayout_can_style_down) {
                mFootStyle = a.getInt(attr, CLASSIC);

            } else if (attr == R.styleable.CanRefreshLayout_can_friction) {

                setFriction(a.getFloat(attr, DEFAULT_FRICTION));

            } else if (attr == R.styleable.CanRefreshLayout_can_duration) {

                mDuration = a.getInt(attr, DEFAULT_DURATION);

            } else if (attr == R.styleable.CanRefreshLayout_can_smooth_duration) {

                mSmoothDuration = a.getInt(attr, DEFAULT_SMOOTH_DURATION);

            } else if (attr == R.styleable.CanRefreshLayout_can_smooth_length) {

                mSmoothLength = a.getInt(attr, DEFAULT_SMOOTH_LENGTH);

            } else if (attr == R.styleable.CanRefreshLayout_can_bg_up) {

                mRefreshBackgroundResource = a.getResourceId(attr, android.R.color.transparent);

            } else if (attr == R.styleable.CanRefreshLayout_can_bg_down) {

                mLoadMoreBackgroundResource = a.getResourceId(attr, android.R.color.transparent);

            } else if (attr == R.styleable.CanRefreshLayout_can_is_coo) {

                mIsCoo = a.getBoolean(attr, false);

            }
        }

    } finally {
        a.recycle();
    }

}

From source file:com.akshay.protocol10.asplayer.widget.SlidingUpPanelLayout.java

public SlidingUpPanelLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (isInEditMode()) {
        mShadowDrawable = null;//from w w  w.ja  v a 2 s. c o  m
        mDragHelper = null;
        return;
    }

    if (attrs != null) {
        TypedArray defAttrs = context.obtainStyledAttributes(attrs, DEFAULT_ATTRS);

        if (defAttrs != null) {
            int gravity = defAttrs.getInt(0, Gravity.NO_GRAVITY);
            if (gravity != Gravity.TOP && gravity != Gravity.BOTTOM) {
                throw new IllegalArgumentException("gravity must be set to either top or bottom");
            }
            mIsSlidingUp = gravity == Gravity.BOTTOM;
        }

        defAttrs.recycle();

        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SlidingUpPanelLayout);

        if (ta != null) {
            mPanelHeight = ta.getDimensionPixelSize(R.styleable.SlidingUpPanelLayout_panelHeight, -1);
            mShadowHeight = ta.getDimensionPixelSize(R.styleable.SlidingUpPanelLayout_shadowHeight, -1);
            mParallaxOffset = ta.getDimensionPixelSize(R.styleable.SlidingUpPanelLayout_paralaxOffset, -1);

            mMinFlingVelocity = ta.getInt(R.styleable.SlidingUpPanelLayout_flingVelocity,
                    DEFAULT_MIN_FLING_VELOCITY);
            mCoveredFadeColor = ta.getColor(R.styleable.SlidingUpPanelLayout_fadeColor, DEFAULT_FADE_COLOR);

            mDragViewResId = ta.getResourceId(R.styleable.SlidingUpPanelLayout_dragView, -1);

            mOverlayContent = ta.getBoolean(R.styleable.SlidingUpPanelLayout_overlay, DEFAULT_OVERLAY_FLAG);

            mAnchorPoint = ta.getFloat(R.styleable.SlidingUpPanelLayout_anchorPoint, DEFAULT_ANCHOR_POINT);

            mSlideState = SlideState.values()[ta.getInt(R.styleable.SlidingUpPanelLayout_initialState,
                    DEFAULT_SLIDE_STATE.ordinal())];
        }

        ta.recycle();
    }

    final float density = context.getResources().getDisplayMetrics().density;
    if (mPanelHeight == -1) {
        mPanelHeight = (int) (DEFAULT_PANEL_HEIGHT * density + 0.5f);
    }
    if (mShadowHeight == -1) {
        mShadowHeight = (int) (DEFAULT_SHADOW_HEIGHT * density + 0.5f);
    }
    if (mParallaxOffset == -1) {
        mParallaxOffset = (int) (DEFAULT_PARALAX_OFFSET * density);
    }
    // If the shadow height is zero, don't show the shadow
    if (mShadowHeight > 0) {
        if (mIsSlidingUp) {
            mShadowDrawable = getResources().getDrawable(R.drawable.above_shadow);
        } else {
            mShadowDrawable = getResources().getDrawable(R.drawable.below_shadow);
        }

    } else {
        mShadowDrawable = null;
    }

    setWillNotDraw(false);

    mDragHelper = ViewDragHelper.create(this, 0.5f, new DragHelperCallback());
    mDragHelper.setMinVelocity(mMinFlingVelocity * density);

    mIsSlidingEnabled = true;
}

From source file:de.mrapp.android.sidebar.Sidebar.java

/**
 * Obtains the speed of the animation, which is used to show or hide the sidebar, from a
 * specific typed array./*from  www . j av  a 2 s.  c  o  m*/
 *
 * @param typedArray
 *         The typed array, the speed of the animation should be obtained from, as an instance
 *         of the class {@link TypedArray}. The typed array may not be null
 */
private void obtainAnimationSpeed(@NonNull final TypedArray typedArray) {
    setAnimationSpeed(typedArray.getFloat(R.styleable.Sidebar_animationSpeed, DEFAULT_ANIMATION_SPEED));
}

From source file:com.wnafee.vector.compat.VectorDrawable.java

private void updateStateFromTypedArray(TypedArray a) throws XmlPullParserException {
    final VectorDrawableState state = mVectorState;
    final VPathRenderer pathRenderer = state.mVPathRenderer;

    // Account for any configuration changes.
    state.mChangingConfigurations |= getChangingConfigurations(a);

    // Extract the theme attributes, if any.
    //TODO: will not support drawable theming yet (applies to tinting mainly)
    //state.mThemeAttrs = a.extractThemeAttrs();

    final int tintMode = a.getInt(R.styleable.VectorDrawable_vc_tintMode, -1);
    if (tintMode != -1) {
        state.mTintMode = parseTintMode(tintMode, Mode.SRC_IN);
    }//from w w  w.jav  a  2s .  c o m

    final ColorStateList tint = a.getColorStateList(R.styleable.VectorDrawable_vc_tint);
    if (tint != null) {
        state.mTint = tint;
    }

    state.mAutoMirrored = a.getBoolean(R.styleable.VectorDrawable_vc_autoMirrored, state.mAutoMirrored);

    pathRenderer.mViewportWidth = a.getFloat(R.styleable.VectorDrawable_vc_viewportWidth,
            pathRenderer.mViewportWidth);
    pathRenderer.mViewportHeight = a.getFloat(R.styleable.VectorDrawable_vc_viewportHeight,
            pathRenderer.mViewportHeight);

    if (pathRenderer.mViewportWidth <= 0) {
        throw new XmlPullParserException(
                a.getPositionDescription() + "<menu_vector> tag requires viewportWidth > 0");
    } else if (pathRenderer.mViewportHeight <= 0) {
        throw new XmlPullParserException(
                a.getPositionDescription() + "<menu_vector> tag requires viewportHeight > 0");
    }

    pathRenderer.mBaseWidth = a.getDimension(R.styleable.VectorDrawable_android_width, pathRenderer.mBaseWidth);
    pathRenderer.mBaseHeight = a.getDimension(R.styleable.VectorDrawable_android_height,
            pathRenderer.mBaseHeight);

    if (pathRenderer.mBaseWidth <= 0) {
        throw new XmlPullParserException(a.getPositionDescription() + "<menu_vector> tag requires width > 0");
    } else if (pathRenderer.mBaseHeight <= 0) {
        throw new XmlPullParserException(a.getPositionDescription() + "<menu_vector> tag requires height > 0");
    }

    final float alphaInFloat = a.getFloat(R.styleable.VectorDrawable_android_alpha, pathRenderer.getAlpha());
    pathRenderer.setAlpha(alphaInFloat);

    final String name = a.getString(R.styleable.VectorDrawable_android_name);
    if (name != null) {
        pathRenderer.mRootName = name;
        pathRenderer.mVGTargetsMap.put(name, pathRenderer);
    }
}

From source file:net.zhuoweizhang.vectordrawable.VectorDrawable.java

private void updateStateFromTypedArray(TypedArray a) throws XmlPullParserException {
    final VectorDrawableState state = mVectorState;
    final VPathRenderer pathRenderer = state.mVPathRenderer;

    // Account for any configuration changes.
    //state.mChangingConfigurations |= a.getChangingConfigurations();

    // Extract the theme attributes, if any.
    state.mThemeAttrs = null;//a.extractThemeAttrs();

    final int tintMode = a.getInt(R.styleable.VectorDrawable_tintMode, -1);
    /*if (tintMode != -1) {
    state.mTintMode = Drawable.parseTintMode(tintMode, Mode.SRC_IN);
    }*//*from  ww w  .j  a  va  2 s .c  om*/

    /*final ColorStateList tint = a.getColorStateList(R.styleable.VectorDrawable_tint);
    if (tint != null) {
    state.mTint = tint;
    }*/

    state.mAutoMirrored = a.getBoolean(R.styleable.VectorDrawable_autoMirrored, state.mAutoMirrored);

    pathRenderer.mViewportWidth = a.getFloat(R.styleable.VectorDrawable_viewportWidth,
            pathRenderer.mViewportWidth);
    pathRenderer.mViewportHeight = a.getFloat(R.styleable.VectorDrawable_viewportHeight,
            pathRenderer.mViewportHeight);

    if (pathRenderer.mViewportWidth <= 0) {
        throw new XmlPullParserException(
                a.getPositionDescription() + "<vector> tag requires viewportWidth > 0");
    } else if (pathRenderer.mViewportHeight <= 0) {
        throw new XmlPullParserException(
                a.getPositionDescription() + "<vector> tag requires viewportHeight > 0");
    }

    pathRenderer.mBaseWidth = a.getDimension(R.styleable.VectorDrawable_android_width, pathRenderer.mBaseWidth);
    pathRenderer.mBaseHeight = a.getDimension(R.styleable.VectorDrawable_android_height,
            pathRenderer.mBaseHeight);

    if (pathRenderer.mBaseWidth <= 0) {
        throw new XmlPullParserException(a.getPositionDescription() + "<vector> tag requires width > 0");
    } else if (pathRenderer.mBaseHeight <= 0) {
        throw new XmlPullParserException(a.getPositionDescription() + "<vector> tag requires height > 0");
    }

    final float alphaInFloat = a.getFloat(R.styleable.VectorDrawable_android_alpha, pathRenderer.getAlpha());
    pathRenderer.setAlpha(alphaInFloat);

    final String name = a.getString(R.styleable.VectorDrawable_android_name);
    if (name != null) {
        pathRenderer.mRootName = name;
        pathRenderer.mVGTargetsMap.put(name, pathRenderer);
    }
}

From source file:com.bettervectordrawable.lib.graphics.drawable.VectorDrawable.java

private void updateStateFromTypedArray(TypedArray a) throws XmlPullParserException {
    final VectorDrawableState state = mVectorState;
    final VPathRenderer pathRenderer = state.mVPathRenderer;
    // Account for any configuration changes.
    state.mChangingConfigurations |= TypedArrayExtension.getChangingConfigurations(a);
    // Extract the theme attributes, if any.
    state.mThemeAttrs = extractThemeAttrs(a);
    final int tintMode = a.getInt(R.styleable.VectorDrawable_tintMode, -1);
    if (tintMode != -1) {
        state.mTintMode = parseTintMode(tintMode, Mode.SRC_IN);
    }/*from ww w .  j  a v  a  2  s.  c o m*/
    final ColorStateList tint = a.getColorStateList(R.styleable.VectorDrawable_tint);
    if (tint != null) {
        state.mTint = tint;
    }
    state.mAutoMirrored = a.getBoolean(R.styleable.VectorDrawable_autoMirrored, state.mAutoMirrored);
    pathRenderer.mViewportWidth = a.getFloat(R.styleable.VectorDrawable_viewportWidth,
            pathRenderer.mViewportWidth);
    pathRenderer.mViewportHeight = a.getFloat(R.styleable.VectorDrawable_viewportHeight,
            pathRenderer.mViewportHeight);
    if (pathRenderer.mViewportWidth <= 0) {
        throw new XmlPullParserException(
                a.getPositionDescription() + "<vector> tag requires viewportWidth > 0");
    } else if (pathRenderer.mViewportHeight <= 0) {
        throw new XmlPullParserException(
                a.getPositionDescription() + "<vector> tag requires viewportHeight > 0");
    }
    pathRenderer.mBaseWidth = a.getDimension(R.styleable.VectorDrawable_android_width, pathRenderer.mBaseWidth);
    pathRenderer.mBaseHeight = a.getDimension(R.styleable.VectorDrawable_android_height,
            pathRenderer.mBaseHeight);
    if (pathRenderer.mBaseWidth <= 0) {
        throw new XmlPullParserException(a.getPositionDescription() + "<vector> tag requires width > 0");
    } else if (pathRenderer.mBaseHeight <= 0) {
        throw new XmlPullParserException(a.getPositionDescription() + "<vector> tag requires height > 0");
    }
    final int insetLeft = a.getDimensionPixelSize(R.styleable.VectorDrawable_opticalInsetLeft,
            pathRenderer.mOpticalInsets.left);
    final int insetTop = a.getDimensionPixelSize(R.styleable.VectorDrawable_opticalInsetTop,
            pathRenderer.mOpticalInsets.top);
    final int insetRight = a.getDimensionPixelSize(R.styleable.VectorDrawable_opticalInsetRight,
            pathRenderer.mOpticalInsets.right);
    final int insetBottom = a.getDimensionPixelSize(R.styleable.VectorDrawable_opticalInsetBottom,
            pathRenderer.mOpticalInsets.bottom);
    pathRenderer.mOpticalInsets = Insets.of(insetLeft, insetTop, insetRight, insetBottom);
    final float alphaInFloat = a.getFloat(R.styleable.VectorDrawable_android_alpha, pathRenderer.getAlpha());
    pathRenderer.setAlpha(alphaInFloat);
    final String name = a.getString(R.styleable.VectorDrawable_android_name);
    if (name != null) {
        pathRenderer.mRootName = name;
        pathRenderer.mVGTargetsMap.put(name, pathRenderer);
    }
}

From source file:com.john.main.VectorDrawable.java

private void updateStateFromTypedArray(TypedArray a) throws XmlPullParserException {
    final VectorDrawableState state = mVectorState;
    final VPathRenderer pathRenderer = state.mVPathRenderer;

    // Account for any configuration changes.
    state.mChangingConfigurations |= Utils.getChangingConfigurations(a);

    // Extract the theme attributes, if any.
    state.mThemeAttrs = null; // TODO THEME TINT Not supported yet a.extractThemeAttrs();

    final int tintMode = a.getInt(R.styleable.VectorDrawable_tintMode, -1);
    if (tintMode != -1) {
        state.mTintMode = Utils.parseTintMode(tintMode, DEFAULT_TINT_MODE);
    }/*from w  w  w  .  j av  a2  s .c  o  m*/

    final ColorStateList tint = a.getColorStateList(R.styleable.VectorDrawable_tint);
    if (tint != null) {
        state.mTint = tint;
    }

    state.mAutoMirrored = a.getBoolean(R.styleable.VectorDrawable_autoMirrored, state.mAutoMirrored);

    pathRenderer.mViewportWidth = a.getFloat(R.styleable.VectorDrawable_viewportWidth,
            pathRenderer.mViewportWidth);
    pathRenderer.mViewportHeight = a.getFloat(R.styleable.VectorDrawable_viewportHeight,
            pathRenderer.mViewportHeight);

    if (pathRenderer.mViewportWidth <= 0) {
        throw new XmlPullParserException(
                a.getPositionDescription() + "<vector> tag requires viewportWidth > 0");
    } else if (pathRenderer.mViewportHeight <= 0) {
        throw new XmlPullParserException(
                a.getPositionDescription() + "<vector> tag requires viewportHeight > 0");
    }

    pathRenderer.mBaseWidth = a.getDimension(R.styleable.VectorDrawable_width, pathRenderer.mBaseWidth);
    pathRenderer.mBaseHeight = a.getDimension(R.styleable.VectorDrawable_height, pathRenderer.mBaseHeight);

    if (pathRenderer.mBaseWidth <= 0) {
        throw new XmlPullParserException(a.getPositionDescription() + "<vector> tag requires width > 0");
    } else if (pathRenderer.mBaseHeight <= 0) {
        throw new XmlPullParserException(a.getPositionDescription() + "<vector> tag requires height > 0");
    }

    final float alphaInFloat = a.getFloat(R.styleable.VectorDrawable_alpha, pathRenderer.getAlpha());
    pathRenderer.setAlpha(alphaInFloat);

    final String name = a.getString(R.styleable.VectorDrawable_name);
    if (name != null) {
        pathRenderer.mRootName = name;
        pathRenderer.mVGTargetsMap.put(name, pathRenderer);
    }
}