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));
}
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);
}
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();
}
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();
}
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();
}
Aggregations