android.support.v7.widget.TintTypedArray的实例源码

项目:qmui    文件:QMUICollapsingTextHelper.java   
public void setCollapsedTextAppearance(int resId) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(),resId,R.styleable.QMUITextAppearance);
    if (a.hasValue(R.styleable.QMUITextAppearance_android_textColor)) {
        mCollapsedTextColor = a.getColorStateList(R.styleable.QMUITextAppearance_android_textColor);
    }
    if (a.hasValue(R.styleable.QMUITextAppearance_android_textSize)) {
        mCollapsedTextSize = a.getDimensionPixelSize(R.styleable.QMUITextAppearance_android_textSize,(int) mCollapsedTextSize);
    }
    mCollapsedShadowColor = a.getInt(R.styleable.QMUITextAppearance_android_shadowColor,0);
    mCollapsedShadowDx = a.getFloat(R.styleable.QMUITextAppearance_android_shadowDx,0);
    mCollapsedShadowDy = a.getFloat(R.styleable.QMUITextAppearance_android_shadowDy,0);
    mCollapsedShadowRadius = a.getFloat(R.styleable.QMUITextAppearance_android_shadowRadius,0);
    a.recycle();

    if (Build.VERSION.SDK_INT >= 16) {
        mCollapsedTypeface = readFontFamilyTypeface(resId);
    }

    recalculate();
}
项目:qmui    文件:QMUICollapsingTextHelper.java   
public void setExpandedTextAppearance(int resId) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(),R.styleable.QMUITextAppearance);
    if (a.hasValue(R.styleable.QMUITextAppearance_android_textColor)) {
        mExpandedTextColor = a.getColorStateList(R.styleable.QMUITextAppearance_android_textColor);
    }
    if (a.hasValue(R.styleable.QMUITextAppearance_android_textSize)) {
        mExpandedTextSize = a.getDimensionPixelSize(R.styleable.QMUITextAppearance_android_textSize,(int) mExpandedTextSize);
    }
    mExpandedShadowColor = a.getInt(
            R.styleable.QMUITextAppearance_android_shadowColor,0);
    mExpandedShadowDx = a.getFloat(
            R.styleable.QMUITextAppearance_android_shadowDx,0);
    mExpandedShadowDy = a.getFloat(
            R.styleable.QMUITextAppearance_android_shadowDy,0);
    mExpandedShadowRadius = a.getFloat(
            R.styleable.QMUITextAppearance_android_shadowRadius,0);
    a.recycle();

    if (Build.VERSION.SDK_INT >= 16) {
        mExpandedTypeface = readFontFamilyTypeface(resId);
    }

    recalculate();
}
项目:head    文件:HeadToolBar.java   
/**
 * 重新设置标题的样式
 *
 * @param context
 * @param attrs
 * @param defStyleAttr
 */
private void reSetTitleStyle(Context context,@Nullable AttributeSet attrs,int defStyleAttr) {

    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context,attrs,R.styleable.Toolbar,defStyleAttr,0);
    final int titleTextAppearance = a.getResourceId(R.styleable.Toolbar_titleTextAppearance,0);
    if (titleTextAppearance != 0) {
        setTitleTextAppearance(context,titleTextAppearance);
    }
    if (mTitleTextColor != 0) {
        setTitleTextColor(mTitleTextColor);
    }
    a.recycle();
    post(new Runnable() {
        @Override
        public void run() {
            if (getLayoutParams() instanceof LayoutParams) {
                ((LayoutParams) getLayoutParams()).gravity = Gravity.CENTER;
            }
        }
    });
}
项目:head    文件:HeadToolBar.java   
/**
 * 重新设置标题的样式
 *
 * @param context
 * @param attrs
 * @param defStyleAttr
 */
