Fixed active speaker conference layout when alone or 2 for foldables + fixed UI issues
This commit is contained in:
parent
36286b0259
commit
98aae5af37
4 changed files with 38 additions and 32 deletions
|
@ -217,7 +217,7 @@ dependencies {
|
||||||
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
|
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
|
||||||
|
|
||||||
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
|
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.0-alpha03'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation "androidx.gridlayout:gridlayout:1.0.0"
|
implementation "androidx.gridlayout:gridlayout:1.0.0"
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.3.0-beta02'
|
implementation 'androidx.recyclerview:recyclerview:1.3.0-beta02'
|
||||||
|
|
||||||
|
|
|
@ -258,6 +258,8 @@ class ConferenceCallFragment : GenericFragment<VoipConferenceCallFragmentBinding
|
||||||
val binding = DataBindingUtil.bind<ViewDataBinding>(inflated)
|
val binding = DataBindingUtil.bind<ViewDataBinding>(inflated)
|
||||||
binding?.lifecycleOwner = viewLifecycleOwner
|
binding?.lifecycleOwner = viewLifecycleOwner
|
||||||
startTimer(R.id.active_conference_timer)
|
startTimer(R.id.active_conference_timer)
|
||||||
|
|
||||||
|
adjustActiveSpeakerLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.stubbedConferenceGridLayout.setOnInflateListener { _, inflated ->
|
binding.stubbedConferenceGridLayout.setOnInflateListener { _, inflated ->
|
||||||
|
@ -304,17 +306,8 @@ class ConferenceCallFragment : GenericFragment<VoipConferenceCallFragmentBinding
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
if (conferenceViewModel.conferenceDisplayMode.value != ConferenceDisplayMode.ACTIVE_SPEAKER)
|
if (conferenceViewModel.conferenceDisplayMode.value == ConferenceDisplayMode.ACTIVE_SPEAKER) {
|
||||||
return
|
adjustActiveSpeakerLayout()
|
||||||
|
|
||||||
if (conferenceViewModel.conferenceCreationPending.value == false) {
|
|
||||||
val participantsCount = conferenceViewModel.conferenceParticipantDevices.value.orEmpty().size
|
|
||||||
Log.i("[Conference Call] Fragment resumed, updating layout for [$participantsCount] participants")
|
|
||||||
when (participantsCount) {
|
|
||||||
1 -> switchToActiveSpeakerLayoutWhenAlone()
|
|
||||||
2 -> switchToActiveSpeakerLayoutForTwoParticipants()
|
|
||||||
else -> switchToActiveSpeakerLayoutForMoreThanTwoParticipants()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,19 +390,39 @@ class ConferenceCallFragment : GenericFragment<VoipConferenceCallFragmentBinding
|
||||||
set.applyTo(constraintLayout)
|
set.applyTo(constraintLayout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun adjustActiveSpeakerLayout() {
|
||||||
|
if (conferenceViewModel.conferenceCreationPending.value == false) {
|
||||||
|
val participantsCount = conferenceViewModel.conferenceParticipantDevices.value.orEmpty().size
|
||||||
|
Log.i("[Conference Call] Updating active speaker layout for [$participantsCount] participants")
|
||||||
|
when (participantsCount) {
|
||||||
|
1 -> switchToActiveSpeakerLayoutWhenAlone()
|
||||||
|
2 -> switchToActiveSpeakerLayoutForTwoParticipants()
|
||||||
|
else -> switchToActiveSpeakerLayoutForMoreThanTwoParticipants()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getConstraintSet(constraintLayout: ConstraintLayout): ConstraintSet {
|
||||||
|
val set = ConstraintSet()
|
||||||
|
set.clone(constraintLayout)
|
||||||
|
|
||||||
|
set.clear(R.id.local_participant_background, ConstraintSet.TOP)
|
||||||
|
set.clear(R.id.local_participant_background, ConstraintSet.START)
|
||||||
|
set.clear(R.id.local_participant_background, ConstraintSet.LEFT)
|
||||||
|
set.clear(R.id.local_participant_background, ConstraintSet.BOTTOM)
|
||||||
|
set.clear(R.id.local_participant_background, ConstraintSet.END)
|
||||||
|
set.clear(R.id.local_participant_background, ConstraintSet.RIGHT)
|
||||||
|
|
||||||
|
return set
|
||||||
|
}
|
||||||
|
|
||||||
private fun switchToActiveSpeakerLayoutForMoreThanTwoParticipants() {
|
private fun switchToActiveSpeakerLayoutForMoreThanTwoParticipants() {
|
||||||
if (conferenceViewModel.conferenceDisplayMode.value != ConferenceDisplayMode.ACTIVE_SPEAKER) return
|
if (conferenceViewModel.conferenceDisplayMode.value != ConferenceDisplayMode.ACTIVE_SPEAKER) return
|
||||||
|
|
||||||
val constraintLayout =
|
val constraintLayout =
|
||||||
binding.root.findViewById<ConstraintLayout>(R.id.conference_constraint_layout)
|
binding.root.findViewById<ConstraintLayout>(R.id.conference_constraint_layout)
|
||||||
?: return
|
?: return
|
||||||
val set = ConstraintSet()
|
val set = getConstraintSet(constraintLayout)
|
||||||
set.clone(constraintLayout)
|
|
||||||
|
|
||||||
set.clear(R.id.local_participant_background, ConstraintSet.TOP)
|
|
||||||
set.clear(R.id.local_participant_background, ConstraintSet.START)
|
|
||||||
set.clear(R.id.local_participant_background, ConstraintSet.BOTTOM)
|
|
||||||
set.clear(R.id.local_participant_background, ConstraintSet.END)
|
|
||||||
|
|
||||||
val margin = resources.getDimension(R.dimen.voip_active_speaker_miniature_margin).toInt()
|
val margin = resources.getDimension(R.dimen.voip_active_speaker_miniature_margin).toInt()
|
||||||
val portraitOrientation = resources.configuration.orientation != Configuration.ORIENTATION_LANDSCAPE
|
val portraitOrientation = resources.configuration.orientation != Configuration.ORIENTATION_LANDSCAPE
|
||||||
|
@ -483,19 +496,13 @@ class ConferenceCallFragment : GenericFragment<VoipConferenceCallFragmentBinding
|
||||||
val constraintLayout =
|
val constraintLayout =
|
||||||
binding.root.findViewById<ConstraintLayout>(R.id.conference_constraint_layout)
|
binding.root.findViewById<ConstraintLayout>(R.id.conference_constraint_layout)
|
||||||
?: return
|
?: return
|
||||||
val set = ConstraintSet()
|
val set = getConstraintSet(constraintLayout)
|
||||||
set.clone(constraintLayout)
|
|
||||||
|
|
||||||
set.clear(R.id.local_participant_background, ConstraintSet.TOP)
|
|
||||||
set.clear(R.id.local_participant_background, ConstraintSet.START)
|
|
||||||
set.clear(R.id.local_participant_background, ConstraintSet.BOTTOM)
|
|
||||||
set.clear(R.id.local_participant_background, ConstraintSet.END)
|
|
||||||
|
|
||||||
val margin = resources.getDimension(R.dimen.voip_active_speaker_miniature_margin).toInt()
|
val margin = resources.getDimension(R.dimen.voip_active_speaker_miniature_margin).toInt()
|
||||||
set.connect(
|
set.connect(
|
||||||
R.id.local_participant_background,
|
R.id.local_participant_background,
|
||||||
ConstraintSet.BOTTOM,
|
ConstraintSet.BOTTOM,
|
||||||
R.id.conference_constraint_layout,
|
R.id.hinge_bottom,
|
||||||
ConstraintSet.BOTTOM,
|
ConstraintSet.BOTTOM,
|
||||||
margin
|
margin
|
||||||
)
|
)
|
||||||
|
@ -532,13 +539,12 @@ class ConferenceCallFragment : GenericFragment<VoipConferenceCallFragmentBinding
|
||||||
val constraintLayout =
|
val constraintLayout =
|
||||||
binding.root.findViewById<ConstraintLayout>(R.id.conference_constraint_layout)
|
binding.root.findViewById<ConstraintLayout>(R.id.conference_constraint_layout)
|
||||||
?: return
|
?: return
|
||||||
val set = ConstraintSet()
|
val set = getConstraintSet(constraintLayout)
|
||||||
set.clone(constraintLayout)
|
|
||||||
|
|
||||||
set.connect(
|
set.connect(
|
||||||
R.id.local_participant_background,
|
R.id.local_participant_background,
|
||||||
ConstraintSet.BOTTOM,
|
ConstraintSet.BOTTOM,
|
||||||
R.id.conference_constraint_layout,
|
R.id.hinge_bottom,
|
||||||
ConstraintSet.BOTTOM,
|
ConstraintSet.BOTTOM,
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
|
|
|
@ -224,7 +224,7 @@
|
||||||
app:layout_constraintTop_toBottomOf="@id/top_barrier"
|
app:layout_constraintTop_toBottomOf="@id/top_barrier"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="@id/hinge_bottom"
|
||||||
android:layout_marginTop="@{controlsViewModel.fullScreenMode ? @dimen/margin_0dp : @dimen/voip_active_speaker_top_margin, default=@dimen/voip_active_speaker_top_margin}"
|
android:layout_marginTop="@{controlsViewModel.fullScreenMode ? @dimen/margin_0dp : @dimen/voip_active_speaker_top_margin, default=@dimen/voip_active_speaker_top_margin}"
|
||||||
android:background="@drawable/shape_remote_background"
|
android:background="@drawable/shape_remote_background"
|
||||||
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}"/>
|
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}"/>
|
||||||
|
|
|
@ -224,7 +224,7 @@
|
||||||
app:layout_constraintTop_toBottomOf="@id/top_barrier"
|
app:layout_constraintTop_toBottomOf="@id/top_barrier"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="@id/hinge_bottom"
|
||||||
android:layout_marginTop="@{controlsViewModel.fullScreenMode ? @dimen/margin_0dp : @dimen/voip_active_speaker_top_margin, default=@dimen/voip_active_speaker_top_margin}"
|
android:layout_marginTop="@{controlsViewModel.fullScreenMode ? @dimen/margin_0dp : @dimen/voip_active_speaker_top_margin, default=@dimen/voip_active_speaker_top_margin}"
|
||||||
android:background="@drawable/shape_remote_background"
|
android:background="@drawable/shape_remote_background"
|
||||||
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}"/>
|
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}"/>
|
||||||
|
|
Loading…
Reference in a new issue