public static ColorStateList ResolveActionTextColorStateList(Context context, int colorAttr, ColorStateList fallback) { TypedArray a = context.Theme.ObtainStyledAttributes(new int[] { colorAttr }); try { TypedValue value = a.PeekValue(0); if (value == null) { return(fallback); } if (value.Type >= DataType.FirstColorInt && value.Type <= DataType.LastColorInt) { return(GetActionTextStateList(context, new Color(value.Data))); } else { ColorStateList stateList = a.GetColorStateList(0); if (stateList != null) { return(stateList); } else { return(fallback); } } } finally { a.Recycle(); } }
private float ExtractNumericValueFromAttributes(TypedArray a, int attribute, int defaultValue) { var tv = a.PeekValue(attribute); return(tv == null ? defaultValue : a.GetFloat(attribute, defaultValue)); }
public TypedValue PeekValue(int index) { return(_array.PeekValue(index)); }