private void reSetSubTitleStyle(Context context,0);
    final int titleTextAppearance = a.getResourceId(R.styleable.Toolbar_subtitleTextAppearance,0);
    if (titleTextAppearance != 0) {
        setSubtitleTextAppearance(context,titleTextAppearance);
    }
    if (mSubtitleTextColor != 0) {
        setTitleTextColor(mSubtitleTextColor);
    }
    a.recycle();
    post(new Runnable() {
        @Override
        public void run() {
            if (getLayoutParams() instanceof LayoutParams) {
                ((LayoutParams) getLayoutParams()).gravity = Gravity.CENTER;
            }
        }
    });

}
项目:QMUI_Android    文件:QMUICollapsingTextHelper.java   
public void setCollapsedTextAppearance(int resId) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(),0);
    a.recycle();

    if (Build.VERSION.SDK_INT >= 16) {
        mCollapsedTypeface = readFontFamilyTypeface(resId);
    }

    recalculate();
}
项目:QMUI_Android    文件:QMUICollapsingTextHelper.java   
public void setExpandedTextAppearance(int resId) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(),0);
    a.recycle();

    if (Build.VERSION.SDK_INT >= 16) {
        mExpandedTypeface = readFontFamilyTypeface(resId);
    }

    recalculate();
}
项目:Mobike    文件:MyToolBar.java   
public MyToolBar(Context context,AttributeSet attrs,int defStyleAttr) {
    super(context,defStyleAttr);
    initview();
    if (attrs != null) {

        final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(),R.styleable.MyToolBar,0);
        showSearchView = a.getBoolean(R.styleable.MyToolBar_showSearchView,false);
        left_button_icon = a.getDrawable(R.styleable.MyToolBar_leftButtonIcon);
        right_button_icon = a.getDrawable(R.styleable.MyToolBar_rightButtonIcon);
        title = a.getString(R.styleable.MyToolBar_myTitle);
        a.recycle();
    }

    isShouw();

    setContentInsetsRelative(10,10);

    initListener();

}
项目:training-epam-2016    文件:IcButton.java   
private void init(final AttributeSet attrs,final int defStyleAttr) {
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(),R.styleable.IcButtonStyle,0);
    try {
        final AppCompatDrawableManager drawableManager = AppCompatDrawableManager.get();
        Drawable rightIcon = a.getDrawableIfKnown(R.styleable.IcButtonStyle_rightIcon);

        int id = a.getResourceId(R.styleable.IcButtonStyle_rightIcon,-1);
        if (id != -1) {
            rightIcon = drawableManager.getDrawable(getContext(),id);
        }
        Drawable topIcon = a.getDrawableIfKnown(R.styleable.IcButtonStyle_topIcon);
        id = a.getResourceId(R.styleable.IcButtonStyle_topIcon,-1);
        if (id != -1) {
            topIcon = drawableManager.getDrawable(getContext(),id);
        }

        setCompoundDrawablesWithIntrinsicBounds(null,topIcon,rightIcon,null);
    } finally {
        a.recycle();
    }
}
项目:react-native-navigation    文件:CollapsingTextView.java   
@SuppressLint("PrivateResource")
private void createDummyTextView(Context context) {
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(),null,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));
}
项目:BufferTextInputLayout    文件:CollapsingTextHelper.java   
public void setCollapsedTextAppearance(int resId) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(),android.support.v7.appcompat.R.styleable.TextAppearance);
    if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
        mCollapsedTextColor = 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();
}
项目:BufferTextInputLayout    文件:CollapsingTextHelper.java   
public void setExpandedTextAppearance(int resId) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(),android.support.v7.appcompat.R.styleable.TextAppearance);
    if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
        mExpandedTextColor = a.getColorStateList(
                android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
    }
    if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
        mExpandedTextSize = a.getDimensionPixelSize(
                android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,(int) mExpandedTextSize);
    }
    mExpandedShadowColor = a.getInt(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor,0);
    mExpandedShadowDx = a.getFloat(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx,0);
    mExpandedShadowDy = a.getFloat(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy,0);
    mExpandedShadowRadius = a.getFloat(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius,0);
    a.recycle();
    if (Build.VERSION.SDK_INT >= 16) {
        mExpandedTypeface = readFontFamilyTypeface(resId);
    }
    recalculate();
}
项目:AndroidBase    文件:AppCompatTextViewHelper.java   
public void loadFromAttributes(AttributeSet attrs,int defStyleAttr) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(),com.ljz.base.widget.R.styleable.SelectorInjection,0);

    Drawable[] drawables = mView.getCompoundDrawables();
    try {
        int leftColor = a.getColor(com.ljz.base.widget.R.styleable.SelectorInjection_drawableLeftTint,DEFAULT_COLOR);
        int topColor = a.getColor(com.ljz.base.widget.R.styleable.SelectorInjection_drawableTopTint,DEFAULT_COLOR);
        int rightColor = a.getColor(com.ljz.base.widget.R.styleable.SelectorInjection_drawableRightTint,DEFAULT_COLOR);
        int bottomColor = a.getColor(com.ljz.base.widget.R.styleable.SelectorInjection_drawableBottomTint,DEFAULT_COLOR);

        int[] colors = {leftColor,topColor,rightColor,bottomColor};
        tintDrawable(drawables,colors);
    } finally {
        a.recycle();
    }
}
项目:QingNianTuZhai    文件:ColorToolBar.java   
public ColorToolBar(Context context,@Nullable AttributeSet attrs) {
    super(context,attrs);
    int attributeCount = attrs.getAttributeCount();
    for (int i = 0; i < attributeCount; i++) {
        String attributeName = attrs.getAttributeName(i);
        Log.i(TAG,"ColorToolBar: "+attributeName);
    }
        Log.i(TAG,"ColorToolBar: -----------------------------------------------------------");
    TypedValue tv = new TypedValue();

    final TintTypedArray typedArray = TintTypedArray.obtainStyledAttributes(getContext(),android.support.v7.appcompat.R.styleable.Toolbar,0);
    int indexCount = typedArray.getIndexCount();
    int resourceId = typedArray.getResourceId(android.support.v7.appcompat.R.styleable.Toolbar_popupTheme,-1);
        Log.i(TAG,"ColorToolBar: "+(resourceId > 0 ? "获取到资源id :"+ resourceId : "未获取到资源id"));
    for (int i = 0; i < indexCount; i++) {
        typedArray.getValue(i,tv);
        Log.i(TAG,"ColorToolBar: "+tv.toString());
    }

}
项目:BitkyShop    文件:KyToolBar.java   
public KyToolBar(Context context,int defStyleAttr) {
  super(context,defStyleAttr);

  initView();
  final TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(getContext(),R.styleable.KyToolbar,0);
  final boolean enableKyNavigationIcon =
      a.getBoolean(R.styleable.KyToolbar_enableKyNavigationIcon,true);
  final boolean enableKySearch = a.getBoolean(R.styleable.KyToolbar_enableKySearch,false);
  final Drawable navIcon = a.getDrawable(R.styleable.KyToolbar_KyNavigationIcon);
  final Drawable rightButtonIcon = a.getDrawable(R.styleable.KyToolbar_setRightButton);
  final String rightText = a.getString(R.styleable.KyToolbar_setRightText);

  setNavigationIcon(navIcon);
  setRightButtonIcon(rightButtonIcon);
  enableKyNavigation(enableKyNavigationIcon);
  setRightTextView(rightText);
  setEnabledSearch(enableKySearch);
  a.recycle();
}
项目:cniao5    文件:CNiaoToolBar.java   
public CNiaoToolBar(Context context,defStyleAttr);

    initView();
    setContentInsetsRelative(10,10);

    if(attrs !=null) {
        final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(),R.styleable.CNiaoToolBar,0);

        final Drawable rightIcon = a.getDrawable(R.styleable.CNiaoToolBar_rightButtonIcon);
        if (rightIcon != null) {
            setRightButtonIcon(rightIcon);
        }


        boolean isShowSearchView = a.getBoolean(R.styleable.CNiaoToolBar_isShowSearchView,false);

        if(isShowSearchView){
            showSearchView();
            hideTitleView();
        }

        CharSequence rightButtonText = a.getText(R.styleable.CNiaoToolBar_rightButtonText);
        if(rightButtonText !=null){
            setRightButtonText(rightButtonText);
        }

        a.recycle();
    }

}
项目:AndroidSkinAnimator    文件:SkinCompatProgressBarHelper.java   
void loadFromAttributes(AttributeSet attrs,TINT_ATTRS,0);

    mIndeterminateDrawableResId = a.getResourceId(0,INVALID_ID);
    mProgressDrawableResId = a.getResourceId(1,INVALID_ID);

    a.recycle();
    applySkin();
}
项目:AndroidSkinAnimator    文件:SkinCompatBackgroundHelper.java   
public void loadFromAttributes(AttributeSet attrs,R.styleable.SkinBackgroundHelper,0);
    try {
        if (a.hasValue(R.styleable.SkinBackgroundHelper_android_background)) {
            mBackgroundResId = a.getResourceId(
                    R.styleable.SkinBackgroundHelper_android_background,INVALID_ID);
        }
    } finally {
        a.recycle();
    }
    applySkin();
}
项目:AndroidSkinAnimator    文件:SkinCompatAutoCompleteTextView.java   
public SkinCompatAutoCompleteTextView(Context context,defStyleAttr);
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(),0);
    if (a.hasValue(0)) {
        mDropDownBackgroundResId = a.getResourceId(0,INVALID_ID);
    }
    a.recycle();
    applyDropDownBackgroundResource();
    mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
    mBackgroundTintHelper.loadFromAttributes(attrs,defStyleAttr);
    mTextHelper = new SkinCompatTextHelper(this);
    mTextHelper.loadFromAttributes(attrs,defStyleAttr);
}
项目:AndroidSkinAnimator    文件:SkinCompatMultiAutoCompleteTextView.java   
public SkinCompatMultiAutoCompleteTextView(Context context,defStyleAttr);
}
项目:AndroidSkinAnimator    文件:SkinCompatTextHelper.java   
public void loadFromAttributes(AttributeSet attrs,int defStyleAttr) {
    final Context context = mView.getContext();

    // First read the TextAppearance style id
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context,R.styleable.SkinCompatTextHelper,0);
    final int ap = a.getResourceId(R.styleable.SkinCompatTextHelper_android_textAppearance,INVALID_ID);
    SkinLog.d(TAG,"ap = " + ap);
    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,"mTextColorHintResId = " + mTextColorHintResId);
        }
        a.recycle();
    }

    // Now read the style's values
    a = TintTypedArray.obtainStyledAttributes(context,R.styleable.SkinTextAppearance,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,"mTextColorHintResId = " + mTextColorHintResId);
    }
    a.recycle();
    applySkin();
}
项目:AndroidSkinAnimator    文件:SkinCompatTextHelper.java   
public void onSetTextAppearance(Context context,int resId) {
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context,R.styleable.SkinTextAppearance);
    if (a.hasValue(R.styleable.SkinTextAppearance_android_textColor)) {
        mTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor,"mTextColorResId = " + mTextColorResId);
    }
    if (a.hasValue(R.styleable.SkinTextAppearance_android_textColorHint)) {
        mTextColorHintResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColorHint,"mTextColorHintResId = " + mTextColorHintResId);
    }
    a.recycle();
    applySkin();
}
项目:AndroidSkinAnimator    文件:SkinCompatSeekBarHelper.java   
@Override
    void loadFromAttributes(AttributeSet attrs,int defStyleAttr) {
        super.loadFromAttributes(attrs,defStyleAttr);

        TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(),R.styleable.AppCompatSeekBar,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();
    }
