Search in sources :

Example 6 with TintTypedArray

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

Example 7 with TintTypedArray

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

Example 8 with TintTypedArray

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

Example 9 with TintTypedArray

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

Example 10 with TintTypedArray

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));
}
Also used : TintTypedArray(android.support.v7.widget.TintTypedArray) TextView(android.widget.TextView) SuppressLint(android.annotation.SuppressLint) TextPaint(android.text.TextPaint) Point(com.reactnativenavigation.views.utils.Point) Paint(android.graphics.Paint) LinearLayout(android.widget.LinearLayout) SuppressLint(android.annotation.SuppressLint)

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