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 class
ResTable_config.Type
The different types of configs that can be present in aResTable_config
. -
Field Summary
Fields Modifier and Type Field Description byte
colorMode
byte[]
country
Returns a packed 2-byte country code.int
density
static int
DENSITY_ANY
static int
DENSITY_DEFAULT
static int
DENSITY_DPI_ANY
static int
DENSITY_DPI_MDPI
static int
DENSITY_DPI_NONE
static int
DENSITY_DPI_UNDEFINED
static int
DENSITY_HIGH
static int
DENSITY_LOW
static int
DENSITY_MEDIUM
static int
DENSITY_NONE
static int
DENSITY_TV
static int
DENSITY_XHIGH
static int
DENSITY_XXHIGH
static int
DENSITY_XXXHIGH
static int
HDR_ANY
static int
HDR_NO
static int
HDR_YES
int
inputFlags
int
keyboard
static int
KEYBOARD_ANY
static byte
KEYSHIDDEN_ANY
static byte
KEYSHIDDEN_NO
static byte
KEYSHIDDEN_SOFT
static byte
KEYSHIDDEN_YES
byte[]
language
Returns a packed 2-byte language code.static int
LAYOUTDIR_ANY
static int
LAYOUTDIR_LTR
static int
LAYOUTDIR_RTL
byte[]
localeScript
The ISO-15924 short name for the script corresponding to this configuration.byte[]
localeVariant
A single BCP-47 variant subtag.static int
MASK_HDR
static int
MASK_KEYSHIDDEN
static int
MASK_LAYOUTDIR
static int
MASK_NAVHIDDEN
static int
MASK_SCREENLONG
static int
MASK_UI_MODE_NIGHT
static int
MASK_UI_MODE_TYPE
static int
MASK_WIDE_COLOR_GAMUT
int
mcc
int
minorVersion
static int
MINORVERSION_ANY
int
mnc
static byte
NAVHIDDEN_ANY
static byte
NAVHIDDEN_NO
static byte
NAVHIDDEN_YES
int
navigation
static int
NAVIGATION_ANY
int
orientation
static int
ORIENTATION_ANY
static int
ORIENTATION_LAND
static int
ORIENTATION_PORT
static int
ORIENTATION_SQUARE
static int
RESTABLE_MAX_LOCALE_LEN
short
screenConfigPad2
int
screenHeight
static int
SCREENHEIGHT_ANY
int
screenHeightDp
int
screenLayout
byte
screenLayout2
An extension toscreenLayout
.static int
SCREENLONG_ANY
static int
SCREENLONG_NO
static int
SCREENLONG_YES
static int
SCREENROUND_ANY
static int
SCREENROUND_NO
static int
SCREENROUND_YES
static int
SCREENSIZE_ANY
static int
SCREENSIZE_LARGE
static int
SCREENSIZE_NORMAL
static int
SCREENSIZE_SMALL
static int
SCREENSIZE_XLARGE
int
screenWidth
static int
SCREENWIDTH_ANY
int
screenWidthDp
int
sdkVersion
static int
SDKVERSION_ANY
static int
SHIFT_LAYOUTDIR
static int
SHIFT_NAVHIDDEN
static int
SHIFT_SCREENLONG
static int
SHIFT_UI_MODE_NIGHT
static int
SIZEOF
int
smallestScreenWidthDp
int
touchscreen
static int
TOUCHSCREEN_ANY
static int
TOUCHSCREEN_FINGER
static int
UI_MODE_NIGHT_ANY
static int
UI_MODE_NIGHT_NO
static int
UI_MODE_TYPE_ANY
static int
UI_MODE_TYPE_NORMAL
int
uiMode
byte[]
unknown
Any remaining bytes in this resource configuration that are unaccounted for.static int
WIDE_COLOR_GAMUT_ANY
static int
WIDE_COLOR_GAMUT_NO
static int
WIDE_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 int
colorModeHdr()
Returns the HDR section ofcolorMode
.int
colorModeWideColorGamut()
Returns the wide color gamut section ofcolorMode
.boolean
isBetterThan(ResTable_config o, ResTable_config requested)
boolean
isDefault()
Returns true if this is the default "any" configuration.int
keyboardHidden()
void
keyboardHidden(int value)
String
languageString()
Returnslanguage
as an unpacked string representation.String
localeScriptString()
Returns thelocaleScript
as a string.String
localeVariantString()
Returns thelocaleVariant
as a string.boolean
match(ResTable_config settings)
int
navigationHidden()
void
navigationHidden(int value)
void
packLanguage(String language)
void
packRegion(String region)
String
regionString()
Returnscountry
as an unpacked string representation.int
screenLayoutDirection()
void
screenLayoutDirection(int value)
int
screenLayoutLong()
void
screenLayoutLong(int value)
int
screenLayoutRound()
void
screenLayoutRound(int value)
int
screenLayoutSize()
void
screenLayoutSize(int value)
String
scriptString()
void
setBcp47Locale(String in)
String
toString()
Map<ResTable_config.Type,String>
toStringParts()
Returns a map of the configuration parts fortoString()
.int
uiModeNight()
void
uiModeNight(int value)
int
uiModeType()
void
uiModeType(int value)
ResTable_config
withSdkVersion(int sdkVersion)
Returns a copy of this resource configuration with a differentsdkVersion
, or this configuration if thesdkVersion
is 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
Returnslanguage
as an unpacked string representation. -
localeScriptString
Returns thelocaleScript
as a string. -
localeVariantString
Returns thelocaleVariant
as 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
Returnscountry
as 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 thesdkVersion
is 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
-