Диалоговое окно отображается, когда значение DialogUiState не равно нулю.
Код: Выделить всё
if (DeviceUtils.isTablet(this) && dialogUiState != null) {
requestedOrientation = (ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT)
}
Код: Выделить всё
object DeviceUtils {
@JvmStatic
fun isTablet(context: Context): Boolean {
val configuration = context.resources.configuration
val screenLayoutSize = configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK
return screenLayoutSize > Configuration.SCREENLAYOUT_SIZE_NORMAL
}
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... et-android