Fixed issue with recording player fragment layout using lateinit property model

This commit is contained in:
Sylvain Berfini 2025-11-18 17:12:44 +01:00
parent 0e837e60fa
commit b04b93137f
2 changed files with 17 additions and 4 deletions

View file

@ -59,6 +59,14 @@ class RecordingMediaPlayerViewModel
val isUsingSmffFileFormat = MutableLiveData<Boolean>()
val formattedDuration = MutableLiveData<String>()
val duration = MutableLiveData<Int>()
val displayName = MutableLiveData<String>()
val dateTime = MutableLiveData<String>()
private var audioFocusRequest: AudioFocusRequestCompat? = null
private val playerListener = PlayerListener {
@ -90,6 +98,11 @@ class RecordingMediaPlayerViewModel
fun loadRecording(model: RecordingModel) {
recordingModel = model
formattedDuration.postValue(model.formattedDuration)
duration.postValue(model.duration)
displayName.postValue(model.displayName)
dateTime.postValue(model.dateTime)
coreContext.postOnCoreThread { core ->
isUsingSmffFileFormat.postValue(model.filePath.endsWith(LinphoneUtils.RECORDING_SMFF_FILE_EXTENSION))
initPlayer()

View file

@ -66,7 +66,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:max="@{viewModel.recordingModel.duration, default=100}"
android:max="@{viewModel.duration, default=100}"
android:progress="@{viewModel.position, default=75}"
app:trackCornerRadius="5dp"
app:trackThickness="10dp"
@ -85,7 +85,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:text="@{viewModel.recordingModel.formattedDuration, default=`00:42`}"
android:text="@{viewModel.formattedDuration, default=`00:42`}"
android:textSize="13sp"
android:textColor="@color/bc_white"
app:layout_constraintTop_toTopOf="@id/play_pause_audio_playback"
@ -127,7 +127,7 @@
android:id="@+id/file_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@{viewModel.recordingModel.displayName, default=`nomdufichier.jpg`}"
android:text="@{viewModel.displayName, default=`nomdufichier.jpg`}"
android:textSize="13sp"
android:textColor="@color/gray_main2_600"
android:maxLines="1"
@ -143,7 +143,7 @@
android:id="@+id/date_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@{viewModel.recordingModel.dateTime, default=`envoyé le 02/05/2023 à 11h05`}"
android:text="@{viewModel.dateTime, default=`envoyé le 02/05/2023 à 11h05`}"
android:textSize="12sp"
android:textColor="@color/gray_main2_500"
android:maxLines="1"