use of android.content.res.TypedArray in project GreenDroid by cyrilmottier.
the class ProgressItem method inflate.
@Override
public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException {
super.inflate(r, parser, attrs);
TypedArray a = r.obtainAttributes(attrs, R.styleable.ProgressItem);
isInProgress = a.getBoolean(R.styleable.ProgressItem_isInProgress, DEFAULT_IS_IN_PROGRESS);
a.recycle();
}
use of android.content.res.TypedArray in project GreenDroid by cyrilmottier.
the class TextItem method inflate.
@Override
public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException {
super.inflate(r, parser, attrs);
TypedArray a = r.obtainAttributes(attrs, R.styleable.TextItem);
text = a.getString(R.styleable.TextItem_text);
a.recycle();
}
use of android.content.res.TypedArray in project GreenDroid by cyrilmottier.
the class ThumbnailItem method inflate.
@Override
public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException {
super.inflate(r, parser, attrs);
TypedArray a = r.obtainAttributes(attrs, R.styleable.ThumbnailItem);
drawableId = a.getResourceId(R.styleable.ThumbnailItem_thumbnail, drawableId);
drawableURL = a.getString(R.styleable.ThumbnailItem_thumbnailURL);
a.recycle();
}
use of android.content.res.TypedArray in project CustomFontLib by daniribalbert.
the class CustomFontUtils method getTypeFace.
public static Typeface getTypeFace(final TextView v, final AttributeSet attrs) {
final TypedArray tArray = v.getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.customFont, 0, 0);
String fontName = "";
try {
fontName = tArray.getString(R.styleable.customFont_font);
} finally {
tArray.recycle();
}
if (!TextUtils.isEmpty(fontName)) {
final int style;
final Typeface typeface = v.getTypeface();
if (typeface == null) {
style = Typeface.NORMAL;
} else {
style = typeface.getStyle();
}
String mFontName = getFontFile(v.getContext(), fontName, style);
if (sTypefaceMap.containsKey(mFontName)) {
return sTypefaceMap.get(mFontName);
}
Typeface newTypeface = typeface;
if (!TextUtils.isEmpty(mFontName)) {
try {
newTypeface = Typeface.createFromAsset(v.getContext().getAssets(), FONTS_DIR + "/" + mFontName);
} catch (Exception e) {
newTypeface = typeface;
}
}
sTypefaceMap.put(mFontName, newTypeface);
return newTypeface;
}
return null;
}
use of android.content.res.TypedArray in project FlexibleAdapter by davideas.
the class Utils method getColorAccent.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static int getColorAccent(Context context) {
if (colorAccent < 0) {
int accentAttr = eu.davidea.flexibleadapter.utils.Utils.hasLollipop() ? android.R.attr.colorAccent : R.attr.colorAccent;
TypedArray androidAttr = context.getTheme().obtainStyledAttributes(new int[] { accentAttr });
//Default: material_deep_teal_500
colorAccent = androidAttr.getColor(0, 0xFF009688);
androidAttr.recycle();
}
return colorAccent;
}
Aggregations