Exemple #1
0
        public float getFraction(int index, int base1, int pbase, float defValue)
        {
            if (mRecycled)
            {
                throw new Exception("Cannot make calls to a recycled instance!");
            }
            index *= AssetManager.STYLE_NUM_ENTRIES;
            int[] data = mData;
            int   type = data[index + AssetManager.STYLE_TYPE];

            if (type == TypedValue.TYPE_NULL)
            {
                return(defValue);
            }
            else if (type == TypedValue.TYPE_FRACTION)
            {
                return(TypedValue.complexToFraction(
                           data[index + AssetManager.STYLE_DATA], base1, pbase));
            }
            else if (type == TypedValue.TYPE_ATTRIBUTE)
            {
                throw new Exception("Failed to resolve attribute at index " + index);
            }
            throw new Exception("Can't convert to fraction: type=0x" + type.ToString("X"));
        }