Добавили возможность получения больше о физическом состоянии складного устройства. Новое API WindowInfoTracker.supportedPostures позволит понять поддерживает ли устройство режим tabletop (устройство частично сложено, складной экран разделён на 2 зоны)
val currentSdkVersion = WindowSdkExtensions.getInstance().extensionVersion
val message =
if (currentSdkVersion >= 6) {
val supportedPostures = WindowInfoTracker.getOrCreate(LocalContext.current).supportedPostures
buildString {
append(supportedPostures.isNotEmpty())
if (supportedPostures.isNotEmpty()) {
append(" ")
append(
supportedPostures.joinToString(
separator = ",", prefix = "(", postfix = ")"))
}
}
} else {
"N/A (WindowSDK version 6 is needed, current version is $currentSdkVersion)"
}
#jetpack #android #foldable