Java Code Examples for android.support.v7.widget.TintTypedArray#getInt()

The following examples show how to use android.support.v7.widget.TintTypedArray#getInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseToolBar.java    From FileManager with Apache License 2.0 5 votes vote down vote up
public BaseToolBar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mContext = context;
    initViews();
    setContentInsetsRelative(0, 0);
    if (attrs != null) {
        TintTypedArray array = TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.BaseToolBar, defStyleAttr, 0);
        String leftText = array.getString(R.styleable.BaseToolBar_leftText);
        String centerText = array.getString(R.styleable.BaseToolBar_centerText);
        String rightText = array.getString(R.styleable.BaseToolBar_rightText);
        Drawable leftIcon = array.getDrawable(R.styleable.BaseToolBar_leftIcon);
        Drawable rightIcon = array.getDrawable(R.styleable.BaseToolBar_rightIcon);
        Drawable leftrightIcon = array.getDrawable(R.styleable.BaseToolBar_leftrightIcon);
        int leftSize = array.getInt(R.styleable.BaseToolBar_leftTextSize, DEFAULT_TEXT_SIZE);
        int rightSize = array.getInt(R.styleable.BaseToolBar_rightTextSize, DEFAULT_TEXT_SIZE);
        int centerSize = array.getInt(R.styleable.BaseToolBar_centerTextSize, DEFAULT_TEXT_SIZE);
        Drawable leftIconBackground = array.getDrawable(R.styleable.BaseToolBar_leftIconBackground);
        Drawable rightIconBackground = array.getDrawable(R.styleable.BaseToolBar_leftIconBackground);
        setLeftText(leftText);
        setCenterText(centerText);
        setRightText(rightText);
        setLeftIcon(leftIcon);
        setRightIcon(rightIcon);
        setLeftRightIcon(leftrightIcon);
        setLeftTextSize(leftSize);
        setRightTextSize(rightSize);
        setCenterTextSize(centerSize);
        setLeftIconBackground(leftIconBackground);
        setRightIconBackground(rightIconBackground);
        array.recycle();
    }
}
 
Example 2
Source File: NumberAddSubView.java    From enjoyshop with Apache License 2.0 4 votes vote down vote up
public NumberAddSubView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mInflater = LayoutInflater.from(context);
    initView();

    if (attrs != null) {

        final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
                R.styleable.NumberAddSubView, defStyleAttr, 0);


        int val = a.getInt(R.styleable.NumberAddSubView_value, 0);
        setValue(val);

        int maxVal = a.getInt(R.styleable.NumberAddSubView_maxValue, 0);
        if (maxVal != 0)
            setMaxValue(maxVal);

        int minVal = a.getInt(R.styleable.NumberAddSubView_minValue, 0);
        setMinValue(minVal);

        Drawable etBackground = a.getDrawable(R.styleable.NumberAddSubView_editBackground);
        if (etBackground != null)
            setEditTextBackground(etBackground);


        Drawable buttonAddBackground = a.getDrawable(R.styleable
                .NumberAddSubView_buttonAddBackgroud);
        if (buttonAddBackground != null)
            setButtonAddBackgroud(buttonAddBackground);

        Drawable buttonSubBackground = a.getDrawable(R.styleable
                .NumberAddSubView_buttonSubBackgroud);
        if (buttonSubBackground != null)
            setButtonSubBackgroud(buttonSubBackground);


        a.recycle();
    }
}
 
Example 3
Source File: NumberAddSubView.java    From ImitateTaobaoApp with Apache License 2.0 2 votes vote down vote up
@SuppressLint("RestrictedApi")
public NumberAddSubView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mInflater = LayoutInflater.from(context);
    initView();

    if(attrs !=null){

        @SuppressLint("RestrictedApi") final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
                R.styleable.NumberAddSubView, defStyleAttr, 0);


        @SuppressLint("RestrictedApi") int val =  a.getInt(R.styleable.NumberAddSubView_value,0);
        setValue(val);

        @SuppressLint("RestrictedApi") int maxVal = a.getInt(R.styleable.NumberAddSubView_maxValue,0);
        if(maxVal!=0)
            setMaxValue(maxVal);

        @SuppressLint("RestrictedApi") int minVal = a.getInt(R.styleable.NumberAddSubView_minValue,0);
        setMinValue(minVal);

        @SuppressLint("RestrictedApi") Drawable etBackground = a.getDrawable(R.styleable.NumberAddSubView_editBackground);
        if(etBackground!=null)
            setEditTextBackground(etBackground);


         @SuppressLint("RestrictedApi") Drawable buttonAddBackground = a.getDrawable(R.styleable.NumberAddSubView_buttonAddBackgroud);
         if(buttonAddBackground!=null)
             setButtonAddBackgroud(buttonAddBackground);

        @SuppressLint("RestrictedApi") Drawable buttonSubBackground = a.getDrawable(R.styleable.NumberAddSubView_buttonSubBackgroud);
        if(buttonSubBackground!=null)
            setButtonSubBackgroud(buttonSubBackground);




        a.recycle();
    }
}