Package org.robolectric.shadows
Class ResourceHelper2
- java.lang.Object
-
- org.robolectric.shadows.ResourceHelper2
-
public final class ResourceHelper2 extends java.lang.ObjectHelper class to provide various conversion method used in handling android resources.
-
-
Constructor Summary
Constructors Constructor Description ResourceHelper2()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static android.util.TypedValuegetValue(java.lang.String attribute, java.lang.String value, boolean requireUnit)Returns the raw value from the given attribute float-type value string.static booleanparseFloatAttribute(java.lang.String attribute, java.lang.String value, android.util.TypedValue outValue, boolean requireUnit)Parse a float attribute and return the parsed value into a given TypedValue.
-
-
-
Method Detail
-
getValue
public static android.util.TypedValue getValue(java.lang.String attribute, java.lang.String value, boolean requireUnit)Returns the raw value from the given attribute float-type value string. This object is only valid until the next call on toResourceHelper2.- Parameters:
attribute- Attribute name.value- Attribute value.requireUnit- whether the value is expected to contain a unit.- Returns:
- The typed value.
-
parseFloatAttribute
public static boolean parseFloatAttribute(java.lang.String attribute, java.lang.String value, android.util.TypedValue outValue, boolean requireUnit)Parse a float attribute and return the parsed value into a given TypedValue.- Parameters:
attribute- the name of the attribute. Can be null if requireUnit is false.value- the string value of the attributeoutValue- the TypedValue to receive the parsed valuerequireUnit- whether the value is expected to contain a unit.- Returns:
- true if success.
-
-