mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 20:09:27 +03:00
WebRTC call: draggable views should be sticky
This commit is contained in:
parent
0da8a46311
commit
a102fc4ec3
2 changed files with 82 additions and 65 deletions
|
@ -103,6 +103,7 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||
|
||||
private var rootEglBase: EglBase? = null
|
||||
private var pipDraggrableView: DraggableView<MaterialCardView>? = null
|
||||
private var otherCallDraggableView: DraggableView<MaterialCardView>? = null
|
||||
|
||||
var surfaceRenderersAreInitialized = false
|
||||
|
||||
|
@ -242,13 +243,15 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||
is CallState.CreateOffer,
|
||||
is CallState.LocalRinging,
|
||||
is CallState.Dialing -> {
|
||||
views.callVideoGroup.isVisible = false
|
||||
views.fullscreenRenderer.isVisible = false
|
||||
views.pipRendererWrapper.isVisible = false
|
||||
views.callInfoGroup.isVisible = true
|
||||
views.callToolbar.setSubtitle(R.string.call_ringing)
|
||||
configureCallInfo(state)
|
||||
}
|
||||
is CallState.Answering -> {
|
||||
views.callVideoGroup.isVisible = false
|
||||
views.fullscreenRenderer.isVisible = false
|
||||
views.pipRendererWrapper.isVisible = false
|
||||
views.callInfoGroup.isVisible = true
|
||||
views.callToolbar.setSubtitle(R.string.call_connecting)
|
||||
configureCallInfo(state)
|
||||
|
@ -258,7 +261,8 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||
if (callState.iceConnectionState == MxPeerConnectionState.CONNECTED) {
|
||||
if (state.isLocalOnHold || state.isRemoteOnHold) {
|
||||
views.smallIsHeldIcon.isVisible = true
|
||||
views.callVideoGroup.isVisible = false
|
||||
views.fullscreenRenderer.isVisible = false
|
||||
views.pipRendererWrapper.isVisible = false
|
||||
views.callInfoGroup.isVisible = true
|
||||
configureCallInfo(state, blurAvatar = true)
|
||||
if (state.isRemoteOnHold) {
|
||||
|
@ -285,17 +289,20 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||
} else {
|
||||
configureCallInfo(state)
|
||||
if (callArgs.isVideoCall) {
|
||||
views.callVideoGroup.isVisible = true
|
||||
views.fullscreenRenderer.isVisible = true
|
||||
views.pipRendererWrapper.isVisible = true
|
||||
views.callInfoGroup.isVisible = false
|
||||
views.pipRenderer.isVisible = !state.isVideoCaptureInError && state.otherKnownCallInfo == null
|
||||
} else {
|
||||
views.callVideoGroup.isVisible = false
|
||||
views.fullscreenRenderer.isVisible = false
|
||||
views.pipRendererWrapper.isVisible = false
|
||||
views.callInfoGroup.isVisible = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// This state is not final, if you change network, new candidates will be sent
|
||||
views.callVideoGroup.isVisible = false
|
||||
views.fullscreenRenderer.isVisible = false
|
||||
views.pipRendererWrapper.isVisible = false
|
||||
views.callInfoGroup.isVisible = true
|
||||
configureCallInfo(state)
|
||||
views.callToolbar.setSubtitle(R.string.call_connecting)
|
||||
|
@ -315,6 +322,7 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||
views.callControlsView.isVisible = false
|
||||
views.pipRendererWrapper.isVisible = false
|
||||
views.pipRenderer.isVisible = false
|
||||
views.callActionText.isVisible = false
|
||||
when (callState) {
|
||||
is CallState.Idle,
|
||||
is CallState.CreateOffer,
|
||||
|
@ -396,7 +404,13 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||
finish()
|
||||
}
|
||||
}
|
||||
pipDraggrableView = views.pipRendererWrapper.setupDraggable().build()
|
||||
pipDraggrableView = views.pipRendererWrapper.setupDraggable()
|
||||
.setStickyMode(DraggableView.Mode.STICKY_XY)
|
||||
.build()
|
||||
|
||||
otherCallDraggableView = views.otherKnownCallLayout.setupDraggable()
|
||||
.setStickyMode(DraggableView.Mode.STICKY_XY)
|
||||
.build()
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||
|
|
|
@ -29,16 +29,24 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/pipContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/callControlsView"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/callToolbar">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/pipRendererWrapper"
|
||||
android:layout_width="@dimen/call_pip_width"
|
||||
android:layout_height="@dimen/call_pip_height"
|
||||
app:cardCornerRadius="@dimen/call_pip_radius"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:layout_goneMarginEnd="0dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/callControlsView">
|
||||
app:cardCornerRadius="@dimen/call_pip_radius"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<org.webrtc.SurfaceViewRenderer
|
||||
android:id="@+id/pipRenderer"
|
||||
|
@ -49,38 +57,19 @@
|
|||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/callToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:fitsSystemWindows="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navigationIcon="@drawable/ic_back_24dp"
|
||||
app:navigationIconTint="@color/element_background_light"
|
||||
app:subtitle="3:10"
|
||||
app:subtitleTextAppearance="@style/TextAppearance.Vector.Caption"
|
||||
app:subtitleTextColor="@color/element_background_light"
|
||||
app:title="Video call"
|
||||
app:titleMarginTop="16dp"
|
||||
app:titleTextAppearance="@style/TextAppearance.Vector.Body.Medium"
|
||||
app:titleTextColor="@color/element_background_light" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/otherKnownCallLayout"
|
||||
android:layout_width="@dimen/call_pip_width"
|
||||
android:layout_height="@dimen/call_pip_height"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@color/element_background_light"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
android:visibility="gone"
|
||||
app:cardBackgroundColor="@color/bg_call_screen"
|
||||
app:cardCornerRadius="@dimen/call_pip_radius"
|
||||
app:cardElevation="4dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/callControlsView"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/pipRendererWrapper"
|
||||
tools:visibility="visible">
|
||||
|
||||
|
@ -103,6 +92,28 @@
|
|||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/callToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:fitsSystemWindows="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navigationIcon="@drawable/ic_back_24dp"
|
||||
app:navigationIconTint="@color/element_background_light"
|
||||
app:subtitle="3:10"
|
||||
app:subtitleTextAppearance="@style/TextAppearance.Vector.Caption"
|
||||
app:subtitleTextColor="@color/element_background_light"
|
||||
app:title="Video call"
|
||||
app:titleMarginTop="16dp"
|
||||
app:titleTextAppearance="@style/TextAppearance.Vector.Body.Medium"
|
||||
app:titleTextColor="@color/element_background_light" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/otherMemberAvatar"
|
||||
android:layout_width="120dp"
|
||||
|
@ -164,14 +175,6 @@
|
|||
android:visibility="visible"
|
||||
app:constraint_referenced_ids="participantNameText, otherMemberAvatar" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/callVideoGroup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"
|
||||
app:constraint_referenced_ids="pipRendererWrapper, fullscreenRenderer"
|
||||
tools:visibility="invisible" />
|
||||
|
||||
<im.vector.app.features.call.CallControlsView
|
||||
android:id="@+id/callControlsView"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in a new issue