项目:AndroidSkinAnimator    文件:SkinCompatToolbar.java   
public SkinCompatToolbar(Context context,defStyleAttr);
    mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
    mBackgroundTintHelper.loadFromAttributes(attrs,defStyleAttr);

    TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(),0);
    mNavigationIconResId = a.getResourceId(R.styleable.Toolbar_navigationIcon,INVALID_ID);

    int titleAp = a.getResourceId(R.styleable.Toolbar_titleTextAppearance,INVALID_ID);
    int subtitleAp = a.getResourceId(R.styleable.Toolbar_subtitleTextAppearance,INVALID_ID);
    a.recycle();
    if (titleAp != INVALID_ID) {
        a = TintTypedArray.obtainStyledAttributes(context,titleAp,R.styleable.SkinTextAppearance);
        mTitleTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor,INVALID_ID);
        a.recycle();
    }
    if (subtitleAp != INVALID_ID) {
        a = TintTypedArray.obtainStyledAttributes(context,subtitleAp,R.styleable.SkinTextAppearance);
        mSubtitleTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor,INVALID_ID);
        a.recycle();
    }
    a = TintTypedArray.obtainStyledAttributes(getContext(),0);
    if (a.hasValue(R.styleable.Toolbar_titleTextColor)) {
        mTitleTextColorResId = a.getResourceId(R.styleable.Toolbar_titleTextColor,INVALID_ID);
    }
    if (a.hasValue(R.styleable.Toolbar_subtitleTextColor)) {
        mSubtitleTextColorResId = a.getResourceId(R.styleable.Toolbar_subtitleTextColor,INVALID_ID);
    }
    a.recycle();
    applyTitleTextColor();
    applySubtitleTextColor();
    applyNavigationIcon();
}
项目:AndroidSkinAnimator    文件:SkinCompatCheckedTextView.java   
public SkinCompatCheckedTextView(Context context,0);
    mCheckMarkResId = a.getResourceId(0,INVALID_ID);
    a.recycle();
    applyCheckMark();
}
项目:AndroidSkinAnimator    文件:SkinCompatImageHelper.java   
public void loadFromAttributes(AttributeSet attrs,int defStyleAttr) {
    TintTypedArray a = null;
    try {
        a = TintTypedArray.obtainStyledAttributes(mView.getContext(),R.styleable.SkinCompatImageView,0);

        mSrcResId = a.getResourceId(R.styleable.SkinCompatImageView_android_src,-1);
    } finally {
        if (a != null) {
            a.recycle();
        }
    }
    applySkin();
}
项目:Nird2    文件:PreferenceDividerDecoration.java   
public PreferenceDividerDecoration(Context context) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context,new int[] {R.attr.dividerHorizontal});
    mDivider = a.getDrawable(0);
    a.recycle();

    mDividerHeight = mDivider.getIntrinsicHeight();
}
项目:IslamicLibraryAndroid    文件:Util.java   
public static ColorStateList resolveColorStateList(Context context,@AttrRes int attr) {
    TEMP_ARRAY[0] = attr;
    TintTypedArray ta = TintTypedArray.obtainStyledAttributes(context,TEMP_ARRAY);
    try {
        return ta.getColorStateList(0);
    } finally {
        ta.recycle();
    }
}
项目:TitleBar    文件:TitleBar.java   
/**
 * 读取ToolBar的默认标题属性
 *
 * @param attrs        AttributeSet
 * @param defStyleAttr defStyleAttr
 */
