Reworked conference layouts to use constraintlayout

This commit is contained in:
Sylvain Berfini 2022-06-16 16:48:50 +02:00
parent 86cba063d1
commit b611f6c0ed
8 changed files with 164 additions and 75 deletions

View file

@ -25,7 +25,7 @@ import android.os.Bundle
import android.os.SystemClock
import android.view.View
import android.widget.Chronometer
import android.widget.RelativeLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.navigation.navGraphViewModels
@ -88,7 +88,7 @@ class ConferenceCallFragment : GenericFragment<VoipConferenceCallFragmentBinding
if (conferenceViewModel.conferenceExists.value == true) {
Log.i("[Conference Call] Local participant is in conference and current layout is active speaker, updating Core's native window id")
val layout =
binding.root.findViewById<RelativeLayout>(R.id.conference_active_speaker_layout)
binding.root.findViewById<ConstraintLayout>(R.id.conference_active_speaker_layout)
val window =
layout?.findViewById<RoundCornersTextureView>(R.id.conference_active_speaker_remote_video)
coreContext.core.nativeVideoWindowId = window
@ -320,8 +320,11 @@ class ConferenceCallFragment : GenericFragment<VoipConferenceCallFragmentBinding
}
private fun updateHingeRelatedConstraints(state: FoldingFeature.State) {
Log.i("[Conference Call] Updating constraint layout hinges")
/*val constraintLayout = binding.constraintLayout
Log.i("[Conference Call] Updating constraint layout hinges: $state")
/*val constraintLayout =
binding.root.findViewById<ConstraintLayout>(R.id.conference_active_speaker_layout)
constraintLayout ?: return
val set = ConstraintSet()
set.clone(constraintLayout)

View file

@ -260,7 +260,7 @@ class SingleCallFragment : GenericFragment<VoipSingleCallFragmentBinding>() {
}
private fun updateHingeRelatedConstraints(state: FoldingFeature.State) {
Log.i("[Single Call] Updating constraint layout hinges")
Log.i("[Single Call] Updating constraint layout hinges: $state")
/*val constraintLayout = binding.constraintLayout
val set = ConstraintSet()
set.clone(constraintLayout)

View file

@ -19,36 +19,51 @@
type="Integer" />
</data>
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? @dimen/voip_remote_margin_full_screen : @dimen/voip_remote_margin, default=@dimen/voip_remote_margin}"
android:visibility="@{inflatedVisibility}"
android:gravity="center"
android:orientation="vertical">
android:visibility="@{inflatedVisibility}">
<include
android:id="@+id/header"
layout="@layout/voip_conference_header"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? View.GONE : View.VISIBLE}"
app:conferenceViewModel="@{conferenceViewModel}" />
<include
android:id="@+id/remote_recording"
layout="@layout/voip_remote_recording"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/header"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="@{conferenceViewModel.isRemotelyRecorded ? View.VISIBLE : View.GONE, default=gone}" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/top_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="header, remote_recording"/>
<org.linphone.activities.voip.views.GridBoxLayout
centerContent="@{true}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/top_barrier"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="10dp"
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}"
app:entries="@{conferenceViewModel.conferenceParticipantDevices}"
app:layout="@{@layout/voip_conference_participant_remote_grid}" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -19,76 +19,115 @@
type="Integer" />
</data>
<RelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? @dimen/voip_remote_margin_full_screen : @dimen/voip_remote_margin, default=@dimen/voip_remote_margin}"
android:visibility="@{inflatedVisibility}">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/hinge_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/hinge_bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="1" />
<include
android:id="@+id/header"
layout="@layout/voip_conference_header"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? View.GONE : View.VISIBLE}"
app:conferenceViewModel="@{conferenceViewModel}" />
<include
android:id="@+id/remote_recording"
layout="@layout/voip_remote_recording"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/header"
app:layout_constraintTop_toBottomOf="@id/header"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="@{conferenceViewModel.isRemotelyRecorded ? View.VISIBLE : View.GONE, default=gone}" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/miniatures"
android:layout_below="@id/remote_recording"
<androidx.constraintlayout.widget.Barrier
android:id="@+id/top_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="header, remote_recording"/>
<View
android:id="@+id/active_speaker_background"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/top_barrier"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/bottom_barrier"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_remote_background"
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}">
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}"/>
<ImageView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="10dp"
android:contentDescription="@null"
coilVoipContact="@{conferenceViewModel.speakingParticipant}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_max="@dimen/voip_contact_avatar_max_size"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_max="@dimen/voip_contact_avatar_max_size" />
<ImageView
android:id="@+id/speaking_participant_avatar"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="10dp"
android:contentDescription="@null"
coilVoipContact="@{conferenceViewModel.speakingParticipant}"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toTopOf="@id/bottom_barrier"
app:layout_constraintEnd_toEndOf="@id/active_speaker_background"
app:layout_constraintHeight_max="@dimen/voip_contact_avatar_max_size"
app:layout_constraintStart_toStartOf="@id/active_speaker_background"
app:layout_constraintTop_toBottomOf="@id/top_barrier"
app:layout_constraintWidth_max="@dimen/voip_contact_avatar_max_size" />
<org.linphone.activities.voip.views.RoundCornersTextureView
android:id="@+id/conference_active_speaker_remote_video"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="@{!conferenceViewModel.isConferenceLocallyPaused &amp;&amp; conferenceViewModel.speakingParticipant.videoEnabled ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<org.linphone.activities.voip.views.RoundCornersTextureView
android:id="@+id/conference_active_speaker_remote_video"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="@{!conferenceViewModel.isConferenceLocallyPaused &amp;&amp; conferenceViewModel.speakingParticipant.videoEnabled ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf="@id/active_speaker_background"
app:layout_constraintEnd_toEndOf="@id/active_speaker_background"
app:layout_constraintStart_toStartOf="@id/active_speaker_background"
app:layout_constraintTop_toTopOf="@id/active_speaker_background" />
<TextView
style="@style/call_remote_name_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginBottom="10dp"
android:text="@{conferenceViewModel.speakingParticipant.contact.name ?? conferenceViewModel.speakingParticipant.displayName}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/speaking_participant_name"
style="@style/call_remote_name_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginBottom="10dp"
android:text="@{conferenceViewModel.speakingParticipant.contact.name ?? conferenceViewModel.speakingParticipant.displayName}"
app:layout_constraintBottom_toBottomOf="@id/active_speaker_background"
app:layout_constraintStart_toStartOf="@id/active_speaker_background" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/bottom_barrier"
android:layout_width="0dp"
android:layout_height="0dp"
app:barrierDirection="top"
app:constraint_referenced_ids="hinge_bottom, miniatures" />
<HorizontalScrollView
android:id="@+id/miniatures"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="@dimen/voip_active_speaker_miniature_size"
android:layout_above="@id/scroll_indicator"
android:layout_marginTop="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/scroll_indicator"
android:scrollbars="none">
<com.google.android.flexbox.FlexboxLayout
@ -107,8 +146,9 @@
android:id="@+id/scroll_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
app:dotColor="@color/voip_gray_dots"
@ -118,6 +158,6 @@
app:selectedDot="@{0}"
app:selectedDotColor="@color/voip_dark_gray" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -19,7 +19,7 @@
type="Integer" />
</data>
<RelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? @dimen/voip_remote_margin_full_screen : @dimen/voip_remote_margin, default=@dimen/voip_remote_margin}"
@ -28,27 +28,43 @@
<include
android:id="@+id/header"
layout="@layout/voip_conference_header"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? View.GONE : View.VISIBLE}"
app:conferenceViewModel="@{conferenceViewModel}" />
<include
android:id="@+id/remote_recording"
layout="@layout/voip_remote_recording"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/header"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_below="@id/header"
android:visibility="@{conferenceViewModel.isRemotelyRecorded ? View.VISIBLE : View.GONE, default=gone}" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/top_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="header, remote_recording"/>
<androidx.gridlayout.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/remote_recording"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/top_barrier"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="10dp"
app:entries="@{conferenceViewModel.conferenceParticipantDevices}"
app:layout="@{@layout/voip_conference_participant_remote_audio_only}"
app:columnCount="2"
app:orientation="horizontal" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -119,7 +119,7 @@
app:layout_constraintBottom_toTopOf="@id/primary_buttons"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/voip_translucent_popup_background"

View file

@ -19,36 +19,51 @@
type="Integer" />
</data>
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? @dimen/voip_remote_margin_full_screen : @dimen/voip_remote_margin, default=@dimen/voip_remote_margin}"
android:visibility="@{inflatedVisibility}"
android:gravity="center"
android:orientation="vertical">
android:visibility="@{inflatedVisibility}">
<include
android:id="@+id/header"
layout="@layout/voip_conference_header"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? View.GONE : View.VISIBLE}"
app:conferenceViewModel="@{conferenceViewModel}" />
<include
android:id="@+id/remote_recording"
layout="@layout/voip_remote_recording"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/header"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="@{conferenceViewModel.isRemotelyRecorded ? View.VISIBLE : View.GONE, default=gone}" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/top_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="header, remote_recording"/>
<org.linphone.activities.voip.views.GridBoxLayout
centerContent="@{true}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/top_barrier"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="10dp"
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}"
app:entries="@{conferenceViewModel.conferenceParticipantDevices}"
app:layout="@{@layout/voip_conference_participant_remote_grid}" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -272,7 +272,7 @@
app:layout_constraintBottom_toTopOf="@id/primary_buttons"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/voip_translucent_popup_background"