Class ResourceHelper
-
- All Implemented Interfaces:
public class ResourceHelper
-
-
Field Summary
Fields Modifier and Type Field Description public final static intVIEW_ORIENTATION_AUTOpublic final static intVIEW_ORIENTATION_PORTRAITpublic final static intVIEW_ORIENTATION_LANDSCAPEpublic final booleanuseLandscapeResources
-
Constructor Summary
Constructors Constructor Description ResourceHelper(Context context, TypedArray styledAttributes, int orientationResourceId)Initialize the View orientation using the specified style attribute If the style attribute is set to "portrait" or "landscape", the View orientation in this instance is set appropriately.
-
Method Summary
Modifier and Type Method Description intgetResourceIdForOrientation(int resourceId)Return the resource ID for the specified resource using the View's orientation.
-
-
-
Constructor Detail
-
ResourceHelper
ResourceHelper(Context context, TypedArray styledAttributes, int orientationResourceId)
Initialize the View orientation using the specified style attribute If the style attribute is set to "portrait" or "landscape", the View orientation in this instance is set appropriately.- Parameters:
context- View's ContextstyledAttributes- array of attributes from obtainStyledAttributes() for this VieworientationResourceId- resource ID of the style resource that contains the View orientation
-
-
Method Detail
-
getResourceIdForOrientation
int getResourceIdForOrientation(int resourceId)
Return the resource ID for the specified resource using the View's orientation. Use this method to obtain the resource ID of the resource for the correct View orientation. This will return the specified resource ID if the View's orientation is set to "portrait" If the View's orientation is set to "landscape", the resource ID of the resource with the suffix "_land" will be returned (if it exists), otherwise the specified resource ID will be returned
- Parameters:
resourceId- The portrait (default) resource ID of the resource
-
-