use of android.support.v7.widget.TintTypedArray in project Douya by DreaminginCodeZH.
the class ContentStateLayout method init.
private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs, R.styleable.ContentStateLayout, defStyleAttr, defStyleRes);
mLoadingViewId = a.getResourceId(R.styleable.ContentStateLayout_loadingView, R.id.loading);
mContentViewId = a.getResourceId(R.styleable.ContentStateLayout_contentView, R.id.content);
mEmptyViewId = a.getResourceId(R.styleable.ContentStateLayout_emptyView, R.id.empty);
mErrorViewId = a.getResourceId(R.styleable.ContentStateLayout_errorView, R.id.error);
mAnimationEnabled = a.getBoolean(R.styleable.ContentStateLayout_animationEnabled, true);
a.recycle();
}
use of android.support.v7.widget.TintTypedArray in project Douya by DreaminginCodeZH.
the class CardIconButton method init.
private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
setClickable(true);
setFocusable(true);
setGravity(Gravity.CENTER_VERTICAL);
setOrientation(HORIZONTAL);
ViewUtils.inflateInto(R.layout.card_icon_button, this);
ButterKnife.bind(this);
TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs, R.styleable.CardIconButton, defStyleAttr, defStyleRes);
Drawable src = a.getDrawable(R.styleable.CardIconButton_android_src);
if (src != null) {
mImage.setImageDrawable(src);
}
CharSequence text = a.getText(R.styleable.CardIconButton_android_text);
setText(text);
a.recycle();
}
use of android.support.v7.widget.TintTypedArray in project Douya by DreaminginCodeZH.
the class ImageLayout method init.
private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
setClickable(true);
setFocusable(true);
ViewUtils.inflateInto(R.layout.image_layout, this);
ButterKnife.bind(this);
TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs, R.styleable.ImageLayout, defStyleAttr, defStyleRes);
int fillOrientation = a.getInt(R.styleable.ImageLayout_fillOrientation, FILL_ORIENTATION_HORIZONTAL);
a.recycle();
LayoutParams layoutParams = (LayoutParams) mImageView.getLayoutParams();
layoutParams.width = fillOrientation == FILL_ORIENTATION_HORIZONTAL ? LayoutParams.MATCH_PARENT : LayoutParams.WRAP_CONTENT;
layoutParams.height = fillOrientation == FILL_ORIENTATION_HORIZONTAL ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT;
mImageView.setLayoutParams(layoutParams);
}
use of android.support.v7.widget.TintTypedArray in project Shuttle by timusus.
the class CustomCollapsingTextHelper method setCollapsedTextAppearance.
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)) {
mCollapsedTitleColor = 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();
}
use of android.support.v7.widget.TintTypedArray in project react-native-navigation by wix.
the class CollapsingTextView method createDummyTextView.
@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));
}
Aggregations