Java 类android.support.v7.widget.TintTypedArray 实例源码

项目:qmui    文件:QMUICollapsingTextHelper.java   
public void setCollapsedTextAppearance(int resId) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), resId, R.styleable.QMUITextAppearance);
    if (a.hasValue(R.styleable.QMUITextAppearance_android_textColor)) {
        mCollapsedTextColor = a.getColorStateList(R.styleable.QMUITextAppearance_android_textColor);
    }
    if (a.hasValue(R.styleable.QMUITextAppearance_android_textSize)) {
        mCollapsedTextSize = a.getDimensionPixelSize(R.styleable.QMUITextAppearance_android_textSize,
                (int) mCollapsedTextSize);
    }
    mCollapsedShadowColor = a.getInt(R.styleable.QMUITextAppearance_android_shadowColor, 0);
    mCollapsedShadowDx = a.getFloat(R.styleable.QMUITextAppearance_android_shadowDx, 0);
    mCollapsedShadowDy = a.getFloat(R.styleable.QMUITextAppearance_android_shadowDy, 0);
    mCollapsedShadowRadius = a.getFloat(R.styleable.QMUITextAppearance_android_shadowRadius, 0);
    a.recycle();

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

    recalculate();
}
项目:qmui    文件:QMUICollapsingTextHelper.java   
public void setExpandedTextAppearance(int resId) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), resId, R.styleable.QMUITextAppearance);
    if (a.hasValue(R.styleable.QMUITextAppearance_android_textColor)) {
        mExpandedTextColor = a.getColorStateList(R.styleable.QMUITextAppearance_android_textColor);
    }
    if (a.hasValue(R.styleable.QMUITextAppearance_android_textSize)) {
        mExpandedTextSize = a.getDimensionPixelSize(R.styleable.QMUITextAppearance_android_textSize,
                (int) mExpandedTextSize);
    }
    mExpandedShadowColor = a.getInt(
            R.styleable.QMUITextAppearance_android_shadowColor, 0);
    mExpandedShadowDx = a.getFloat(
            R.styleable.QMUITextAppearance_android_shadowDx, 0);
    mExpandedShadowDy = a.getFloat(
            R.styleable.QMUITextAppearance_android_shadowDy, 0);
    mExpandedShadowRadius = a.getFloat(
            R.styleable.QMUITextAppearance_android_shadowRadius, 0);
    a.recycle();

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

    recalculate();
}
项目:head    文件:HeadToolBar.java   
/**
 * 重新设置标题的样式
 *
 * @param context
 * @param attrs
 * @param defStyleAttr
 */
private void reSetTitleStyle(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {

    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs,
            R.styleable.Toolbar, defStyleAttr, 0);
    final int titleTextAppearance = a.getResourceId(R.styleable.Toolbar_titleTextAppearance, 0);
    if (titleTextAppearance != 0) {
        setTitleTextAppearance(context, titleTextAppearance);
    }
    if (mTitleTextColor != 0) {
        setTitleTextColor(mTitleTextColor);
    }
    a.recycle();
    post(new Runnable() {
        @Override
        public void run() {
            if (getLayoutParams() instanceof LayoutParams) {
                ((LayoutParams) getLayoutParams()).gravity = Gravity.CENTER;
            }
        }
    });
}
项目:head    文件:HeadToolBar.java   
/**
 * 重新设置标题的样式
 *
 * @param context
 * @param attrs
 * @param defStyleAttr
 */
