Java Code Examples for android.util.typedvalue#TYPE_INT_HEX

The following examples show how to use android.util.typedvalue#TYPE_INT_HEX . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AndroidXmlConvertor.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private static String getAttributeValue(AXmlResourceParser parser, int index) {
	int type = parser.getAttributeValueType(index);
	int data = parser.getAttributeValueData(index);

	if (type == TypedValue.TYPE_STRING) {
		return parser.getAttributeValue(index);
	}
	if (type == TypedValue.TYPE_ATTRIBUTE) {
		return String.format("?%s%08X", getPackage(data), data);
	}
	if (type == TypedValue.TYPE_REFERENCE) {
		return String.format("@%s%08X", getPackage(data), data);
	}
	if (type == TypedValue.TYPE_FLOAT) {
		return String.valueOf(Float.intBitsToFloat(data));
	}
	if (type == TypedValue.TYPE_INT_HEX) {
		return String.format("0x%08X", data);
	}
	if (type == TypedValue.TYPE_INT_BOOLEAN) {
		return data == 0 ? "false" : "true";
	}
	if (type == TypedValue.TYPE_DIMENSION) {
		return Float.toString(complexToFloat(data)) +
			DIMENSION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
	}
	if (type == TypedValue.TYPE_FRACTION) {
		return Float.toString(complexToFloat(data)) +
			FRACTION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
	}
	if (type >= TypedValue.TYPE_FIRST_COLOR_INT && type <= TypedValue.TYPE_LAST_COLOR_INT) {
		return String.format("#%08X", data);
	}
	if (type >= TypedValue.TYPE_FIRST_INT && type <= TypedValue.TYPE_LAST_INT) {
		return String.valueOf(data);
	}
	return String.format("<0x%X, type 0x%02X>", data, type);
}
 
Example 2
Source File: RadioGroupSetting.java    From FirefoxReality with Mozilla Public License 2.0 5 votes vote down vote up
public RadioGroupSetting(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.RadioGroupSetting, defStyleAttr, 0);
    mLayout = attributes.getResourceId(R.styleable.RadioGroupSetting_layout, R.layout.setting_radio_group);
    mDescription = attributes.getString(R.styleable.RadioGroupSetting_description);
    mOptions = attributes.getTextArray(R.styleable.RadioGroupSetting_options);
    mDescriptions = attributes.getTextArray(R.styleable.RadioGroupSetting_descriptions);
    mMargin = attributes.getDimension(R.styleable.RadioGroupSetting_itemMargin, getDefaultMargin());
    int id = attributes.getResourceId(R.styleable.RadioGroupSetting_values, 0);
    try {
        TypedArray array = context.getResources().obtainTypedArray(id);
        if (array.getType(0) == TypedValue.TYPE_STRING) {
            mValues = getResources().getStringArray(id);

        } else if (array.getType(0) == TypedValue.TYPE_INT_HEX ||
                array.getType(0) == TypedValue.TYPE_INT_DEC) {
            int [] values = getResources().getIntArray(id);
            mValues = new Integer[values.length];
            for (int i=0; i<values.length; i++) {
                mValues[i] = values[i];
            }
        }
        array.recycle();

    } catch (Resources.NotFoundException ignored) {

    }
    attributes.recycle();

    initialize(context, attrs, defStyleAttr, mLayout);
}
 
Example 3
Source File: ImageRadioGroupSetting.java    From FirefoxReality with Mozilla Public License 2.0 5 votes vote down vote up
public ImageRadioGroupSetting(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.RadioGroupSetting, defStyleAttr, 0);
    mOptions = new ArrayList<>(Arrays.asList(attributes.getTextArray(R.styleable.RadioGroupSetting_options)));
    int id = attributes.getResourceId(R.styleable.RadioGroupSetting_values, 0);
    TypedArray array = context.getResources().obtainTypedArray(id);
    if (array.getType(0) == TypedValue.TYPE_STRING) {
        mValues = new ArrayList<>(Arrays.asList(getResources().getStringArray(id)));

    } else if (array.getType(0) == TypedValue.TYPE_INT_HEX ||
            array.getType(0) == TypedValue.TYPE_INT_DEC) {
        int [] values = getResources().getIntArray(id);
        mValues = new ArrayList<>(Arrays.asList(new Integer[values.length]));
        for (int value : values) {
            mValues.add(value);
        }
    }
    array.recycle();

    id = attributes.getResourceId(R.styleable.RadioGroupSetting_images, 0);

    array = context.getResources().obtainTypedArray(id);
    mImages = new Drawable[mOptions.size()];
    for (int i = 0; i < mOptions.size(); ++i) {
        mImages[i] = array.getDrawable(i);
    }
    array.recycle();

    attributes.recycle();
    initialize(context);
}
 
