public string getText(int index) { 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(null); } else if (type == TypedValue.TYPE_STRING) { return(loadStringValueAt(index)); } TypedValue v = mValue; if (getValueAt(index, v)) { //Log.w(Resources.TAG, "Converting to string: " + v); return(v.coerceToString()); } //Log.w(Resources.TAG, "getString of bad type: 0x" + type.ToString("X")); return(null); }
public int getInt(int index, int 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_FIRST_INT && type <= TypedValue.TYPE_LAST_INT) { return(data[index + AssetManager.STYLE_DATA]); } TypedValue v = mValue; if (getValueAt(index, v)) { //Log.w(Resources.TAG, "Converting to int: " + v); return(XmlUtils.convertValueToInt(v.coerceToString(), defValue)); } //Log.w(Resources.TAG, "getInt of bad type: 0x" + Integer.toHexString(type)); return(defValue); }
/*public string getNonResourceString(int index) * { * 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_STRING) * { * int cookie = data[index + AssetManager.STYLE_ASSET_COOKIE]; * if (cookie < 0) * { * return mXml.getPooledString(data[index + AssetManager.STYLE_DATA]).ToString(); * } * } * return null; * }*/ public string getNonConfigurationString(int index, int allowedChangingConfigs) { 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 ((data[index + AssetManager.STYLE_CHANGING_CONFIGURATIONS] & ~allowedChangingConfigs) != 0) { return(null); } if (type == TypedValue.TYPE_NULL) { return(null); } else if (type == TypedValue.TYPE_STRING) { return(loadStringValueAt(index).ToString()); } TypedValue v = mValue; if (getValueAt(index, v)) { //Log.w(Resources.TAG, "Converting to string: " + v); string cs = v.coerceToString(); return(cs != null?cs.ToString() : null); } //Log.w(Resources.TAG, "getstring of bad type: 0x" + Integer.toHexString(type)); return(null); }
public float getFloat(int index, 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_FLOAT) { //return Float.intBitsToFloat(data[index + AssetManager.STYLE_DATA]); return(ticomware.interop.Util.intBitsToFloat(data[index + AssetManager.STYLE_DATA])); } else if (type >= TypedValue.TYPE_FIRST_INT && type <= TypedValue.TYPE_LAST_INT) { return(data[index + AssetManager.STYLE_DATA]); } TypedValue v = mValue; if (getValueAt(index, v)) { //Log.w(Resources.TAG, "Converting to float: " + v); string str = v.coerceToString(); if (str != null) { return(float.Parse(str.ToString())); } } //Log.w(Resources.TAG, "getFloat of bad type: 0x" + Integer.toHexString(type)); return(defValue); }