private void reSetSubTitleStyle(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {

    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs,
            R.styleable.Toolbar, defStyleAttr, 0);
    final int titleTextAppearance = a.getResourceId(R.styleable.Toolbar_subtitleTextAppearance, 0);
    if (titleTextAppearance != 0) {
        setSubtitleTextAppearance(context, titleTextAppearance);
    }
    if (mSubtitleTextColor != 0) {
        setTitleTextColor(mSubtitleTextColor);
    }
    a.recycle();
    post(new Runnable() {
        @Override
        public void run() {
            if (getLayoutParams() instanceof LayoutParams) {
                ((LayoutParams) getLayoutParams()).gravity = Gravity.CENTER;
            }
        }
    });

}
项目:QMUI_Android    文件:QMUICollapsingTextHelper.java   
public void setCollapsedTextAppearance(int resId) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), resId, R.styleable.QMUITextAppearance);
    if (a.hasValue(R.styleable.QMUITextAppearance_android_textColor)) {
        mCollapsedTextColor = a.getColorStateList(R.styleable.QMUITextAppearance_android_textColor);
    }
    if (a.hasValue(R.styleable.QMUITextAppearance_android_textSize)) {
        mCollapsedTextSize = a.getDimensionPixelSize(R.styleable.QMUITextAppearance_android_textSize,
                (int) mCollapsedTextSize);
    }
    mCollapsedShadowColor = a.getInt(R.styleable.QMUITextAppearance_android_shadowColor, 0);
    mCollapsedShadowDx = a.getFloat(R.styleable.QMUITextAppearance_android_shadowDx, 0);
    mCollapsedShadowDy = a.getFloat(R.styleable.QMUITextAppearance_android_shadowDy, 0);
    mCollapsedShadowRadius = a.getFloat(R.styleable.QMUITextAppearance_android_shadowRadius, 0);
    a.recycle();

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

    recalculate();
}
项目:QMUI_Android    文件:QMUICollapsingTextHelper.java   
public void setExpandedTextAppearance(int resId) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), resId, R.styleable.QMUITextAppearance);
    if (a.hasValue(R.styleable.QMUITextAppearance_android_textColor)) {
        mExpandedTextColor = a.getColorStateList(R.styleable.QMUITextAppearance_android_textColor);
    }
    if (a.hasValue(R.styleable.QMUITextAppearance_android_textSize)) {
        mExpandedTextSize = a.getDimensionPixelSize(R.styleable.QMUITextAppearance_android_textSize,
                (int) mExpandedTextSize);
    }
    mExpandedShadowColor = a.getInt(
            R.styleable.QMUITextAppearance_android_shadowColor, 0);
    mExpandedShadowDx = a.getFloat(
            R.styleable.QMUITextAppearance_android_shadowDx, 0);
    mExpandedShadowDy = a.getFloat(
            R.styleable.QMUITextAppearance_android_shadowDy, 0);
    mExpandedShadowRadius = a.getFloat(
            R.styleable.QMUITextAppearance_android_shadowRadius, 0);
    a.recycle();

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

    recalculate();
}
项目:Mobike    文件:MyToolBar.java   
public MyToolBar(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    initview();
    if (attrs != null) {

        final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
                R.styleable.MyToolBar, defStyleAttr, 0);
        showSearchView = a.getBoolean(R.styleable.MyToolBar_showSearchView, false);
        left_button_icon = a.getDrawable(R.styleable.MyToolBar_leftButtonIcon);
        right_button_icon = a.getDrawable(R.styleable.MyToolBar_rightButtonIcon);
        title = a.getString(R.styleable.MyToolBar_myTitle);
        a.recycle();
    }

    isShouw();

    setContentInsetsRelative(10, 10);

    initListener();

}
项目:training-epam-2016    文件:IcButton.java   
private void init(final AttributeSet attrs, final int defStyleAttr) {
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
            R.styleable.IcButtonStyle, defStyleAttr, 0);
    try {
        final AppCompatDrawableManager drawableManager = AppCompatDrawableManager.get();
        Drawable rightIcon = a.getDrawableIfKnown(R.styleable.IcButtonStyle_rightIcon);

        int id = a.getResourceId(R.styleable.IcButtonStyle_rightIcon, -1);
        if (id != -1) {
            rightIcon = drawableManager.getDrawable(getContext(), id);
        }
        Drawable topIcon = a.getDrawableIfKnown(R.styleable.IcButtonStyle_topIcon);
        id = a.getResourceId(R.styleable.IcButtonStyle_topIcon, -1);
        if (id != -1) {
            topIcon = drawableManager.getDrawable(getContext(), id);
        }

        setCompoundDrawablesWithIntrinsicBounds(null, topIcon, rightIcon, null);
    } finally {
        a.recycle();
    }
}
项目:react-native-navigation    文件:CollapsingTextView.java   
@SuppressLint("PrivateResource")
private void createDummyTextView(Context context) {
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), null,
            R.styleable.Toolbar, R.attr.toolbarStyle, 0);
    int titleTextAppearance =
            a.getResourceId(R.styleable.Toolbar_titleTextAppearance, 0);
    a.recycle();

    dummy = new TextView(context);
    dummy.setSingleLine();
    dummy.setEllipsize(TextUtils.TruncateAt.END);
    TextViewCompat.setTextAppearance(dummy, titleTextAppearance);
    collapsedTextSize = dummy.getTextSize();
    expendedTextSize = collapsedTextSize * TEXT_SCALE_FACTOR;
    dummy.setTextSize(ViewUtils.convertPixelToSp(expendedTextSize));
    dummy.setVisibility(INVISIBLE);
    addView(dummy, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
项目:BufferTextInputLayout    文件:CollapsingTextHelper.java   
public void setCollapsedTextAppearance(int resId) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), resId,
            android.support.v7.appcompat.R.styleable.TextAppearance);
    if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
        mCollapsedTextColor = a.getColorStateList(
                android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
    }
    if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
        mCollapsedTextSize = a.getDimensionPixelSize(
                android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,
                (int) mCollapsedTextSize);
    }
    mCollapsedShadowColor = a.getInt(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor, 0);
    mCollapsedShadowDx = a.getFloat(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx, 0);
    mCollapsedShadowDy = a.getFloat(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy, 0);
    mCollapsedShadowRadius = a.getFloat(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius, 0);
    a.recycle();
    if (Build.VERSION.SDK_INT >= 16) {
        mCollapsedTypeface = readFontFamilyTypeface(resId);
    }
    recalculate();
}
项目:BufferTextInputLayout    文件:CollapsingTextHelper.java   
public void setExpandedTextAppearance(int resId) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), resId,
            android.support.v7.appcompat.R.styleable.TextAppearance);
    if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
        mExpandedTextColor = a.getColorStateList(
                android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
    }
    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();
}
项目:AndroidBase    文件:AppCompatTextViewHelper.java   
public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), attrs,
            com.ljz.base.widget.R.styleable.SelectorInjection, defStyleAttr, 0);

    Drawable[] drawables = mView.getCompoundDrawables();
    try {
        int leftColor = a.getColor(com.ljz.base.widget.R.styleable.SelectorInjection_drawableLeftTint, DEFAULT_COLOR);
        int topColor = a.getColor(com.ljz.base.widget.R.styleable.SelectorInjection_drawableTopTint, DEFAULT_COLOR);
        int rightColor = a.getColor(com.ljz.base.widget.R.styleable.SelectorInjection_drawableRightTint, DEFAULT_COLOR);
        int bottomColor = a.getColor(com.ljz.base.widget.R.styleable.SelectorInjection_drawableBottomTint, DEFAULT_COLOR);

        int[] colors = {leftColor, topColor, rightColor, bottomColor};
        tintDrawable(drawables, colors);
    } finally {
        a.recycle();
    }
}
项目:QingNianTuZhai    文件:ColorToolBar.java   
public ColorToolBar(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
    int attributeCount = attrs.getAttributeCount();
    for (int i = 0; i < attributeCount; i++) {
        String attributeName = attrs.getAttributeName(i);
        Log.i(TAG, "ColorToolBar: "+attributeName);
    }
        Log.i(TAG, "ColorToolBar: -----------------------------------------------------------");
    TypedValue tv = new TypedValue();

    final TintTypedArray typedArray = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
            android.support.v7.appcompat.R.styleable.Toolbar, 0, 0);
    int indexCount = typedArray.getIndexCount();
    int resourceId = typedArray.getResourceId(android.support.v7.appcompat.R.styleable.Toolbar_popupTheme, -1);
        Log.i(TAG, "ColorToolBar: "+(resourceId > 0 ? "获取到资源id :"+ resourceId : "未获取到资源id"));
    for (int i = 0; i < indexCount; i++) {
        typedArray.getValue(i,tv);
        Log.i(TAG, "ColorToolBar: "+tv.toString());
    }

}
项目:BitkyShop    文件:KyToolBar.java   
public KyToolBar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);

  initView();
  final TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(getContext(), attrs, R.styleable.KyToolbar,
          defStyleAttr, 0);
  final boolean enableKyNavigationIcon =
      a.getBoolean(R.styleable.KyToolbar_enableKyNavigationIcon, true);
  final boolean enableKySearch = a.getBoolean(R.styleable.KyToolbar_enableKySearch, false);
  final Drawable navIcon = a.getDrawable(R.styleable.KyToolbar_KyNavigationIcon);
  final Drawable rightButtonIcon = a.getDrawable(R.styleable.KyToolbar_setRightButton);
  final String rightText = a.getString(R.styleable.KyToolbar_setRightText);

  setNavigationIcon(navIcon);
  setRightButtonIcon(rightButtonIcon);
  enableKyNavigation(enableKyNavigationIcon);
  setRightTextView(rightText);
  setEnabledSearch(enableKySearch);
  a.recycle();
}
项目:cniao5    文件:CNiaoToolBar.java   
public CNiaoToolBar(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    initView();
    setContentInsetsRelative(10,10);

    if(attrs !=null) {
        final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
                R.styleable.CNiaoToolBar, defStyleAttr, 0);

        final Drawable rightIcon = a.getDrawable(R.styleable.CNiaoToolBar_rightButtonIcon);
        if (rightIcon != null) {
            setRightButtonIcon(rightIcon);
        }


        boolean isShowSearchView = a.getBoolean(R.styleable.CNiaoToolBar_isShowSearchView,false);

        if(isShowSearchView){
            showSearchView();
            hideTitleView();
        }

        CharSequence rightButtonText = a.getText(R.styleable.CNiaoToolBar_rightButtonText);
        if(rightButtonText !=null){
            setRightButtonText(rightButtonText);
        }

        a.recycle();
    }

}
项目:AndroidSkinAnimator    文件:SkinCompatProgressBarHelper.java   
void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), attrs,
            TINT_ATTRS, defStyleAttr, 0);

    mIndeterminateDrawableResId = a.getResourceId(0, INVALID_ID);
    mProgressDrawableResId = a.getResourceId(1, INVALID_ID);

    a.recycle();
    applySkin();
}
项目:AndroidSkinAnimator    文件:SkinCompatBackgroundHelper.java   
public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), attrs,
            R.styleable.SkinBackgroundHelper, defStyleAttr, 0);
    try {
        if (a.hasValue(R.styleable.SkinBackgroundHelper_android_background)) {
            mBackgroundResId = a.getResourceId(
                    R.styleable.SkinBackgroundHelper_android_background, INVALID_ID);
        }
    } finally {
        a.recycle();
    }
    applySkin();
}
项目:AndroidSkinAnimator    文件:SkinCompatAutoCompleteTextView.java   
public SkinCompatAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
            TINT_ATTRS, defStyleAttr, 0);
    if (a.hasValue(0)) {
        mDropDownBackgroundResId = a.getResourceId(0, INVALID_ID);
    }
    a.recycle();
    applyDropDownBackgroundResource();
    mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
    mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
    mTextHelper = new SkinCompatTextHelper(this);
    mTextHelper.loadFromAttributes(attrs, defStyleAttr);
}
项目:AndroidSkinAnimator    文件:SkinCompatMultiAutoCompleteTextView.java   
public SkinCompatMultiAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
            TINT_ATTRS, defStyleAttr, 0);
    if (a.hasValue(0)) {
        mDropDownBackgroundResId = a.getResourceId(0, INVALID_ID);
    }
    a.recycle();
    applyDropDownBackgroundResource();
    mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
    mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
    mTextHelper = new SkinCompatTextHelper(this);
    mTextHelper.loadFromAttributes(attrs, defStyleAttr);
}
项目:AndroidSkinAnimator    文件:SkinCompatTextHelper.java   
public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
    final Context context = mView.getContext();

    // First read the TextAppearance style id
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs,
            R.styleable.SkinCompatTextHelper, defStyleAttr, 0);
    final int ap = a.getResourceId(R.styleable.SkinCompatTextHelper_android_textAppearance, INVALID_ID);
    SkinLog.d(TAG, "ap = " + ap);
    a.recycle();

    if (ap != INVALID_ID) {
        a = TintTypedArray.obtainStyledAttributes(context, ap, R.styleable.SkinTextAppearance);
        if (a.hasValue(R.styleable.SkinTextAppearance_android_textColor)) {
            mTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor, INVALID_ID);
            SkinLog.d(TAG, "mTextColorResId = " + mTextColorResId);
        }
        if (a.hasValue(R.styleable.SkinTextAppearance_android_textColorHint)) {
            mTextColorHintResId = a.getResourceId(
                    R.styleable.SkinTextAppearance_android_textColorHint, INVALID_ID);
            SkinLog.d(TAG, "mTextColorHintResId = " + mTextColorHintResId);
        }
        a.recycle();
    }

    // Now read the style's values
    a = TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.SkinTextAppearance,
            defStyleAttr, 0);
    if (a.hasValue(R.styleable.SkinTextAppearance_android_textColor)) {
        mTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor, INVALID_ID);
        SkinLog.d(TAG, "mTextColorResId = " + mTextColorResId);
    }
    if (a.hasValue(R.styleable.SkinTextAppearance_android_textColorHint)) {
        mTextColorHintResId = a.getResourceId(
                R.styleable.SkinTextAppearance_android_textColorHint, INVALID_ID);
        SkinLog.d(TAG, "mTextColorHintResId = " + mTextColorHintResId);
    }
    a.recycle();
    applySkin();
}
项目:AndroidSkinAnimator    文件:SkinCompatTextHelper.java   
public void onSetTextAppearance(Context context, int resId) {
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context,
            resId, R.styleable.SkinTextAppearance);
    if (a.hasValue(R.styleable.SkinTextAppearance_android_textColor)) {
        mTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor, INVALID_ID);
        SkinLog.d(TAG, "mTextColorResId = " + mTextColorResId);
    }
    if (a.hasValue(R.styleable.SkinTextAppearance_android_textColorHint)) {
        mTextColorHintResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColorHint, INVALID_ID);
        SkinLog.d(TAG, "mTextColorHintResId = " + mTextColorHintResId);
    }
    a.recycle();
    applySkin();
}
项目:AndroidSkinAnimator    文件:SkinCompatSeekBarHelper.java   
@Override
    void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
        super.loadFromAttributes(attrs, defStyleAttr);

        TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), attrs,
                R.styleable.AppCompatSeekBar, defStyleAttr, 0);
        mThumbResId = a.getResourceId(R.styleable.AppCompatSeekBar_android_thumb, INVALID_ID);