Example 4
Source File: AXMLPrinter.java    From LibScout with Apache License 2.0 5 votes vote down vote up
public static String getAttributeValue(AXmlResourceParser parser,int index) {
	int type=parser.getAttributeValueType(index);
	int data=parser.getAttributeValueData(index);
	if (type==TypedValue.TYPE_STRING) {
		return parser.getAttributeValue(index);
	}
	if (type==TypedValue.TYPE_ATTRIBUTE) {
		return String.format("?%s%08X",getPackage(data),data);
	}
	if (type==TypedValue.TYPE_REFERENCE) {
		return String.format("@%s%08X",getPackage(data),data);
	}
	if (type==TypedValue.TYPE_FLOAT) {
		return String.valueOf(Float.intBitsToFloat(data));
	}
	if (type==TypedValue.TYPE_INT_HEX) {
		return String.format("0x%08X",data);
	}
	if (type==TypedValue.TYPE_INT_BOOLEAN) {
		return data!=0?"true":"false";
	}
	if (type==TypedValue.TYPE_DIMENSION) {
		return Float.toString(complexToFloat(data))+
			DIMENSION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
	}
	if (type==TypedValue.TYPE_FRACTION) {
		return Float.toString(complexToFloat(data))+
			FRACTION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
	}
	if (type>=TypedValue.TYPE_FIRST_COLOR_INT && type<=TypedValue.TYPE_LAST_COLOR_INT) {
		return String.format("#%08X",data);
	}
	if (type>=TypedValue.TYPE_FIRST_INT && type<=TypedValue.TYPE_LAST_INT) {
		return String.valueOf(data);
	}
	return String.format("<0x%X, type 0x%02X>",data,type);
}
 
Example 5
Source File: ManifestReader.java    From PluginLoader with Apache License 2.0 5 votes vote down vote up
private static String getAttributeValue(XmlResourceParser parser, int index) {
    int type = parser.getAttributeValueType(index);
    int data = parser.getAttributeValueData(index);
    if (type == TypedValue.TYPE_STRING) {
        return parser.getAttributeValue(index);
    }
    if (type == TypedValue.TYPE_ATTRIBUTE) {
        return String.format("?%s%08X", getPackage(data), data);
    }
    if (type == TypedValue.TYPE_REFERENCE) {
        return String.format("@%s%08X", getPackage(data), data);
    }
    if (type == TypedValue.TYPE_FLOAT) {
        return String.valueOf(Float.intBitsToFloat(data));
    }
    if (type == TypedValue.TYPE_INT_HEX) {
        return String.format("0x%08X", data);
    }
    if (type == TypedValue.TYPE_INT_BOOLEAN) {
        return data != 0 ? "true" : "false";
    }
    if (type == TypedValue.TYPE_DIMENSION) {
        return Float.toString(complexToFloat(data)) + DIMENSION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
    }
    if (type == TypedValue.TYPE_FRACTION) {
        return Float.toString(complexToFloat(data)) + FRACTION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
    }
    if (type >= TypedValue.TYPE_FIRST_COLOR_INT && type <= TypedValue.TYPE_LAST_COLOR_INT) {
        return String.format("#%08X", data);
    }
    if (type >= TypedValue.TYPE_FIRST_INT && type <= TypedValue.TYPE_LAST_INT) {
        return String.valueOf(data);
    }
    return String.format("<0x%X, type 0x%02X>", data, type);
}
 
