Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        private float ExtractNumericValueFromAttributes(TypedArray a, int attribute, int defaultValue)
        {
            var tv = a.PeekValue(attribute);

            return(tv == null ? defaultValue : a.GetFloat(attribute, defaultValue));
        }
Exemplo n.º 3
0
 public TypedValue PeekValue(int index)
 {
     return(_array.PeekValue(index));
 }