in azure-communication-ui/calling/src/main/java/com/azure/android/communication/ui/calling/presentation/fragment/calling/CallingFragment.kt [113:266]
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewModel.init(viewLifecycleOwner.lifecycleScope)
callScreenLayout = view.findViewById(R.id.azure_communication_ui_calling_call_frame_layout)
confirmLeaveOverlayView =
LeaveConfirmView(viewModel.confirmLeaveOverlayViewModel, this.requireContext())
confirmLeaveOverlayView.layoutDirection =
activity?.window?.decorView?.layoutDirection ?: View.LAYOUT_DIRECTION_LOCALE
confirmLeaveOverlayView.start(
viewLifecycleOwner
)
controlBarView = view.findViewById(R.id.azure_communication_ui_call_call_buttons)
controlBarView.start(viewLifecycleOwner, viewModel.controlBarViewModel)
participantGridView =
view.findViewById(R.id.azure_communication_ui_call_participant_container)
participantGridView.start(
viewModel.participantGridViewModel,
videoViewManager,
viewLifecycleOwner,
this::switchFloatingHeader,
avatarViewManager
)
connectingLobbyOverlay = view.findViewById(R.id.azure_communication_ui_call_connecting_lobby_overlay)
connectingLobbyOverlay.start(viewLifecycleOwner, viewModel.connectingLobbyOverlayViewModel)
waitingLobbyOverlay = view.findViewById(R.id.azure_communication_ui_call_lobby_overlay)
waitingLobbyOverlay.start(viewLifecycleOwner, viewModel.waitingLobbyOverlayViewModel)
holdOverlay = view.findViewById(R.id.azure_communication_ui_call_hold_overlay)
holdOverlay.start(viewLifecycleOwner, viewModel.holdOverlayViewModel)
localParticipantView = view.findViewById(R.id.azure_communication_ui_call_local_user_view)
localParticipantView.start(
viewLifecycleOwner,
viewModel.localParticipantViewModel,
videoViewManager,
avatarViewManager,
)
accessibilityManager =
context?.applicationContext?.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
infoHeaderView = view.findViewById(R.id.azure_communication_ui_call_floating_header)
infoHeaderView.start(
viewLifecycleOwner,
viewModel.floatingHeaderViewModel,
this::displayParticipantList,
)
lobbyHeaderView = view.findViewById(R.id.azure_communication_ui_calling_lobby_header)
lobbyHeaderView.start(
viewLifecycleOwner,
viewModel.lobbyHeaderViewModel,
this::displayParticipantList
)
lobbyErrorHeaderView = view.findViewById(R.id.azure_communication_ui_calling_lobby_error_header)
lobbyErrorHeaderView.start(
viewLifecycleOwner,
viewModel.lobbyErrorHeaderViewModel
)
upperMessageBarNotificationLayoutView = view.findViewById(R.id.azure_communication_ui_calling_upper_message_bar_notifications_layout)
upperMessageBarNotificationLayoutView.start(
viewLifecycleOwner,
viewModel.upperMessageBarNotificationLayoutViewModel,
)
toastNotificationView = view.findViewById(R.id.azure_communication_ui_calling_toast_notification)
toastNotificationView.start(
viewLifecycleOwner,
viewModel.toastNotificationViewModel,
)
audioDeviceListView =
AudioDeviceListView(viewModel.audioDeviceListViewModel, this.requireContext())
audioDeviceListView.layoutDirection =
activity?.window?.decorView?.layoutDirection ?: View.LAYOUT_DIRECTION_LOCALE
audioDeviceListView.start(viewLifecycleOwner)
participantListView = ParticipantListView(
viewModel.participantListViewModel,
this.requireContext(),
avatarViewManager,
)
participantListView.layoutDirection =
activity?.window?.decorView?.layoutDirection ?: View.LAYOUT_DIRECTION_LOCALE
participantListView.start(viewLifecycleOwner)
participantMenuView = ParticipantMenuView(
this.requireContext(),
viewModel.participantMenuViewModel,
)
participantMenuView.layoutDirection =
activity?.window?.decorView?.layoutDirection ?: View.LAYOUT_DIRECTION_LOCALE
participantMenuView.start(viewLifecycleOwner)
bannerView = view.findViewById(R.id.azure_communication_ui_call_banner)
bannerView.start(
viewModel.bannerViewModel,
viewLifecycleOwner,
)
participantGridView.setOnClickListener {
switchFloatingHeader()
}
errorInfoView = ErrorInfoView(view)
errorInfoView.start(viewLifecycleOwner, viewModel.errorInfoViewModel)
moreCallOptionsListView = MoreCallOptionsListView(
this.requireContext(),
viewModel.moreCallOptionsListViewModel
)
moreCallOptionsListView.layoutDirection =
activity?.window?.decorView?.layoutDirection ?: View.LAYOUT_DIRECTION_LOCALE
moreCallOptionsListView.start(viewLifecycleOwner)
captionsListView = CaptionsListView(
context = this.requireContext(),
viewModel = viewModel.captionsListViewModel,
)
captionsListView.layoutDirection =
activity?.window?.decorView?.layoutDirection ?: View.LAYOUT_DIRECTION_LOCALE
captionsListView.start(viewLifecycleOwner)
captionsLanguageSelectionListView = CaptionsLanguageSelectionListView(
context = this.requireContext(),
viewModel = viewModel.captionsLanguageSelectionListViewModel
)
captionsLanguageSelectionListView.layoutDirection =
activity?.window?.decorView?.layoutDirection ?: View.LAYOUT_DIRECTION_LOCALE
val displayMetrics = DisplayMetrics()
requireActivity().windowManager.defaultDisplay.getMetrics(displayMetrics)
val halfScreenHeight = displayMetrics.heightPixels / 2
captionsLanguageSelectionListView.start(viewLifecycleOwner, halfScreenHeight)
captionsTopAnchor = view.findViewById(R.id.captions_top_anchor)
captionsBottomAnchor = view.findViewById(R.id.captions_bottom_anchor)
captionsWrapper = view.findViewById(R.id.azure_communication_ui_calling_captions_view_wrapper)
captionsOverlay = view.findViewById(R.id.azure_communication_ui_calling_captions_overlay)
captionsRttView = view.findViewById(R.id.azure_communication_ui_calling_captions_linear_layout)
captionsRttView.start(
viewLifecycleOwner = viewLifecycleOwner,
viewModel = viewModel.captionsLayoutViewModel,
maximizeCallback = this::maximizeCaptions,
minimizeCallback = this::minimizeCaptions
)
captionsOverlay.setOnClickListener { viewModel.minimizeCaptions() }
}