Package org.robolectric.res.android
Class ResTable_config
java.lang.Object
org.robolectric.res.android.ResTable_config
public class ResTable_config extends Object
Describes a particular resource configuration.
Transliterated from:
* https://android.googlesource.com/platform/frameworks/base/+/android-9.0.0_r12/libs/androidfw/ResourceTypes.cpp
* https://android.googlesource.com/platform/frameworks/base/+/android-9.0.0_r12/libs/androidfw/include/ResourceTypes.h (struct ResTable_config)
Changes from 8.0.0_r4 partially applied.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResTable_config.TypeThe different types of configs that can be present in aResTable_config. -
Field Summary
Fields Modifier and Type Field Description bytecolorModebyte[]countryReturns a packed 2-byte country code.intdensitystatic intDENSITY_ANYstatic intDENSITY_DEFAULTstatic intDENSITY_DPI_ANYstatic intDENSITY_DPI_MDPIstatic intDENSITY_DPI_NONEstatic intDENSITY_DPI_UNDEFINEDstatic intDENSITY_HIGHstatic intDENSITY_LOWstatic intDENSITY_MEDIUMstatic intDENSITY_NONEstatic intDENSITY_TVstatic intDENSITY_XHIGHstatic intDENSITY_XXHIGHstatic intDENSITY_XXXHIGHstatic intHDR_ANYstatic intHDR_NOstatic intHDR_YESintinputFlagsintkeyboardstatic intKEYBOARD_ANYstatic byteKEYSHIDDEN_ANYstatic byteKEYSHIDDEN_NOstatic byteKEYSHIDDEN_SOFTstatic byteKEYSHIDDEN_YESbyte[]languageReturns a packed 2-byte language code.static intLAYOUTDIR_ANYstatic intLAYOUTDIR_LTRstatic intLAYOUTDIR_RTLbyte[]localeScriptThe ISO-15924 short name for the script corresponding to this configuration.byte[]localeVariantA single BCP-47 variant subtag.static intMASK_HDRstatic intMASK_KEYSHIDDENstatic intMASK_LAYOUTDIRstatic intMASK_NAVHIDDENstatic intMASK_SCREENLONGstatic intMASK_UI_MODE_NIGHTstatic intMASK_UI_MODE_TYPEstatic intMASK_WIDE_COLOR_GAMUTintmccintminorVersionstatic intMINORVERSION_ANYintmncstatic byteNAVHIDDEN_ANYstatic byteNAVHIDDEN_NOstatic byteNAVHIDDEN_YESintnavigationstatic intNAVIGATION_ANYintorientationstatic intORIENTATION_ANYstatic intORIENTATION_LANDstatic intORIENTATION_PORTstatic intORIENTATION_SQUAREstatic intRESTABLE_MAX_LOCALE_LENshortscreenConfigPad2intscreenHeightstatic intSCREENHEIGHT_ANYintscreenHeightDpintscreenLayoutbytescreenLayout2An extension toscreenLayout.static intSCREENLONG_ANYstatic intSCREENLONG_NOstatic intSCREENLONG_YESstatic intSCREENROUND_ANYstatic intSCREENROUND_NOstatic intSCREENROUND_YESstatic intSCREENSIZE_ANYstatic intSCREENSIZE_LARGEstatic intSCREENSIZE_NORMALstatic intSCREENSIZE_SMALLstatic intSCREENSIZE_XLARGEintscreenWidthstatic intSCREENWIDTH_ANYintscreenWidthDpintsdkVersionstatic intSDKVERSION_ANYstatic intSHIFT_LAYOUTDIRstatic intSHIFT_NAVHIDDENstatic intSHIFT_SCREENLONGstatic intSHIFT_UI_MODE_NIGHTstatic intSIZEOFintsmallestScreenWidthDpinttouchscreenstatic intTOUCHSCREEN_ANYstatic intTOUCHSCREEN_FINGERstatic intUI_MODE_NIGHT_ANYstatic intUI_MODE_NIGHT_NOstatic intUI_MODE_TYPE_ANYstatic intUI_MODE_TYPE_NORMALintuiModebyte[]unknownAny remaining bytes in this resource configuration that are unaccounted for.static intWIDE_COLOR_GAMUT_ANYstatic intWIDE_COLOR_GAMUT_NOstatic intWIDE_COLOR_GAMUT_YES -
Constructor Summary
Constructors Constructor Description ResTable_config()ResTable_config(int size, int mcc, int mnc, byte[] language, byte[] country, int orientation, int touchscreen, int density, int keyboard, int navigation, int inputFlags, int screenWidth, int screenHeight, int sdkVersion, int minorVersion, int screenLayout, int uiMode, int smallestScreenWidthDp, int screenWidthDp, int screenHeightDp, byte[] localeScript, byte[] localeVariant, byte screenLayout2, byte colorMode, short screenConfigPad2, byte[] unknown)ResTable_config(ResTable_config other) -
Method Summary
Modifier and Type Method Description intcolorModeHdr()Returns the HDR section ofcolorMode.intcolorModeWideColorGamut()Returns the wide color gamut section ofcolorMode.booleanisBetterThan(ResTable_config o, ResTable_config requested)booleanisDefault()Returns true if this is the default "any" configuration.intkeyboardHidden()voidkeyboardHidden(int value)StringlanguageString()Returnslanguageas an unpacked string representation.StringlocaleScriptString()Returns thelocaleScriptas a string.StringlocaleVariantString()Returns thelocaleVariantas a string.booleanmatch(ResTable_config settings)intnavigationHidden()voidnavigationHidden(int value)voidpackLanguage(String language)voidpackRegion(String region)StringregionString()Returnscountryas an unpacked string representation.intscreenLayoutDirection()voidscreenLayoutDirection(int value)intscreenLayoutLong()voidscreenLayoutLong(int value)intscreenLayoutRound()voidscreenLayoutRound(int value)intscreenLayoutSize()voidscreenLayoutSize(int value)StringscriptString()voidsetBcp47Locale(String in)StringtoString()Map<ResTable_config.Type,String>toStringParts()Returns a map of the configuration parts fortoString().intuiModeNight()voiduiModeNight(int value)intuiModeType()voiduiModeType(int value)ResTable_configwithSdkVersion(int sdkVersion)Returns a copy of this resource configuration with a differentsdkVersion, or this configuration if thesdkVersionis the same.
-
Field Details
-
RESTABLE_MAX_LOCALE_LEN
public static final int RESTABLE_MAX_LOCALE_LEN- See Also:
- Constant Field Values
-
SIZEOF
public static final int SIZEOF- See Also:
- Constant Field Values
-
SHIFT_LAYOUTDIR
public static final int SHIFT_LAYOUTDIR- See Also:
- Constant Field Values
-
LAYOUTDIR_ANY
public static final int LAYOUTDIR_ANY- See Also:
- Constant Field Values
-
LAYOUTDIR_LTR
public static final int LAYOUTDIR_LTR- See Also:
- Constant Field Values
-
LAYOUTDIR_RTL
public static final int LAYOUTDIR_RTL- See Also:
- Constant Field Values
-
SCREENWIDTH_ANY
public static final int SCREENWIDTH_ANY- See Also:
- Constant Field Values
-
SCREENSIZE_ANY
public static final int SCREENSIZE_ANY- See Also:
- Constant Field Values
-
SCREENSIZE_SMALL
public static final int SCREENSIZE_SMALL- See Also:
- Constant Field Values
-
SCREENSIZE_NORMAL
public static final int SCREENSIZE_NORMAL- See Also:
- Constant Field Values
-
SCREENSIZE_LARGE
public static final int SCREENSIZE_LARGE- See Also:
- Constant Field Values
-
SCREENSIZE_XLARGE
public static final int SCREENSIZE_XLARGE- See Also:
- Constant Field Values
-
MASK_UI_MODE_TYPE
public static final int MASK_UI_MODE_TYPE- See Also:
- Constant Field Values
-
UI_MODE_TYPE_ANY
public static final int UI_MODE_TYPE_ANY- See Also:
- Constant Field Values
-
UI_MODE_TYPE_NORMAL
public static final int UI_MODE_TYPE_NORMAL- See Also:
- Constant Field Values
-
MASK_UI_MODE_NIGHT
public static final int MASK_UI_MODE_NIGHT- See Also:
- Constant Field Values
-
SHIFT_UI_MODE_NIGHT
public static final int SHIFT_UI_MODE_NIGHT- See Also:
- Constant Field Values
-
UI_MODE_NIGHT_ANY
public static final int UI_MODE_NIGHT_ANY- See Also:
- Constant Field Values
-
DENSITY_DEFAULT
public static final int DENSITY_DEFAULT- See Also:
- Constant Field Values
-
DENSITY_LOW
public static final int DENSITY_LOW- See Also:
- Constant Field Values
-
DENSITY_MEDIUM
public static final int DENSITY_MEDIUM- See Also:
- Constant Field Values
-
DENSITY_TV
public static final int DENSITY_TV- See Also:
- Constant Field Values
-
DENSITY_HIGH
public static final int DENSITY_HIGH- See Also:
- Constant Field Values
-
DENSITY_XHIGH
public static final int DENSITY_XHIGH- See Also:
- Constant Field Values
-
DENSITY_XXHIGH
public static final int DENSITY_XXHIGH- See Also:
- Constant Field Values
-
DENSITY_XXXHIGH
public static final int DENSITY_XXXHIGH- See Also:
- Constant Field Values
-
DENSITY_ANY
public static final int DENSITY_ANY- See Also:
- Constant Field Values
-
DENSITY_NONE
public static final int DENSITY_NONE- See Also:
- Constant Field Values
-
TOUCHSCREEN_ANY
public static final int TOUCHSCREEN_ANY- See Also:
- Constant Field Values
-
MASK_KEYSHIDDEN
public static final int MASK_KEYSHIDDEN- See Also:
- Constant Field Values
-
KEYSHIDDEN_ANY
public static final byte KEYSHIDDEN_ANY- See Also:
- Constant Field Values
-
KEYSHIDDEN_NO
public static final byte KEYSHIDDEN_NO- See Also:
- Constant Field Values
-
KEYSHIDDEN_YES
public static final byte KEYSHIDDEN_YES- See Also:
- Constant Field Values
-
KEYSHIDDEN_SOFT
public static final byte KEYSHIDDEN_SOFT- See Also:
- Constant Field Values
-
KEYBOARD_ANY
public static final int KEYBOARD_ANY- See Also:
- Constant Field Values
-
MASK_NAVHIDDEN
public static final int MASK_NAVHIDDEN- See Also:
- Constant Field Values
-
SHIFT_NAVHIDDEN
public static final int SHIFT_NAVHIDDEN- See Also:
- Constant Field Values
-
NAVHIDDEN_ANY
public static final byte NAVHIDDEN_ANY- See Also:
- Constant Field Values
-
NAVHIDDEN_NO
public static final byte NAVHIDDEN_NO- See Also:
- Constant Field Values
-
NAVHIDDEN_YES
public static final byte NAVHIDDEN_YES- See Also:
- Constant Field Values
-
NAVIGATION_ANY
public static final int NAVIGATION_ANY- See Also:
- Constant Field Values
-
SCREENHEIGHT_ANY
public static final int SCREENHEIGHT_ANY- See Also:
- Constant Field Values
-
SDKVERSION_ANY
public static final int SDKVERSION_ANY- See Also:
- Constant Field Values
-
MINORVERSION_ANY
public static final int MINORVERSION_ANY- See Also:
- Constant Field Values
-
WIDE_COLOR_GAMUT_ANY
public static final int WIDE_COLOR_GAMUT_ANY- See Also:
- Constant Field Values
-
WIDE_COLOR_GAMUT_NO
public static final int WIDE_COLOR_GAMUT_NO- See Also:
- Constant Field Values
-
WIDE_COLOR_GAMUT_YES
public static final int WIDE_COLOR_GAMUT_YES- See Also:
- Constant Field Values
-
MASK_WIDE_COLOR_GAMUT
public static final int MASK_WIDE_COLOR_GAMUT- See Also:
- Constant Field Values
-
HDR_ANY
public static final int HDR_ANY- See Also:
- Constant Field Values
-
HDR_NO
public static final int HDR_NO- See Also:
- Constant Field Values
-
HDR_YES
public static final int HDR_YES- See Also:
- Constant Field Values
-
MASK_HDR
public static final int MASK_HDR- See Also:
- Constant Field Values
-
DENSITY_DPI_UNDEFINED
public static final int DENSITY_DPI_UNDEFINED- See Also:
- Constant Field Values
-
DENSITY_DPI_MDPI
public static final int DENSITY_DPI_MDPI- See Also:
- Constant Field Values
-
DENSITY_DPI_ANY
public static final int DENSITY_DPI_ANY- See Also:
- Constant Field Values
-
DENSITY_DPI_NONE
public static final int DENSITY_DPI_NONE- See Also:
- Constant Field Values
-
ORIENTATION_ANY
public static final int ORIENTATION_ANY- See Also:
- Constant Field Values
-
ORIENTATION_PORT
public static final int ORIENTATION_PORT- See Also:
- Constant Field Values
-
ORIENTATION_LAND
public static final int ORIENTATION_LAND- See Also:
- Constant Field Values
-
ORIENTATION_SQUARE
public static final int ORIENTATION_SQUARE- See Also:
- Constant Field Values
-
MASK_SCREENLONG
public static final int MASK_SCREENLONG- See Also:
- Constant Field Values
-
SHIFT_SCREENLONG
public static final int SHIFT_SCREENLONG- See Also:
- Constant Field Values
-
SCREENLONG_ANY
public static final int SCREENLONG_ANY- See Also:
- Constant Field Values
-
SCREENLONG_NO
public static final int SCREENLONG_NO- See Also:
- Constant Field Values
-
SCREENLONG_YES
public static final int SCREENLONG_YES- See Also:
- Constant Field Values
-
SCREENROUND_ANY
public static final int SCREENROUND_ANY- See Also:
- Constant Field Values
-
SCREENROUND_NO
public static final int SCREENROUND_NO- See Also:
- Constant Field Values
-
SCREENROUND_YES
public static final int SCREENROUND_YES- See Also:
- Constant Field Values
-
TOUCHSCREEN_FINGER
public static final int TOUCHSCREEN_FINGER- See Also:
- Constant Field Values
-
UI_MODE_NIGHT_NO
public static final int UI_MODE_NIGHT_NO- See Also:
- Constant Field Values
-
mcc
public int mcc -
mnc
public int mnc -
language
public final byte[] languageReturns a packed 2-byte language code. -
country
public final byte[] countryReturns a packed 2-byte country code. -
orientation
public int orientation -
touchscreen
public int touchscreen -
density
public int density -
keyboard
public int keyboard -
navigation
public int navigation -
inputFlags
public int inputFlags -
screenWidth
public int screenWidth -
screenHeight
public int screenHeight -
sdkVersion
public int sdkVersion -
minorVersion
public int minorVersion -
screenLayout
public int screenLayout -
uiMode
public int uiMode -
smallestScreenWidthDp
public int smallestScreenWidthDp -
screenWidthDp
public int screenWidthDp -
screenHeightDp
public int screenHeightDp -
localeScript
public final byte[] localeScriptThe ISO-15924 short name for the script corresponding to this configuration. -
localeVariant
public final byte[] localeVariantA single BCP-47 variant subtag. -
screenLayout2
public byte screenLayout2An extension toscreenLayout. Contains round/notround qualifier. -
colorMode
public byte colorMode -
screenConfigPad2
public short screenConfigPad2 -
unknown
public byte[] unknownAny remaining bytes in this resource configuration that are unaccounted for. -
MASK_LAYOUTDIR
public static final int MASK_LAYOUTDIR- See Also:
- Constant Field Values
-
-
Constructor Details
-
ResTable_config
-
ResTable_config
public ResTable_config(int size, int mcc, int mnc, byte[] language, byte[] country, int orientation, int touchscreen, int density, int keyboard, int navigation, int inputFlags, int screenWidth, int screenHeight, int sdkVersion, int minorVersion, int screenLayout, int uiMode, int smallestScreenWidthDp, int screenWidthDp, int screenHeightDp, byte[] localeScript, byte[] localeVariant, byte screenLayout2, byte colorMode, short screenConfigPad2, byte[] unknown) -
ResTable_config
public ResTable_config()
-
-
Method Details
-
languageString
Returnslanguageas an unpacked string representation. -
localeScriptString
Returns thelocaleScriptas a string. -
localeVariantString
Returns thelocaleVariantas a string. -
colorModeWideColorGamut
public final int colorModeWideColorGamut()Returns the wide color gamut section ofcolorMode. -
colorModeHdr
public final int colorModeHdr()Returns the HDR section ofcolorMode. -
regionString
Returnscountryas an unpacked string representation. -
scriptString
-
keyboardHidden
public final int keyboardHidden() -
keyboardHidden
public final void keyboardHidden(int value) -
navigationHidden
public final int navigationHidden() -
navigationHidden
public final void navigationHidden(int value) -
withSdkVersion
Returns a copy of this resource configuration with a differentsdkVersion, or this configuration if thesdkVersionis the same.- Parameters:
sdkVersion- The SDK version of the returned configuration.- Returns:
- A copy of this configuration with the only difference being #sdkVersion.
-
screenLayoutDirection
public final int screenLayoutDirection() -
screenLayoutDirection
public final void screenLayoutDirection(int value) -
screenLayoutSize
public final int screenLayoutSize() -
screenLayoutSize
public final void screenLayoutSize(int value) -
screenLayoutLong
public final int screenLayoutLong() -
screenLayoutLong
public final void screenLayoutLong(int value) -
screenLayoutRound
public final int screenLayoutRound() -
screenLayoutRound
public final void screenLayoutRound(int value) -
uiModeType
public final int uiModeType() -
uiModeType
public final void uiModeType(int value) -
uiModeNight
public final int uiModeNight() -
uiModeNight
public final void uiModeNight(int value) -
packLanguage
-
packRegion
-
isDefault
public final boolean isDefault()Returns true if this is the default "any" configuration. -
toString
-
toStringParts
Returns a map of the configuration parts fortoString(). If a configuration part is not defined for thisResTable_config, its value will be the empty string. -
isBetterThan
-
match
-
setBcp47Locale
-