//        final Drawable drawable = a.getDrawableIfKnown(R.styleable.AppCompatSeekBar_android_thumb);
//        if (drawable != null) {
//            mView.setThumb(drawable);
//        }

//        mTickMarkResId = a.getResourceId(R.styleable.AppCompatSeekBar_tickMark, INVALID_ID);
//        final Drawable tickMark = a.getDrawable(R.styleable.AppCompatSeekBar_tickMark);
//        setTickMark(tickMark);

//        if (a.hasValue(R.styleable.AppCompatSeekBar_tickMarkTintMode)) {
//            mTickMarkTintMode = DrawableUtils.parseTintMode(a.getInt(
//                    R.styleable.AppCompatSeekBar_tickMarkTintMode, -1), mTickMarkTintMode);
//            mHasTickMarkTintMode = true;
//        }

//        if (a.hasValue(R.styleable.AppCompatSeekBar_tickMarkTint)) {
//            mTickMarkTintList = a.getColorStateList(R.styleable.AppCompatSeekBar_tickMarkTint);
//            mHasTickMarkTint = true;
//        }

        a.recycle();

//        applyTickMarkTint();
        applySkin();
    }
项目:AndroidSkinAnimator    文件:SkinCompatToolbar.java   
public SkinCompatToolbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
    mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);

    TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
            R.styleable.Toolbar, defStyleAttr, 0);
    mNavigationIconResId = a.getResourceId(R.styleable.Toolbar_navigationIcon, INVALID_ID);

    int titleAp = a.getResourceId(R.styleable.Toolbar_titleTextAppearance, INVALID_ID);
    int subtitleAp = a.getResourceId(R.styleable.Toolbar_subtitleTextAppearance, INVALID_ID);
    a.recycle();
    if (titleAp != INVALID_ID) {
        a = TintTypedArray.obtainStyledAttributes(context, titleAp, R.styleable.SkinTextAppearance);
        mTitleTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor, INVALID_ID);
        a.recycle();
    }
    if (subtitleAp != INVALID_ID) {
        a = TintTypedArray.obtainStyledAttributes(context, subtitleAp, R.styleable.SkinTextAppearance);
        mSubtitleTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor, INVALID_ID);
        a.recycle();
    }
    a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
            R.styleable.Toolbar, defStyleAttr, 0);
    if (a.hasValue(R.styleable.Toolbar_titleTextColor)) {
        mTitleTextColorResId = a.getResourceId(R.styleable.Toolbar_titleTextColor, INVALID_ID);
    }
    if (a.hasValue(R.styleable.Toolbar_subtitleTextColor)) {
        mSubtitleTextColorResId = a.getResourceId(R.styleable.Toolbar_subtitleTextColor, INVALID_ID);
    }
    a.recycle();
    applyTitleTextColor();
    applySubtitleTextColor();
    applyNavigationIcon();
}
项目:AndroidSkinAnimator    文件:SkinCompatCheckedTextView.java   
public SkinCompatCheckedTextView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
    mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
    mTextHelper = new SkinCompatTextHelper(this);
    mTextHelper.loadFromAttributes(attrs, defStyleAttr);

    TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
            TINT_ATTRS, defStyleAttr, 0);
    mCheckMarkResId = a.getResourceId(0, INVALID_ID);
    a.recycle();
    applyCheckMark();
}
项目:AndroidSkinAnimator    文件:SkinCompatImageHelper.java   
public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
    TintTypedArray a = null;
    try {
        a = TintTypedArray.obtainStyledAttributes(mView.getContext(), attrs,
                R.styleable.SkinCompatImageView, defStyleAttr, 0);

        mSrcResId = a.getResourceId(R.styleable.SkinCompatImageView_android_src, -1);
    } finally {
        if (a != null) {
            a.recycle();
        }
    }
    applySkin();
}
项目:Nird2    文件:PreferenceDividerDecoration.java   
public PreferenceDividerDecoration(Context context) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, null,
            new int[] {R.attr.dividerHorizontal});
    mDivider = a.getDrawable(0);
    a.recycle();

    mDividerHeight = mDivider.getIntrinsicHeight();
}
项目:Nird2    文件:PreferenceDividerDecoration.java   
public PreferenceDividerDecoration(Context context) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, null,
            new int[] {R.attr.dividerHorizontal});
    mDivider = a.getDrawable(0);
    a.recycle();

    mDividerHeight = mDivider.getIntrinsicHeight();
}
项目:IslamicLibraryAndroid    文件:Util.java   
public static ColorStateList resolveColorStateList(Context context, @AttrRes int attr) {
    TEMP_ARRAY[0] = attr;
    TintTypedArray ta = TintTypedArray.obtainStyledAttributes(context, null, TEMP_ARRAY);
    try {
        return ta.getColorStateList(0);
    } finally {
        ta.recycle();
    }
}
项目:TitleBar    文件:TitleBar.java   
/**
 * 读取ToolBar的默认标题属性
 *
 * @param attrs        AttributeSet
 * @param defStyleAttr defStyleAttr
 */