Example 6
Source File: ResignerLogic.java    From apkReSign with Apache License 2.0 5 votes vote down vote up
private static String getAttributeValue(AXmlResourceParser parser, int index) {
    int type = parser.getAttributeValueType(index);
    int data = parser.getAttributeValueData(index);
    if (type == TypedValue.TYPE_STRING) {
        return parser.getAttributeValue(index);
    }
    if (type == TypedValue.TYPE_ATTRIBUTE) {
        return String.format("?%s%08X", getPackage(data), data);
    }
    if (type == TypedValue.TYPE_REFERENCE) {
        return String.format("@%s%08X", getPackage(data), data);
    }
    if (type == TypedValue.TYPE_FLOAT) {
        return String.valueOf(Float.intBitsToFloat(data));
    }
    if (type == TypedValue.TYPE_INT_HEX) {
        return String.format("0x%08X", data);
    }
    if (type == TypedValue.TYPE_INT_BOOLEAN) {
        return data != 0 ? "true" : "false";
    }
    if (type == TypedValue.TYPE_DIMENSION) {
        return Float.toString(complexToFloat(data))
                + DIMENSION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
    }
    if (type == TypedValue.TYPE_FRACTION) {
        return Float.toString(complexToFloat(data))
                + FRACTION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
    }
    if (type >= TypedValue.TYPE_FIRST_COLOR_INT
            && type <= TypedValue.TYPE_LAST_COLOR_INT) {
        return String.format("#%08X", data);
    }
    if (type >= TypedValue.TYPE_FIRST_INT
            && type <= TypedValue.TYPE_LAST_INT) {
        return String.valueOf(data);
    }
    return String.format("<0x%X, type 0x%02X>", data, type);
}
 
Example 7
Source File: AXMLPrinter.java    From Android-Applications-Info with Apache License 2.0 5 votes vote down vote up
private static String getAttributeValue(AXmlResourceParser parser, int index) {
    int type = parser.getAttributeValueType(index);
    int data = parser.getAttributeValueData(index);
    if (type == TypedValue.TYPE_STRING) {
        return parser.getAttributeValue(index);
    }
    if (type == TypedValue.TYPE_ATTRIBUTE) {
        return String.format("?%s%08X", getPackage(data), data);
    }
    if (type == TypedValue.TYPE_REFERENCE) {
        return String.format("@%s%08X", getPackage(data), data);
    }
    if (type == TypedValue.TYPE_FLOAT) {
        return String.valueOf(Float.intBitsToFloat(data));
    }
    if (type == TypedValue.TYPE_INT_HEX) {
        return String.format("0x%08X", data);
    }
    if (type == TypedValue.TYPE_INT_BOOLEAN) {
        return data != 0 ? "true" : "false";
    }
    if (type == TypedValue.TYPE_DIMENSION) {
        return Float.toString(complexToFloat(data)) +
                DIMENSION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
    }
    if (type == TypedValue.TYPE_FRACTION) {
        return Float.toString(complexToFloat(data)) +
                FRACTION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
    }
    if (type >= TypedValue.TYPE_FIRST_COLOR_INT && type <= TypedValue.TYPE_LAST_COLOR_INT) {
        return String.format("#%08X", data);
    }
    if (type >= TypedValue.TYPE_FIRST_INT && type <= TypedValue.TYPE_LAST_INT) {
        return String.valueOf(data);
    }
    return String.format("<0x%X, type 0x%02X>", data, type);
}
 
Example 8
Source File: ManifestReader.java    From Android-Plugin-Framework with MIT License 5 votes vote down vote up
private static String getAttributeValue(XmlResourceParser parser, int index) {
    int type = parser.getAttributeValueType(index);
    int data = parser.getAttributeValueData(index);
    if (type == TypedValue.TYPE_STRING) {
        return parser.getAttributeValue(index);
    }
    if (type == TypedValue.TYPE_ATTRIBUTE) {
        return String.format("?%s%08X", getPackage(data), data);
    }
    if (type == TypedValue.TYPE_REFERENCE) {
        return String.format("@%s%08X", getPackage(data), data);
    }
    if (type == TypedValue.TYPE_FLOAT) {
        return String.valueOf(Float.intBitsToFloat(data));
    }
    if (type == TypedValue.TYPE_INT_HEX) {
        return String.format("0x%08X", data);
    }
    if (type == TypedValue.TYPE_INT_BOOLEAN) {
        return data != 0 ? "true" : "false";
    }
    if (type == TypedValue.TYPE_DIMENSION) {
        return Float.toString(complexToFloat(data)) + DIMENSION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
    }
    if (type == TypedValue.TYPE_FRACTION) {
        return Float.toString(complexToFloat(data)) + FRACTION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
    }
    if (type >= TypedValue.TYPE_FIRST_COLOR_INT && type <= TypedValue.TYPE_LAST_COLOR_INT) {
        return String.format("#%08X", data);
    }
    if (type >= TypedValue.TYPE_FIRST_INT && type <= TypedValue.TYPE_LAST_INT) {
        return String.valueOf(data);
    }
    if (type == 0x07) {
        return String.format("@%s%08X", getPackage(data), data);
    }
    return String.format("<0x%X, type 0x%02X>", data, type);
}
 
