Fixed video preview not visible when rotating device if it was moved + fixed video preview missing rounded corners on some fragments

This commit is contained in:
Sylvain Berfini 2026-02-03 16:21:51 +01:00
parent 9d3e3f1bc8
commit 83bfbdcb3d
6 changed files with 15 additions and 8 deletions

View file

@ -20,6 +20,7 @@
package org.linphone.ui.call.fragment
import android.annotation.SuppressLint
import android.content.res.Configuration
import android.os.Bundle
import android.view.MotionEvent
import android.view.View
@ -49,6 +50,7 @@ abstract class GenericCallFragment : GenericFragment() {
MotionEvent.ACTION_UP -> {
sharedViewModel.videoPreviewX = view.x
sharedViewModel.videoPreviewY = view.y
sharedViewModel.videoPreviewOrientation = resources.configuration.orientation
true
}
MotionEvent.ACTION_MOVE -> {
@ -82,10 +84,13 @@ abstract class GenericCallFragment : GenericFragment() {
}
// To restore video preview position if possible
if (sharedViewModel.videoPreviewX != 0f && sharedViewModel.videoPreviewY != 0f) {
Log.i("$TAG Restoring video preview position with position X [${sharedViewModel.videoPreviewX}] and Y [${sharedViewModel.videoPreviewY}]")
localPreviewVideoSurface.x = sharedViewModel.videoPreviewX
localPreviewVideoSurface.y = sharedViewModel.videoPreviewY
val currentOrientation = resources.configuration.orientation
if (sharedViewModel.videoPreviewOrientation == currentOrientation || sharedViewModel.videoPreviewOrientation == Configuration.ORIENTATION_UNDEFINED) {
if (sharedViewModel.videoPreviewX != 0f && sharedViewModel.videoPreviewY != 0f) {
Log.i("$TAG Restoring video preview position with position X [${sharedViewModel.videoPreviewX}] and Y [${sharedViewModel.videoPreviewY}]")
localPreviewVideoSurface.x = sharedViewModel.videoPreviewX
localPreviewVideoSurface.y = sharedViewModel.videoPreviewY
}
}
localPreviewVideoSurface.setOnTouchListener(videoPreviewTouchListener)

View file

@ -19,6 +19,7 @@
*/
package org.linphone.ui.call.viewmodel
import android.content.res.Configuration
import androidx.annotation.UiThread
import androidx.lifecycle.MutableLiveData
import androidx.window.layout.FoldingFeature
@ -35,4 +36,5 @@ class SharedCallViewModel
// For moving video preview purposes
var videoPreviewX: Float = 0f
var videoPreviewY: Float = 0f
var videoPreviewOrientation: Int = Configuration.ORIENTATION_UNDEFINED
}

View file

@ -125,7 +125,7 @@
android:layout_marginBottom="10dp"
app:alignTopRight="true"
app:displayMode="black_bars"
app:radius="@dimen/call_round_corners_texture_view_radius"
roundCornersRadius="@dimen/call_round_corners_texture_view_radius"
app:layout_constraintBottom_toTopOf="@id/bottom_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_max="@dimen/call_video_preview_max_size"

View file

@ -88,7 +88,7 @@
android:layout_marginEnd="10dp"
app:alignTopRight="true"
app:displayMode="black_bars"
app:radius="@dimen/call_round_corners_texture_view_radius"
roundCornersRadius="@dimen/call_round_corners_texture_view_radius"
app:layout_constraintBottom_toTopOf="@id/add_participants"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_max="@dimen/call_video_preview_max_size"

View file

@ -120,7 +120,7 @@
android:layout_marginBottom="10dp"
app:alignTopRight="true"
app:displayMode="black_bars"
app:radius="@dimen/call_round_corners_texture_view_radius"
roundCornersRadius="@dimen/call_round_corners_texture_view_radius"
app:layout_constraintBottom_toTopOf="@id/bottom_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_max="@dimen/call_video_preview_max_size"

View file

@ -86,7 +86,7 @@
android:layout_marginEnd="10dp"
app:alignTopRight="true"
app:displayMode="black_bars"
app:radius="@dimen/call_round_corners_texture_view_radius"
roundCornersRadius="@dimen/call_round_corners_texture_view_radius"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_max="@dimen/call_video_preview_max_size"