Search in sources :

Example 16 with TintTypedArray

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

the class FriendlySwipeRefreshLayout method init.

private void init(AttributeSet attrs) {
    updateCircleDiameter();
    Context context = getContext();
    mDefaultCircleDistance = ViewUtils.dpToPxOffset(DEFAULT_CIRCLE_DISTANCE_DP, context);
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs, R.styleable.FriendlySwipeRefreshLayout, 0, 0);
    int progressOffset = a.getDimensionPixelOffset(R.styleable.FriendlySwipeRefreshLayout_progressOffset, 0);
    int progressDistanceOffset = a.getDimensionPixelOffset(R.styleable.FriendlySwipeRefreshLayout_progressDistanceOffset, 0);
    a.recycle();
    if (progressOffset != 0 || progressDistanceOffset != 0) {
        setProgressViewOffset(progressOffset, progressDistanceOffset);
    }
    setColorSchemeColors(ViewUtils.getColorFromAttrRes(R.attr.colorPrimary, Color.BLACK, context));
}
Also used : Context(android.content.Context) TintTypedArray(android.support.v7.widget.TintTypedArray)

Example 17 with TintTypedArray

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

the class InsetBackgroundFrameLayout method init.

private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs, R.styleable.InsetBackgroundFrameLayout, defStyleAttr, defStyleRes);
    mInsetBackground = a.getDrawable(R.styleable.InsetBackgroundFrameLayout_insetBackground);
    a.recycle();
    // Will not draw until insets are set.
    setWillNotDraw(true);
}
Also used : TintTypedArray(android.support.v7.widget.TintTypedArray)

Example 18 with TintTypedArray

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

the class ForegroundHelper method init.

public void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    // TODO: Check for FrameLayout
    mHasFrameworkBackground = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.M;
    if (mHasFrameworkBackground) {
        return;
    }
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs, STYLEABLE, defStyleAttr, defStyleRes);
    mForegroundGravity = a.getInt(STYLEABLE_ANDROID_FOREGROUND_GRAVITY, mForegroundGravity);
    Drawable foreground = a.getDrawable(STYLEABLE_ANDROID_FOREGROUND);
    if (foreground != null) {
        setForeground(foreground);
    }
    mForegroundInPadding = a.getBoolean(STYLEABLE_ANDROID_FOREGROUND_INSIDE_PADDING, true);
    a.recycle();
}
Also used : TintTypedArray(android.support.v7.widget.TintTypedArray) Drawable(android.graphics.drawable.Drawable)

Example 19 with TintTypedArray

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

the class RatioHeightRecyclerView method init.

private void init(AttributeSet attrs, int defStyle) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs, R.styleable.RatioHeightRecyclerView, defStyle, 0);
    String ratio = a.getString(R.styleable.RatioHeightRecyclerView_ratio);
    if (ratio != null) {
        int colonIndex = ratio.indexOf(':');
        if (colonIndex < 0) {
            throw new IllegalArgumentException("ratio should be a string in the form \"width:height\": " + ratio);
        }
        int width = Integer.parseInt(ratio.substring(0, colonIndex));
        int height = Integer.parseInt(ratio.substring(colonIndex + 1));
        mRatio = (float) width / height;
    }
    a.recycle();
}
Also used : TintTypedArray(android.support.v7.widget.TintTypedArray)

Example 20 with TintTypedArray

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

the class TintStateListImageView method init.

private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs, R.styleable.TintStateListImageView, defStyleAttr, defStyleRes);
    mTintList = a.getColorStateList(R.styleable.TintStateListImageView_tint);
    updateTintColorFilter();
    a.recycle();
}
Also used : TintTypedArray(android.support.v7.widget.TintTypedArray)

Aggregations

TintTypedArray (android.support.v7.widget.TintTypedArray)24 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 Point (com.reactnativenavigation.views.utils.Point)1