Example 9
Source File: XmlManifestReader.java    From AndroidPlugin with MIT License 5 votes vote down vote up
private static String getAttributeValue(XmlResourceParser parser, int index) {
    int type = parser.getAttributeValueType(index);
    int data = parser.getAttributeValueData(index);
    if (type == TypedValue.TYPE_STRING) {
        return parser.getAttributeValue(index);
    }
    if (type == TypedValue.TYPE_ATTRIBUTE) {
        return String.format("?%s%08X", getPackage(data), data);
    }
    if (type == TypedValue.TYPE_REFERENCE) {
        return String.format("@%s%08X", getPackage(data), data);
    }
    if (type == TypedValue.TYPE_FLOAT) {
        return String.valueOf(Float.intBitsToFloat(data));
    }
    if (type == TypedValue.TYPE_INT_HEX) {
        return String.format("0x%08X", data);
    }
    if (type == TypedValue.TYPE_INT_BOOLEAN) {
        return data != 0 ? "true" : "false";
    }
    if (type == TypedValue.TYPE_DIMENSION) {
        return Float.toString(complexToFloat(data))
                + DIMENSION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
    }
    if (type == TypedValue.TYPE_FRACTION) {
        return Float.toString(complexToFloat(data))
                + FRACTION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
    }
    if (type >= TypedValue.TYPE_FIRST_COLOR_INT
            && type <= TypedValue.TYPE_LAST_COLOR_INT) {
        return String.format("#%08X", data);
    }
    if (type >= TypedValue.TYPE_FIRST_INT
            && type <= TypedValue.TYPE_LAST_INT) {
        return String.valueOf(data);
    }
    return String.format("<0x%X, type 0x%02X>", data, type);
}
 
Example 10
Source File: Keyboard.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/** Create a key with the given top-left coordinate and extract its attributes from
 * the XML parser.
 * @param res resources associated with the caller's context
 * @param parent the row that this key belongs to. The row must already be attached to
 * a {@link Keyboard}.
 * @param x the x coordinate of the top-left
 * @param y the y coordinate of the top-left
 * @param parser the XML parser containing the attributes for this key
 */
