[Calling][Feature] Call/setup screen full width tv (#556)

This commit is contained in:
Adam Hammer 2022-11-02 15:54:53 -07:00 коммит произвёл GitHub
Родитель 2bb7339e54
Коммит bd36a8b254
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 20 добавлений и 10 удалений

Просмотреть файл

@ -30,6 +30,7 @@ import com.azure.android.communication.ui.calling.presentation.navigation.BackNa
import com.azure.android.communication.ui.calling.redux.action.CallingAction
import com.azure.android.communication.ui.calling.redux.state.NavigationStatus
import com.azure.android.communication.ui.calling.utilities.TestHelper
import com.azure.android.communication.ui.calling.utilities.isAndroidTV
import com.microsoft.fluentui.util.activity
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
@ -244,7 +245,12 @@ internal class CallCompositeActivity : AppCompatActivity() {
NavigationStatus.SETUP -> {
notificationService.removeNotification()
supportActionBar?.show()
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
requestedOrientation = if (isAndroidTV(this)) {
ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR
} else {
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}
launchFragment(SetupFragment::class.java.name)
}
else -> {}

Просмотреть файл

@ -31,6 +31,7 @@ import com.azure.android.communication.ui.calling.redux.state.CameraDeviceSelect
import com.azure.android.communication.ui.calling.redux.state.CameraOperationalStatus
import com.azure.android.communication.ui.calling.redux.state.CameraState
import com.azure.android.communication.ui.calling.service.sdk.ext.setTags
import com.azure.android.communication.ui.calling.utilities.isAndroidTV
import java9.util.concurrent.CompletableFuture
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
@ -76,12 +77,6 @@ internal class CallingSDKWrapper(
}
}
private val isAndroidTV by lazy {
val uiModeManager =
context.getSystemService(Context.UI_MODE_SERVICE) as android.app.UiModeManager
uiModeManager.currentModeType == android.content.res.Configuration.UI_MODE_TYPE_TELEVISION
}
override fun getRemoteParticipantsMap(): Map<String, RemoteParticipant> =
callingSDKEventHandler.getRemoteParticipantsMap().mapValues { it.value.into() }
@ -246,7 +241,7 @@ internal class CallingSDKWrapper(
}
override fun switchCameraAsync(): CompletableFuture<CameraDeviceSelectionStatus> {
return if (isAndroidTV) {
return if (isAndroidTV(context)) {
switchCameraAsyncAndroidTV()
} else {
switchCameraAsyncMobile()
@ -279,7 +274,7 @@ internal class CallingSDKWrapper(
localVideoStreamCompletableFuture.completeExceptionally(error)
result.completeExceptionally(error)
} else {
val desiredCamera = if (isAndroidTV) {
val desiredCamera = if (isAndroidTV(context)) {
getCameraByFacingTypeSelection()
} else {
getCamera(CameraFacing.FRONT)
@ -396,7 +391,7 @@ internal class CallingSDKWrapper(
private fun completeCamerasInitializedCompletableFuture() {
camerasCountStateFlow.value =
getDeviceManagerCompletableFuture().get().cameras.size
if ((isAndroidTV && cameraExist()) || doFrontAndBackCamerasExist()) {
if ((isAndroidTV(context) && cameraExist()) || doFrontAndBackCamerasExist()) {
camerasInitializedCompletableFuture?.complete(null)
}
}

Просмотреть файл

@ -0,0 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.android.communication.ui.calling.utilities
import android.content.Context
internal fun isAndroidTV(context: Context) =
(context.getSystemService(Context.UI_MODE_SERVICE) as android.app.UiModeManager).currentModeType == android.content.res.Configuration.UI_MODE_TYPE_TELEVISION