private void resolveAttrs(AttributeSet attrs,int defStyleAttr) {
    // Need to use getContext() here so that we use the themed context
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(),0);
    mCenterTitleTextAppearance = a.getResourceId(R.styleable.Toolbar_titleTextAppearance,0);
    mCenterTitleTextColor = a.getColor(R.styleable.Toolbar_titleTextColor,0xffffffff);
    a.recycle();
}
项目:boohee_v5.6    文件:ExpandedMenuView.java   
public ExpandedMenuView(Context context,attrs);
    setOnItemClickListener(this);
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context,0);
    if (a.hasValue(0)) {
        setBackgroundDrawable(a.getDrawable(0));
    }
    if (a.hasValue(1)) {
        setDivider(a.getDrawable(1));
    }
    a.recycle();
}
项目:boohee_v5.6    文件:TabItem.java   
public TabItem(Context context,AttributeSet attrs) {
    super(context,attrs);
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context,R.styleable.TabItem);
    this.mText = a.getText(R.styleable.TabItem_android_text);
    this.mIcon = a.getDrawable(R.styleable.TabItem_android_icon);
    this.mCustomLayout = a.getResourceId(R.styleable.TabItem_android_layout,0);
    a.recycle();
}
项目:BizareChat    文件:UserInfoFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_user_info,container,false);
    arguments = getArguments();
    email = arguments.getString(EMAIL_BUNDLE_KEY);
    phone = arguments.getString(PHONE_BUNDLE_KEY);
    website = arguments.getString(WEBSITE_BUNDLE_KEY);
    fullName = arguments.getString(FULL_NAME_BUNDLE_KEY);
    presenter.setUserId(arguments.getLong(ID_BUNDLE_KEY));

    Toolbar toolbar = (Toolbar) view.findViewById(R.id.user_toolbar);
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(toolbar.getContext(),android.support.v7.appcompat.R.styleable.ActionBar,android.support.v7.appcompat.R.attr.actionBarStyle,0);
    toolbar.setNavigationIcon(a.getDrawable(android.support.v7.appcompat.R.styleable.ActionBar_homeAsUpIndicator));
    toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed());

    toolbarLayout = (CollapsingToolbarLayout) view.findViewById(R.id.user_collapsing_toolbar_layout);
    emailTextView = (TextView) view.findViewById(R.id.user_info_email_value);
    phoneTextView = (TextView) view.findViewById(R.id.user_info_phone_value);
    websiteTextView = (TextView) view.findViewById(R.id.user_info_website_value);
    userInfoFab = (FloatingActionButton) view.findViewById(R.id.user_info_fab);
    toolbarLayout.setTitleEnabled(true);
    toolbarLayout.setTitle(fullName);

    view.findViewById(R.id.user_info_email_layout).setOnClickListener(this);
    view.findViewById(R.id.user_info_phone_layout).setOnClickListener(this);
    view.findViewById(R.id.user_info_website_layout).setOnClickListener(this);
    userInfoFab.setOnClickListener(this);

    if (presenter.isCurrentUser()) {
        userInfoFab.setVisibility(View.GONE);
    }

    packageManager = getActivity().getPackageManager();

    return view;
}
项目:material-components-android    文件:TabItem.java   
public TabItem(Context context,AttributeSet attrs) {
  super(context,attrs);

  final TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(context,R.styleable.TabItem);
  text = a.getText(R.styleable.TabItem_android_text);
  icon = a.getDrawable(R.styleable.TabItem_android_icon);
  customLayout = a.getResourceId(R.styleable.TabItem_android_layout,0);
  a.recycle();
}
项目:material-components-android    文件:CollapsingTextHelper.java   
void setCollapsedTextAppearance(int resId) {
  TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(
          view.getContext(),android.support.v7.appcompat.R.styleable.TextAppearance);
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
    collapsedTextColor =
        a.getColorStateList(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
  }
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
    collapsedTextSize =
        a.getDimensionPixelSize(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,(int) collapsedTextSize);
  }
  collapsedShadowColor =
      a.getInt(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor,0);
  collapsedShadowDx =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx,0);
  collapsedShadowDy =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy,0);
  collapsedShadowRadius =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius,0);
  a.recycle();

  if (Build.VERSION.SDK_INT >= 16) {
    collapsedTypeface = readFontFamilyTypeface(resId);
  }

  recalculate();
}
项目:material-components-android    文件:CollapsingTextHelper.java   
void setExpandedTextAppearance(int resId) {
  TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(
          view.getContext(),android.support.v7.appcompat.R.styleable.TextAppearance);
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
    expandedTextColor =
        a.getColorStateList(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
  }
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
    expandedTextSize =
        a.getDimensionPixelSize(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,(int) expandedTextSize);
  }
  expandedShadowColor =
      a.getInt(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor,0);
  expandedShadowDx =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx,0);
  expandedShadowDy =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy,0);
  expandedShadowRadius =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius,0);
  a.recycle();

  if (Build.VERSION.SDK_INT >= 16) {
    expandedTypeface = readFontFamilyTypeface(resId);
  }

  recalculate();
}
项目:QingNianTuZhai    文件:ColorToolBar.java   
public ColorToolBar(Context context,defStyleAttr);
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(),R.style.ToolBarLightStyle,0);
    int indexCount = a.getIndexCount();
    TypedValue typeValue = new TypedValue();
    for (int i = 0; i < indexCount; i++) {
        a.getValue(i,typeValue);
        Log.i(TAG,"ColorToolBar: "+typeValue.toString());
    }
    this.attr_background = ViewAttributeUtil.getBackgroundAttibute(attrs);
}
项目:iosched    文件:TabItem.java   
public TabItem(Context context,R.styleable.TabItem);
  mText = a.getText(R.styleable.TabItem_android_text);
  mIcon = a.getDrawable(R.styleable.TabItem_android_icon);
  mCustomLayout = a.getResourceId(R.styleable.TabItem_android_layout,0);
  a.recycle();
}
项目:iosched    文件:CollapsingTextHelper.java   
void setCollapsedTextAppearance(int resId) {
  TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(
          mView.getContext(),android.support.v7.appcompat.R.styleable.TextAppearance);
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
    mCollapsedTextColor =
        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();
}
项目:iosched    文件:CollapsingTextHelper.java   
void setExpandedTextAppearance(int resId) {
  TintTypedArray a =
      TintTypedArray.obtainStyledAttributes(
          mView.getContext(),android.support.v7.appcompat.R.styleable.TextAppearance);
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
    mExpandedTextColor =
        a.getColorStateList(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
  }
  if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
    mExpandedTextSize =
        a.getDimensionPixelSize(
            android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,(int) mExpandedTextSize);
  }
  mExpandedShadowColor =
      a.getInt(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor,0);
  mExpandedShadowDx =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx,0);
  mExpandedShadowDy =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy,0);
  mExpandedShadowRadius =
      a.getFloat(android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius,0);
  a.recycle();

  if (Build.VERSION.SDK_INT >= 16) {
    mExpandedTypeface = readFontFamilyTypeface(resId);
  }

  recalculate();
}
项目:EhViewer    文件:CuteSpinner.java   
private void init(Context context,int defStyleAttr) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context,android.support.v7.appcompat.R.styleable.Spinner,0);
    final CharSequence[] entries = a.getTextArray(R.styleable.Spinner_android_entries);
    if (entries != null) {
        final ArrayAdapter<CharSequence> adapter = new ArrayAdapter<>(context,R.layout.item_cute_spinner_item,entries);
        adapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
        setAdapter(adapter);
    }
    a.recycle();
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


com.google.gson.internal.bind.ArrayTypeAdapter的实例源码
com.google.gson.JsonSyntaxException的实例源码
com.google.gson.JsonDeserializer的实例源码
com.google.gson.internal.ConstructorConstructor的实例源码
com.google.gson.JsonPrimitive的实例源码
com.google.gson.LongSerializationPolicy的实例源码
com.google.gson.internal.GsonInternalAccess的实例源码
com.google.gson.JsonIOException的实例源码
com.google.gson.internal.StringMap的实例源码
com.google.gson.JsonObject的实例源码
com.google.gson.internal.bind.TimeTypeAdapter的实例源码
com.google.gson.FieldAttributes的实例源码
com.google.gson.internal.bind.TreeTypeAdapter的实例源码
com.google.gson.internal.LinkedHashTreeMap的实例源码
com.google.gson.TypeAdapterFactory的实例源码
com.google.gson.JsonSerializer的实例源码
com.google.gson.FieldNamingPolicy的实例源码
com.google.gson.JsonElement的实例源码
com.google.gson.internal.JsonReaderInternalAccess的实例源码
com.google.gson.TypeAdapter的实例源码