public Key(Resources res, Row parent, int x, int y, XmlResourceParser parser) {
    this(parent);

    this.x = x;
    this.y = y;
    
    TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), 
            com.android.internal.R.styleable.Keyboard);

    width = getDimensionOrFraction(a, 
            com.android.internal.R.styleable.Keyboard_keyWidth,
            keyboard.mDisplayWidth, parent.defaultWidth);
    height = getDimensionOrFraction(a, 
            com.android.internal.R.styleable.Keyboard_keyHeight,
            keyboard.mDisplayHeight, parent.defaultHeight);
    gap = getDimensionOrFraction(a, 
            com.android.internal.R.styleable.Keyboard_horizontalGap,
            keyboard.mDisplayWidth, parent.defaultHorizontalGap);
    a.recycle();
    a = res.obtainAttributes(Xml.asAttributeSet(parser),
            com.android.internal.R.styleable.Keyboard_Key);
    this.x += gap;
    TypedValue codesValue = new TypedValue();
    a.getValue(com.android.internal.R.styleable.Keyboard_Key_codes, 
            codesValue);
    if (codesValue.type == TypedValue.TYPE_INT_DEC 
            || codesValue.type == TypedValue.TYPE_INT_HEX) {
        codes = new int[] { codesValue.data };
    } else if (codesValue.type == TypedValue.TYPE_STRING) {
        codes = parseCSV(codesValue.string.toString());
    }
    
    iconPreview = a.getDrawable(com.android.internal.R.styleable.Keyboard_Key_iconPreview);
    if (iconPreview != null) {
        iconPreview.setBounds(0, 0, iconPreview.getIntrinsicWidth(), 
                iconPreview.getIntrinsicHeight());
    }
    popupCharacters = a.getText(
            com.android.internal.R.styleable.Keyboard_Key_popupCharacters);
    popupResId = a.getResourceId(
            com.android.internal.R.styleable.Keyboard_Key_popupKeyboard, 0);
    repeatable = a.getBoolean(
            com.android.internal.R.styleable.Keyboard_Key_isRepeatable, false);
    modifier = a.getBoolean(
            com.android.internal.R.styleable.Keyboard_Key_isModifier, false);
    sticky = a.getBoolean(
            com.android.internal.R.styleable.Keyboard_Key_isSticky, false);
    edgeFlags = a.getInt(com.android.internal.R.styleable.Keyboard_Key_keyEdgeFlags, 0);
    edgeFlags |= parent.rowEdgeFlags;

    icon = a.getDrawable(
            com.android.internal.R.styleable.Keyboard_Key_keyIcon);
    if (icon != null) {
        icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
    }
    label = a.getText(com.android.internal.R.styleable.Keyboard_Key_keyLabel);
    text = a.getText(com.android.internal.R.styleable.Keyboard_Key_keyOutputText);
    
    if (codes == null && !TextUtils.isEmpty(label)) {
        codes = new int[] { label.charAt(0) };
    }
    a.recycle();
}
 
Example 11
Source File: Keyboard.java    From libcommon with Apache License 2.0 4 votes vote down vote up
/**
 * Create a key with the given top-left coordinate and extract its attributes from
 * the XML parser.
 *
 * @param res    resources associated with the caller's context
 * @param parent the row that this key belongs to. The row must already be attached to
 *               a {@link Keyboard}.
 * @param x      the x coordinate of the top-left
 * @param y      the y coordinate of the top-left
 * @param parser the XML parser containing the attributes for this key
 */
public Key(@NonNull final  Resources res,
	@NonNull final  Keyboard.Row parent,
	final int x, final int y,
	final XmlResourceParser parser) {

	this(parent);

	this.x = x;
	this.y = y;

	TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser),
		R.styleable.Keyboard);

	width = getDimensionOrFraction(a,
		R.styleable.Keyboard_keyWidth,
		keyboard.mDisplayWidth, parent.defaultWidth);
	height = getDimensionOrFraction(a,
		R.styleable.Keyboard_keyHeight,
		keyboard.mDisplayHeight, parent.defaultHeight);
	gap = getDimensionOrFraction(a,
		R.styleable.Keyboard_horizontalGap,
		keyboard.mDisplayWidth, parent.defaultHorizontalGap);
	a.recycle();
	a = res.obtainAttributes(Xml.asAttributeSet(parser),
		R.styleable.Keyboard_Key);
	this.x += gap;
	TypedValue codesValue = new TypedValue();
	a.getValue(R.styleable.Keyboard_Key_codes, codesValue);
	if (DEBUG) Log.i(TAG, "Key:" + codesValue);
	if (codesValue.type == TypedValue.TYPE_INT_DEC
		|| codesValue.type == TypedValue.TYPE_INT_HEX) {
		codes = new int[]{codesValue.data};
	} else if (codesValue.type == TypedValue.TYPE_STRING) {
		codes = parseCSV(codesValue.string.toString());
	}

	iconPreview = a.getDrawable(R.styleable.Keyboard_Key_iconPreview);
	if (iconPreview != null) {
		iconPreview.setBounds(0, 0, iconPreview.getIntrinsicWidth(),
			iconPreview.getIntrinsicHeight());
	}
	popupCharacters = a.getText(
		R.styleable.Keyboard_Key_popupCharacters);
	popupResId = a.getResourceId(
		R.styleable.Keyboard_Key_popupKeyboard, 0);
	repeatable = a.getBoolean(
		R.styleable.Keyboard_Key_isRepeatable, false);
	modifier = a.getBoolean(
		R.styleable.Keyboard_Key_isModifier, false);
	sticky = a.getBoolean(
		R.styleable.Keyboard_Key_isSticky, false);
	edgeFlags = a.getInt(R.styleable.Keyboard_Key_keyEdgeFlags, 0);
	edgeFlags |= parent.rowEdgeFlags;

	icon = a.getDrawable(
		R.styleable.Keyboard_Key_keyIcon);
	if (icon != null) {
		icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
	}
	label = a.getText(R.styleable.Keyboard_Key_keyLabel);
	text = a.getText(R.styleable.Keyboard_Key_keyOutputText);

	if (codes == null && !TextUtils.isEmpty(label)) {
		codes = new int[]{label.charAt(0)};
	}
	a.recycle();
}
 
