Search in sources :

Example 36 with TypedArray

use of android.content.res.TypedArray in project enroscar by stanfy.

the class ImageView method init.

private void init(final Context context, final AttributeSet attrs) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ImageView);
    final int cornersRadius = a.getDimensionPixelSize(R.styleable.ImageView_android_radius, 0);
    a.recycle();
    setCornersRadius(cornersRadius);
}
Also used : TypedArray(android.content.res.TypedArray)

Example 37 with TypedArray

use of android.content.res.TypedArray in project Rutgers-Course-Tracker by tevjef.

the class Utils method fetchPrimaryDarkColor.

public static int fetchPrimaryDarkColor(Resources.Theme context) {
    TypedValue typedValue = new TypedValue();
    TypedArray a = context.obtainStyledAttributes(typedValue.data, new int[] { R.attr.colorPrimaryDark });
    int color = a.getColor(0, 0);
    a.recycle();
    return color;
}
Also used : TypedArray(android.content.res.TypedArray) TypedValue(android.util.TypedValue)

Example 38 with TypedArray

use of android.content.res.TypedArray in project Rutgers-Course-Tracker by tevjef.

the class StringPicker method initAttributes.

private void initAttributes(Context context, AttributeSet attrs) {
    themeColors = resolveColors(context);
    TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.StringPicker, 0, 0);
    try {
        mDividerColor = a.getInt(R.styleable.StringPicker_sp__dividerColor, themeColors.accentColor);
        //http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.2_r1/android/widget/NumberPicker.java#NumberPicker.0UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT
        mDividerHeight = a.getDimensionPixelSize(R.styleable.StringPicker_sp__dividerHeight, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics()));
    } finally {
        a.recycle();
    }
}
Also used : TypedArray(android.content.res.TypedArray)

Example 39 with TypedArray

use of android.content.res.TypedArray in project BGAQRCode-Android by bingoogolapple.

the class ScanBoxView method initCustomAttrs.

public void initCustomAttrs(Context context, AttributeSet attrs) {
    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.QRCodeView);
    final int count = typedArray.getIndexCount();
    for (int i = 0; i < count; i++) {
        initCustomAttr(typedArray.getIndex(i), typedArray);
    }
    typedArray.recycle();
    afterInitCustomAttrs();
}
Also used : TypedArray(android.content.res.TypedArray) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint)

Example 40 with TypedArray

use of android.content.res.TypedArray in project BGABanner-Android by bingoogolapple.

the class BGABanner method initCustomAttrs.

private void initCustomAttrs(Context context, AttributeSet attrs) {
    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.BGABanner);
    final int N = typedArray.getIndexCount();
    for (int i = 0; i < N; i++) {
        initCustomAttr(typedArray.getIndex(i), typedArray);
    }
    typedArray.recycle();
}
Also used : TypedArray(android.content.res.TypedArray)

Aggregations

TypedArray (android.content.res.TypedArray)2031 Paint (android.graphics.Paint)193 TypedValue (android.util.TypedValue)190 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)162 Drawable (android.graphics.drawable.Drawable)119 Resources (android.content.res.Resources)118 View (android.view.View)117 Context (android.content.Context)80 XmlResourceParser (android.content.res.XmlResourceParser)80 ColorStateList (android.content.res.ColorStateList)78 AttributeSet (android.util.AttributeSet)78 IOException (java.io.IOException)77 SuppressLint (android.annotation.SuppressLint)66 TextPaint (android.text.TextPaint)63 TextView (android.widget.TextView)63 ViewGroup (android.view.ViewGroup)59 Bundle (android.os.Bundle)48 Point (android.graphics.Point)43 LayoutInflater (android.view.LayoutInflater)42 ImageView (android.widget.ImageView)40