Search in sources :

Example 1 with TintTypedArray

use of android.support.v7.widget.TintTypedArray in project Android-skin-support by ximsfei.

the class SkinMaterialTextInputLayout method loadErrorTextColorResFromAttributes.

private void loadErrorTextColorResFromAttributes(@StyleRes int resId) {
    if (resId != INVALID_ID) {
        TintTypedArray errorTA = TintTypedArray.obtainStyledAttributes(getContext(), resId, skin.support.R.styleable.SkinTextAppearance);
        if (errorTA.hasValue(skin.support.R.styleable.SkinTextAppearance_android_textColor)) {
            mErrorTextColorResId = errorTA.getResourceId(skin.support.R.styleable.SkinTextAppearance_android_textColor, INVALID_ID);
            SkinLog.d(TAG, "mErrorTextColorResId = " + SkinCompatHelper.checkResourceId(mErrorTextColorResId));
        }
        errorTA.recycle();
    }
    applyErrorTextColorResource();
}
Also used : TintTypedArray(android.support.v7.widget.TintTypedArray)

Example 2 with TintTypedArray

use of android.support.v7.widget.TintTypedArray in project Android-skin-support by ximsfei.

the class SkinCompatSeekBarHelper method loadFromAttributes.

@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();
}
Also used : TintTypedArray(android.support.v7.widget.TintTypedArray)

Example 3 with TintTypedArray

use of android.support.v7.widget.TintTypedArray in project Android-skin-support by ximsfei.

the class SkinCompatTextHelper method loadFromAttributes.

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);
    if (a.hasValue(R.styleable.AppCompatTextHelper_android_drawableLeft)) {
        mDrawableLeftResId = a.getResourceId(R.styleable.AppCompatTextHelper_android_drawableLeft, INVALID_ID);
    }
    if (a.hasValue(R.styleable.AppCompatTextHelper_android_drawableTop)) {
        mDrawableTopResId = a.getResourceId(R.styleable.AppCompatTextHelper_android_drawableTop, INVALID_ID);
    }
    if (a.hasValue(R.styleable.AppCompatTextHelper_android_drawableRight)) {
        mDrawableRightResId = a.getResourceId(R.styleable.AppCompatTextHelper_android_drawableRight, INVALID_ID);
    }
    if (a.hasValue(R.styleable.AppCompatTextHelper_android_drawableBottom)) {
        mDrawableBottomResId = a.getResourceId(R.styleable.AppCompatTextHelper_android_drawableBottom, INVALID_ID);
    }
    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();
}
Also used : Context(android.content.Context) TintTypedArray(android.support.v7.widget.TintTypedArray)

Example 4 with TintTypedArray

use of android.support.v7.widget.TintTypedArray in project Android-skin-support by ximsfei.

the class SkinCompatTextHelper method onSetTextAppearance.

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();
    applyTextColorResource();
    applyTextColorHintResource();
}
Also used : TintTypedArray(android.support.v7.widget.TintTypedArray)

Example 5 with TintTypedArray

use of android.support.v7.widget.TintTypedArray in project Douya by DreaminginCodeZH.

the class MaxDimensionHelper method onInit.

public void onInit(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs, STYLEABLE, defStyleAttr, defStyleRes);
    mMaxWidth = a.getDimensionPixelSize(STYLEABLE_ANDROID_MAX_WIDTH, -1);
    mMaxHeight = a.getDimensionPixelSize(STYLEABLE_ANDROID_MAX_HEIGHT, -1);
    a.recycle();
}
Also used : TintTypedArray(android.support.v7.widget.TintTypedArray)

Aggregations

TintTypedArray (android.support.v7.widget.TintTypedArray)22 Context (android.content.Context)3 SuppressLint (android.annotation.SuppressLint)2 Paint (android.graphics.Paint)2 Drawable (android.graphics.drawable.Drawable)2 TextPaint (android.text.TextPaint)2 ColorStateList (android.content.res.ColorStateList)1 AllCapsTransformationMethod (android.support.v7.text.AllCapsTransformationMethod)1 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1