Configuration
摘要
Typedefs |
|
---|---|
AConfiguration
|
typedefstruct AConfiguration
AConfiguration 是一个不透明类型,用于获取和设置各种子系统配置。 |
函数 |
|
---|---|
AConfiguration_copy(AConfiguration *dest, AConfiguration *src)
|
void
将 'src' 的内容复制到 'dest'。
|
AConfiguration_delete(AConfiguration *config)
|
void
释放之前使用 AConfiguration_new() 创建的 AConfiguration。
|
AConfiguration_diff(AConfiguration *config1, AConfiguration *config2)
|
int32_t
对两个配置执行差异比较。
|
AConfiguration_fromAssetManager(AConfiguration *out, AAssetManager *am)
|
void
根据给定 AAssetManager 中正在使用的当前配置创建并返回新的 AConfiguration。
|
AConfiguration_getCountry(AConfiguration *config, char *outCountry)
|
void
返回配置中设置的当前国家/地区代码。
|
AConfiguration_getDensity(AConfiguration *config)
|
int32_t
返回配置中设置的当前 ACONFIGURATION_DENSITY_*。
|
AConfiguration_getGrammaticalGender(AConfiguration *config)
|
int32_t
返回配置的语法性别,如果未设置则返回 ACONFIGURATION_GRAMMATICAL_GENDER_ANY。
|
AConfiguration_getKeyboard(AConfiguration *config)
|
int32_t
返回配置中设置的当前 ACONFIGURATION_KEYBOARD_*。
|
AConfiguration_getKeysHidden(AConfiguration *config)
|
int32_t
返回配置中设置的当前 ACONFIGURATION_KEYSHIDDEN_*。
|
AConfiguration_getLanguage(AConfiguration *config, char *outLanguage)
|
void
返回配置中设置的当前语言代码。
|
AConfiguration_getLayoutDirection(AConfiguration *config)
|
int32_t
返回配置的布局方向,如果未设置则返回 ACONFIGURATION_LAYOUTDIR_ANY。
|
AConfiguration_getMcc(AConfiguration *config)
|
int32_t
返回配置中设置的当前 MCC。
|
AConfiguration_getMnc(AConfiguration *config)
|
int32_t
返回配置中设置的当前 MNC。
|
AConfiguration_getNavHidden(AConfiguration *config)
|
int32_t
返回配置中设置的当前 ACONFIGURATION_NAVHIDDEN_*。
|
AConfiguration_getNavigation(AConfiguration *config)
|
int32_t
返回配置中设置的当前 ACONFIGURATION_NAVIGATION_*。
|
AConfiguration_getOrientation(AConfiguration *config)
|
int32_t
返回配置中设置的当前 ACONFIGURATION_ORIENTATION_*。
|
AConfiguration_getScreenHeightDp(AConfiguration *config)
|
int32_t
返回配置中当前的屏幕高度(以 dp 为单位),如果未设置则返回 ACONFIGURATION_SCREEN_HEIGHT_DP_ANY。
|
AConfiguration_getScreenLong(AConfiguration *config)
|
int32_t
返回配置中设置的当前 ACONFIGURATION_SCREENLONG_*。
|
AConfiguration_getScreenRound(AConfiguration *config)
|
int32_t
返回配置中设置的当前 ACONFIGURATION_SCREENROUND_*。
|
AConfiguration_getScreenSize(AConfiguration *config)
|
int32_t
返回配置中设置的当前 ACONFIGURATION_SCREENSIZE_*。
|
AConfiguration_getScreenWidthDp(AConfiguration *config)
|
int32_t
返回配置中当前的屏幕宽度(以 dp 为单位),如果未设置则返回 ACONFIGURATION_SCREEN_WIDTH_DP_ANY。
|
AConfiguration_getSdkVersion(AConfiguration *config)
|
int32_t
返回配置中设置的当前 SDK (API) 版本。
|
AConfiguration_getSmallestScreenWidthDp(AConfiguration *config)
|
int32_t
返回配置的最小屏幕宽度(以 dp 为单位),如果未设置则返回 ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY。
|
AConfiguration_getTouchscreen(AConfiguration *config)
|
int32_t
返回配置中设置的当前 ACONFIGURATION_TOUCHSCREEN_*。
|
AConfiguration_getUiModeNight(AConfiguration *config)
|
int32_t
返回配置中设置的当前 ACONFIGURATION_UI_MODE_NIGHT_*。
|
AConfiguration_getUiModeType(AConfiguration *config)
|
int32_t
返回配置中设置的当前 ACONFIGURATION_UI_MODE_TYPE_*。
|
AConfiguration_isBetterThan(AConfiguration *base, AConfiguration *test, AConfiguration *requested)
|
int32_t
确定 'test' 中的配置是否优于 'base' 中现有配置。
|
AConfiguration_match(AConfiguration *base, AConfiguration *requested)
|
int32_t
确定 'base' 是否是 'requested' 环境中使用的有效配置。
|
AConfiguration_new()
|
创建新的 AConfiguration,初始化时未设置任何值。
|
AConfiguration_setCountry(AConfiguration *config, const char *country)
|
void
根据字符串的前两个字符,设置配置中的当前国家/地区代码。
|
AConfiguration_setDensity(AConfiguration *config, int32_t density)
|
void
设置配置中的当前密度。
|
AConfiguration_setGrammaticalGender(AConfiguration *config, int32_t value)
|
void
将配置的语法性别设置为 ACONFIGURATION_GRAMMATICAL_GENDER_* 常量之一。
|
AConfiguration_setKeyboard(AConfiguration *config, int32_t keyboard)
|
void
设置配置中的当前键盘。
|
AConfiguration_setKeysHidden(AConfiguration *config, int32_t keysHidden)
|
void
设置配置中的当前隐藏键。
|
AConfiguration_setLanguage(AConfiguration *config, const char *language)
|
void
根据字符串的前两个字符,设置配置中的当前语言代码。
|
AConfiguration_setLayoutDirection(AConfiguration *config, int32_t value)
|
void
设置配置的布局方向。
|
AConfiguration_setMcc(AConfiguration *config, int32_t mcc)
|
void
设置配置中的当前 MCC。
|
AConfiguration_setMnc(AConfiguration *config, int32_t mnc)
|
void
设置配置中的当前 MNC。
|
AConfiguration_setNavHidden(AConfiguration *config, int32_t navHidden)
|
void
设置配置中的当前导航隐藏状态。
|
AConfiguration_setNavigation(AConfiguration *config, int32_t navigation)
|
void
设置配置中的当前导航类型。
|
AConfiguration_setOrientation(AConfiguration *config, int32_t orientation)
|
void
设置配置中的当前方向。
|
AConfiguration_setScreenHeightDp(AConfiguration *config, int32_t value)
|
void
设置配置中当前的屏幕高度(以 dp 为单位)。
|
AConfiguration_setScreenLong(AConfiguration *config, int32_t screenLong)
|
void
设置配置中的当前屏幕长宽比。
|
AConfiguration_setScreenRound(AConfiguration *config, int32_t screenRound)
|
void
设置配置中的当前圆角屏幕状态。
|
AConfiguration_setScreenSize(AConfiguration *config, int32_t screenSize)
|
void
设置配置中的当前屏幕尺寸。
|
AConfiguration_setScreenWidthDp(AConfiguration *config, int32_t value)
|
void
设置配置中当前的屏幕高度(以 dp 为单位)。
|
AConfiguration_setSdkVersion(AConfiguration *config, int32_t sdkVersion)
|
void
设置配置中的当前 SDK 版本。
|
AConfiguration_setSmallestScreenWidthDp(AConfiguration *config, int32_t value)
|
void
设置配置的最小屏幕宽度(以 dp 为单位)。
|
AConfiguration_setTouchscreen(AConfiguration *config, int32_t touchscreen)
|
void
设置配置中的当前触摸屏类型。
|
AConfiguration_setUiModeNight(AConfiguration *config, int32_t uiModeNight)
|
void
设置配置中的当前 UI 夜间模式。
|
AConfiguration_setUiModeType(AConfiguration *config, int32_t uiModeType)
|
void
设置配置中的当前 UI 模式类型。
|
枚举
匿名枚举 24
在android/configuration.h
中声明
Anonymous Enum 24
定义各种子系统配置的标志和常量。
Typedefs
AConfiguration
在android/configuration.h
中声明
struct AConfiguration AConfiguration
AConfiguration 是一个不透明类型,用于获取和设置各种子系统配置。
可以使用以下函数获取 AConfiguration 指针:
函数
AConfiguration_copy
在android/configuration.h
中声明
void AConfiguration_copy( AConfiguration *dest, AConfiguration *src )
将 'src' 的内容复制到 'dest'。
AConfiguration_delete
在android/configuration.h
中声明
void AConfiguration_delete( AConfiguration *config )
释放之前使用 AConfiguration_new() 创建的 AConfiguration。
AConfiguration_diff
在android/configuration.h
中声明
int32_t AConfiguration_diff( AConfiguration *config1, AConfiguration *config2 )
对两个配置执行差异比较。
返回 ACONFIGURATION_* 常量的位掩码,设置的每个位表示相应的配置元素在两个配置之间不同。
AConfiguration_fromAssetManager
在android/configuration.h
中声明
void AConfiguration_fromAssetManager( AConfiguration *out, AAssetManager *am )
根据给定 AAssetManager 中正在使用的当前配置创建并返回新的 AConfiguration。
AConfiguration_getCountry
在android/configuration.h
中声明
void AConfiguration_getCountry( AConfiguration *config, char *outCountry )
返回配置中设置的当前国家/地区代码。
输出将填充一个包含两个字符的数组。它们不是以 null 结尾的。如果未设置国家/地区,它们将为 0。
AConfiguration_getDensity
在android/configuration.h
中声明
int32_t AConfiguration_getDensity( AConfiguration *config )
返回配置中设置的当前 ACONFIGURATION_DENSITY_*。
AConfiguration_getGrammaticalGender
在android/configuration.h
中声明
int32_t AConfiguration_getGrammaticalGender( AConfiguration *config )
返回配置的语法性别,如果未设置则返回 ACONFIGURATION_GRAMMATICAL_GENDER_ANY。
自 API 级别 34 起可用。
AConfiguration_getKeyboard
在android/configuration.h
中声明
int32_t AConfiguration_getKeyboard( AConfiguration *config )
返回配置中设置的当前 ACONFIGURATION_KEYBOARD_*。
AConfiguration_getKeysHidden
在android/configuration.h
中声明
int32_t AConfiguration_getKeysHidden( AConfiguration *config )
返回配置中设置的当前 ACONFIGURATION_KEYSHIDDEN_*。
AConfiguration_getLanguage
在android/configuration.h
中声明
void AConfiguration_getLanguage( AConfiguration *config, char *outLanguage )
返回配置中设置的当前语言代码。
输出将填充一个包含两个字符的数组。它们不是以 null 结尾的。如果未设置语言,它们将为 0。
AConfiguration_getLayoutDirection
在android/configuration.h
中声明
int32_t AConfiguration_getLayoutDirection( AConfiguration *config )
返回配置的布局方向,如果未设置则返回 ACONFIGURATION_LAYOUTDIR_ANY。
自 API 级别 17 起可用。
AConfiguration_getMcc
在android/configuration.h
中声明
int32_t AConfiguration_getMcc( AConfiguration *config )
返回配置中设置的当前 MCC。
如果未设置,则为 0。
AConfiguration_getMnc
在android/configuration.h
中声明
int32_t AConfiguration_getMnc( AConfiguration *config )
返回配置中设置的当前 MNC。
如果未设置,则为 0。
AConfiguration_getNavHidden
在android/configuration.h
中声明
int32_t AConfiguration_getNavHidden( AConfiguration *config )
返回配置中设置的当前 ACONFIGURATION_NAVHIDDEN_*。
AConfiguration_getNavigation
在android/configuration.h
中声明
int32_t AConfiguration_getNavigation( AConfiguration *config )
返回配置中设置的当前 ACONFIGURATION_NAVIGATION_*。
AConfiguration_getOrientation
在android/configuration.h
中声明
int32_t AConfiguration_getOrientation( AConfiguration *config )
返回配置中设置的当前 ACONFIGURATION_ORIENTATION_*。
AConfiguration_getScreenHeightDp
在android/configuration.h
中声明
int32_t AConfiguration_getScreenHeightDp( AConfiguration *config )
返回配置中当前的屏幕高度(以 dp 为单位),如果未设置则返回 ACONFIGURATION_SCREEN_HEIGHT_DP_ANY。
AConfiguration_getScreenLong
在android/configuration.h
中声明
int32_t AConfiguration_getScreenLong( AConfiguration *config )
返回配置中设置的当前 ACONFIGURATION_SCREENLONG_*。
AConfiguration_getScreenRound
在android/configuration.h
中声明
int32_t AConfiguration_getScreenRound( AConfiguration *config )
返回配置中设置的当前 ACONFIGURATION_SCREENROUND_*。
自 API 级别 30 起可用。
AConfiguration_getScreenSize
在android/configuration.h
中声明
int32_t AConfiguration_getScreenSize( AConfiguration *config )
返回配置中设置的当前 ACONFIGURATION_SCREENSIZE_*。
AConfiguration_getScreenWidthDp
在android/configuration.h
中声明
int32_t AConfiguration_getScreenWidthDp( AConfiguration *config )
返回配置中当前的屏幕宽度(以 dp 为单位),如果未设置则返回 ACONFIGURATION_SCREEN_WIDTH_DP_ANY。
AConfiguration_getSdkVersion
在android/configuration.h
中声明
int32_t AConfiguration_getSdkVersion( AConfiguration *config )
返回配置中设置的当前 SDK (API) 版本。
AConfiguration_getSmallestScreenWidthDp
在android/configuration.h
中声明
int32_t AConfiguration_getSmallestScreenWidthDp( AConfiguration *config )
返回配置的最小屏幕宽度(以 dp 为单位),如果未设置则返回 ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY。
AConfiguration_getTouchscreen
在android/configuration.h
中声明
int32_t AConfiguration_getTouchscreen( AConfiguration *config )
返回配置中设置的当前 ACONFIGURATION_TOUCHSCREEN_*。
AConfiguration_getUiModeNight
在android/configuration.h
中声明
int32_t AConfiguration_getUiModeNight( AConfiguration *config )
返回配置中设置的当前 ACONFIGURATION_UI_MODE_NIGHT_*。
AConfiguration_getUiModeType
在android/configuration.h
中声明
int32_t AConfiguration_getUiModeType( AConfiguration *config )
返回配置中设置的当前 ACONFIGURATION_UI_MODE_TYPE_*。
AConfiguration_isBetterThan
在android/configuration.h
中声明
int32_t AConfiguration_isBetterThan( AConfiguration *base, AConfiguration *test, AConfiguration *requested )
确定 'test' 中的配置是否优于 'base' 中现有配置。
如果 'requested' 非 NULL,则此决策基于其中给定的整体配置。如果为 NULL,则此决策仅基于哪个配置更具体。如果 'test' 优于 'base',则返回非 0。
这假设您已经使用 AConfiguration_match() 过滤了配置。
AConfiguration_match
在android/configuration.h
中声明
int32_t AConfiguration_match( AConfiguration *base, AConfiguration *requested )
确定 'base' 是否是 'requested' 环境中使用的有效配置。
如果 'base' 中有任何值与 'requested' 冲突,则返回 0。如果不冲突,则返回 1。
AConfiguration_new
在android/configuration.h
中声明
AConfiguration * AConfiguration_new()
创建新的 AConfiguration,初始化时未设置任何值。
AConfiguration_setCountry
在android/configuration.h
中声明
void AConfiguration_setCountry( AConfiguration *config, const char *country )
根据字符串的前两个字符,设置配置中的当前国家/地区代码。
AConfiguration_setDensity
在android/configuration.h
中声明
void AConfiguration_setDensity( AConfiguration *config, int32_t density )
设置配置中的当前密度。
AConfiguration_setGrammaticalGender
在android/configuration.h
中声明
void AConfiguration_setGrammaticalGender( AConfiguration *config, int32_t value )
将配置的语法性别设置为 ACONFIGURATION_GRAMMATICAL_GENDER_* 常量之一。
自 API 级别 34 起可用。
AConfiguration_setKeyboard
在android/configuration.h
中声明
void AConfiguration_setKeyboard( AConfiguration *config, int32_t keyboard )
设置配置中的当前键盘。
AConfiguration_setKeysHidden
在android/configuration.h
中声明
void AConfiguration_setKeysHidden( AConfiguration *config, int32_t keysHidden )
设置配置中的当前隐藏键。
AConfiguration_setLanguage
在android/configuration.h
中声明
void AConfiguration_setLanguage( AConfiguration *config, const char *language )
根据字符串的前两个字符,设置配置中的当前语言代码。
AConfiguration_setLayoutDirection
在android/configuration.h
中声明
void AConfiguration_setLayoutDirection( AConfiguration *config, int32_t value )
设置配置的布局方向。
自 API 级别 17 起可用。
AConfiguration_setMcc
在android/configuration.h
中声明
void AConfiguration_setMcc( AConfiguration *config, int32_t mcc )
设置配置中的当前 MCC。
设置为 0 以清除。
AConfiguration_setMnc
在android/configuration.h
中声明
void AConfiguration_setMnc( AConfiguration *config, int32_t mnc )
设置配置中的当前 MNC。
设置为 0 以清除。
AConfiguration_setNavHidden
在android/configuration.h
中声明
void AConfiguration_setNavHidden( AConfiguration *config, int32_t navHidden )
设置配置中的当前导航隐藏状态。
AConfiguration_setNavigation
在android/configuration.h
中声明
void AConfiguration_setNavigation( AConfiguration *config, int32_t navigation )
设置配置中的当前导航类型。
AConfiguration_setOrientation
在android/configuration.h
中声明
void AConfiguration_setOrientation( AConfiguration *config, int32_t orientation )
设置配置中的当前方向。
AConfiguration_setScreenHeightDp
在android/configuration.h
中声明
void AConfiguration_setScreenHeightDp( AConfiguration *config, int32_t value )
设置配置中当前的屏幕高度(以 dp 为单位)。
AConfiguration_setScreenLong
在android/configuration.h
中声明
void AConfiguration_setScreenLong( AConfiguration *config, int32_t screenLong )
设置配置中的当前屏幕长宽比。
AConfiguration_setScreenRound
在android/configuration.h
中声明
void AConfiguration_setScreenRound( AConfiguration *config, int32_t screenRound )
设置配置中的当前圆角屏幕状态。
AConfiguration_setScreenSize
在android/configuration.h
中声明
void AConfiguration_setScreenSize( AConfiguration *config, int32_t screenSize )
设置配置中的当前屏幕尺寸。
AConfiguration_setScreenWidthDp
在android/configuration.h
中声明
void AConfiguration_setScreenWidthDp( AConfiguration *config, int32_t value )
设置配置中当前的屏幕高度(以 dp 为单位)。
AConfiguration_setSdkVersion
在android/configuration.h
中声明
void AConfiguration_setSdkVersion( AConfiguration *config, int32_t sdkVersion )
设置配置中的当前 SDK 版本。
AConfiguration_setSmallestScreenWidthDp
在android/configuration.h
中声明
void AConfiguration_setSmallestScreenWidthDp( AConfiguration *config, int32_t value )
设置配置的最小屏幕宽度(以 dp 为单位)。
AConfiguration_setTouchscreen
在android/configuration.h
中声明
void AConfiguration_setTouchscreen( AConfiguration *config, int32_t touchscreen )
设置配置中的当前触摸屏类型。
AConfiguration_setUiModeNight
在android/configuration.h
中声明
void AConfiguration_setUiModeNight( AConfiguration *config, int32_t uiModeNight )
设置配置中的当前 UI 夜间模式。
AConfiguration_setUiModeType
在android/configuration.h
中声明
void AConfiguration_setUiModeType( AConfiguration *config, int32_t uiModeType )
设置配置中的当前 UI 模式类型。