private void resolveAttrs(AttributeSet attrs, int defStyleAttr) {
    // Need to use getContext() here so that we use the themed context
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
            R.styleable.Toolbar, defStyleAttr, 0);
    mCenterTitleTextAppearance = a.getResourceId(R.styleable.Toolbar_titleTextAppearance, 0);
    mCenterTitleTextColor = a.getColor(R.styleable.Toolbar_titleTextColor, 0xffffffff);
    a.recycle();
}
项目:boohee_v5.6    文件:ExpandedMenuView.java   
public ExpandedMenuView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs);
    setOnItemClickListener(this);
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs, TINT_ATTRS, defStyleAttr, 0);
    if (a.hasValue(0)) {
        setBackgroundDrawable(a.getDrawable(0));
    }
    if (a.hasValue(1)) {
        setDivider(a.getDrawable(1));
    }
    a.recycle();
}
项目:boohee_v5.6    文件:TabItem.java   
public TabItem(Context context, AttributeSet attrs) {
    super(context, attrs);
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.TabItem);
    this.mText = a.getText(R.styleable.TabItem_android_text);
    this.mIcon = a.getDrawable(R.styleable.TabItem_android_icon);
    this.mCustomLayout = a.getResourceId(R.styleable.TabItem_android_layout, 0);
    a.recycle();
}
项目:BizareChat    文件:UserInfoFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_user_info, container, false);
    arguments = getArguments();
    email = arguments.getString(EMAIL_BUNDLE_KEY);
    phone = arguments.getString(PHONE_BUNDLE_KEY);
    website = arguments.getString(WEBSITE_BUNDLE_KEY);
    fullName = arguments.getString(FULL_NAME_BUNDLE_KEY);
    presenter.setUserId(arguments.getLong(ID_BUNDLE_KEY));

    Toolbar toolbar = (Toolbar) view.findViewById(R.id.user_toolbar);
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(toolbar.getContext(),
            null, android.support.v7.appcompat.R.styleable.ActionBar, android.support.v7.appcompat.R.attr.actionBarStyle, 0);
    toolbar.setNavigationIcon(a.getDrawable(android.support.v7.appcompat.R.styleable.ActionBar_homeAsUpIndicator));
    toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed());

    toolbarLayout = (CollapsingToolbarLayout) view.findViewById(R.id.user_collapsing_toolbar_layout);
    emailTextView = (TextView) view.findViewById(R.id.user_info_email_value);
    phoneTextView = (TextView) view.findViewById(R.id.user_info_phone_value);
    websiteTextView = (TextView) view.findViewById(R.id.user_info_website_value);
    userInfoFab = (FloatingActionButton) view.findViewById(R.id.user_info_fab);
    toolbarLayout.setTitleEnabled(true);
    toolbarLayout.setTitle(fullName);

    view.findViewById(R.id.user_info_email_layout).setOnClickListener(this);
    view.findViewById(R.id.user_info_phone_layout).setOnClickListener(this);
    view.findViewById(R.id.user_info_website_layout).setOnClickListener(this);
    userInfoFab.setOnClickListener(this);

    if (presenter.isCurrentUser()) {
        userInfoFab.setVisibility(View.GONE);
    }

    packageManager = getActivity().getPackageManager();

    return view;
}
项目:material-components-android    文件:TabItem.java   
public TabItem(Context context, AttributeSet attrs) {
  super(context, attrs);

  final TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.TabItem);
  text = a.getText(R.styleable.TabItem_android_text);
  icon = a.getDrawable(R.styleable.TabItem_android_icon);
  customLayout = a.getResourceId(R.styleable.TabItem_android_layout, 0);
  a.recycle();
}
项目:material-components-android    文件:CollapsingTextHelper.java   
void setCollapsedTextAppearance(int resId) {
  TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(
          view.getContext(), resId, android.support.v7.appcompat.R.styleable.TextAppearance);
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
    collapsedTextColor =
        a.getColorStateList(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
  }
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
    collapsedTextSize =
        a.getDimensionPixelSize(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,
            (int) collapsedTextSize);
  }
  collapsedShadowColor =
      a.getInt(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor, 0);
  collapsedShadowDx =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx, 0);
  collapsedShadowDy =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy, 0);
  collapsedShadowRadius =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius, 0);
  a.recycle();

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

  recalculate();
}
项目:material-components-android    文件:CollapsingTextHelper.java   
void setExpandedTextAppearance(int resId) {
  TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(
          view.getContext(), resId, android.support.v7.appcompat.R.styleable.TextAppearance);
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
    expandedTextColor =
        a.getColorStateList(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
  }
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
    expandedTextSize =
        a.getDimensionPixelSize(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,
            (int) expandedTextSize);
  }
  expandedShadowColor =
      a.getInt(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor, 0);
  expandedShadowDx =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx, 0);
  expandedShadowDy =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy, 0);
  expandedShadowRadius =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius, 0);
  a.recycle();

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

  recalculate();
}
项目:QingNianTuZhai    文件:ColorToolBar.java   
public ColorToolBar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
            android.support.v7.appcompat.R.styleable.Toolbar, R.style.ToolBarLightStyle, 0);
    int indexCount = a.getIndexCount();
    TypedValue typeValue = new TypedValue();
    for (int i = 0; i < indexCount; i++) {
        a.getValue(i,typeValue);
        Log.i(TAG, "ColorToolBar: "+typeValue.toString());
    }
    this.attr_background = ViewAttributeUtil.getBackgroundAttibute(attrs);
}
项目:iosched    文件:TabItem.java   
public TabItem(Context context, AttributeSet attrs) {
  super(context, attrs);

  final TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.TabItem);
  mText = a.getText(R.styleable.TabItem_android_text);
  mIcon = a.getDrawable(R.styleable.TabItem_android_icon);
  mCustomLayout = a.getResourceId(R.styleable.TabItem_android_layout, 0);
  a.recycle();
}
项目:iosched    文件:CollapsingTextHelper.java   
void setCollapsedTextAppearance(int resId) {
  TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(
          mView.getContext(), resId, android.support.v7.appcompat.R.styleable.TextAppearance);
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
    mCollapsedTextColor =
        a.getColorStateList(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
  }
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
    mCollapsedTextSize =
        a.getDimensionPixelSize(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,
            (int) mCollapsedTextSize);
  }
  mCollapsedShadowColor =
      a.getInt(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor, 0);
  mCollapsedShadowDx =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx, 0);
  mCollapsedShadowDy =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy, 0);
  mCollapsedShadowRadius =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius, 0);
  a.recycle();

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

  recalculate();
}
项目:iosched    文件:CollapsingTextHelper.java   
void setExpandedTextAppearance(int resId) {
  TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(
          mView.getContext(), resId, android.support.v7.appcompat.R.styleable.TextAppearance);
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
    mExpandedTextColor =
        a.getColorStateList(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
  }
  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();
}
项目:EhViewer    文件:CuteSpinner.java   
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs,
            android.support.v7.appcompat.R.styleable.Spinner, defStyleAttr, 0);
    final CharSequence[] entries = a.getTextArray(R.styleable.Spinner_android_entries);
    if (entries != null) {
        final ArrayAdapter<CharSequence> adapter = new ArrayAdapter<>(context,
                R.layout.item_cute_spinner_item, entries);
        adapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
        setAdapter(adapter);
    }
    a.recycle();
}