Example 12
Source File: MenuInflater.java    From android-apps with MIT License 4 votes vote down vote up
/**
 * Called when the parser is pointing to an item tag.
 */
public void readItem(AttributeSet attrs) {
    TypedArray a = mContext.obtainStyledAttributes(attrs,
            R.styleable.SherlockMenuItem);

    // Inherit attributes from the group as default value
    itemId = a.getResourceId(R.styleable.SherlockMenuItem_android_id, defaultItemId);
    final int category = a.getInt(R.styleable.SherlockMenuItem_android_menuCategory, groupCategory);
    final int order = a.getInt(R.styleable.SherlockMenuItem_android_orderInCategory, groupOrder);
    itemCategoryOrder = (category & Menu.CATEGORY_MASK) | (order & Menu.USER_MASK);
    itemTitle = a.getText(R.styleable.SherlockMenuItem_android_title);
    itemTitleCondensed = a.getText(R.styleable.SherlockMenuItem_android_titleCondensed);
    itemIconResId = a.getResourceId(R.styleable.SherlockMenuItem_android_icon, 0);
    itemAlphabeticShortcut =
            getShortcut(a.getString(R.styleable.SherlockMenuItem_android_alphabeticShortcut));
    itemNumericShortcut =
            getShortcut(a.getString(R.styleable.SherlockMenuItem_android_numericShortcut));
    if (a.hasValue(R.styleable.SherlockMenuItem_android_checkable)) {
        // Item has attribute checkable, use it
        itemCheckable = a.getBoolean(R.styleable.SherlockMenuItem_android_checkable, false) ? 1 : 0;
    } else {
        // Item does not have attribute, use the group's (group can have one more state
        // for checkable that represents the exclusive checkable)
        itemCheckable = groupCheckable;
    }

    itemChecked = a.getBoolean(R.styleable.SherlockMenuItem_android_checked, defaultItemChecked);
    itemVisible = a.getBoolean(R.styleable.SherlockMenuItem_android_visible, groupVisible);
    itemEnabled = a.getBoolean(R.styleable.SherlockMenuItem_android_enabled, groupEnabled);

    TypedValue value = new TypedValue();
    a.getValue(R.styleable.SherlockMenuItem_android_showAsAction, value);
    itemShowAsAction = value.type == TypedValue.TYPE_INT_HEX ? value.data : -1;

    itemListenerMethodName = a.getString(R.styleable.SherlockMenuItem_android_onClick);
    itemActionViewLayout = a.getResourceId(R.styleable.SherlockMenuItem_android_actionLayout, 0);
    itemActionViewClassName = a.getString(R.styleable.SherlockMenuItem_android_actionViewClass);
    itemActionProviderClassName = a.getString(R.styleable.SherlockMenuItem_android_actionProviderClass);

    final boolean hasActionProvider = itemActionProviderClassName != null;
    if (hasActionProvider && itemActionViewLayout == 0 && itemActionViewClassName == null) {
        itemActionProvider = newInstance(itemActionProviderClassName,
                    ACTION_PROVIDER_CONSTRUCTOR_SIGNATURE,
                    mActionProviderConstructorArguments);
    } else {
        if (hasActionProvider) {
            Log.w(LOG_TAG, "Ignoring attribute 'actionProviderClass'."
                    + " Action view already specified.");
        }
        itemActionProvider = null;
    }

    a.recycle();

    itemAdded = false;
}