Small improvements

This commit is contained in:
Sylvain Berfini 2024-02-28 14:11:54 +01:00
parent 01c69b9396
commit 3a2d85265d
13 changed files with 20 additions and 42 deletions

View file

@ -175,6 +175,7 @@ dependencies {
// https://github.com/openid/AppAuth-Android/blob/master/LICENSE Apache v2.0
implementation 'net.openid:appauth:0.11.1'
//noinspection GroovyConstructorNamedArguments
android.defaultConfig.manifestPlaceholders = [appAuthRedirectScheme: 'org.linphone']
//noinspection GradleDynamicVersion

View file

@ -241,6 +241,16 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
Looper.loop()
}
override fun quit(): Boolean {
destroyCore()
return super.quit()
}
override fun quitSafely(): Boolean {
destroyCore()
return super.quitSafely()
}
@WorkerThread
fun startCore() {
Log.i("$TAG Configuring Core")

View file

@ -57,6 +57,7 @@ class ProfileModeFragment : Fragment() {
super.onViewCreated(view, savedInstanceState)
binding.lifecycleOwner = viewLifecycleOwner
binding.viewModel = viewModel
binding.setBackClickListener {
findNavController().popBackStack()

View file

@ -19,6 +19,7 @@
*/
package org.linphone.ui.call.model
import android.annotation.SuppressLint
import androidx.annotation.UiThread
import androidx.annotation.WorkerThread
import androidx.lifecycle.MutableLiveData
@ -113,7 +114,7 @@ class ConferenceModel {
if (found != null) {
Log.i("$TAG Newly active speaker participant is [${found.name}]")
found.isActiveSpeaker.postValue(true)
activeSpeaker.postValue(found!!)
activeSpeaker.postValue(found)
} else {
Log.i("$TAG Failed to find actively speaking participant...")
val model = ConferenceParticipantDeviceModel(participantDevice)
@ -300,7 +301,6 @@ class ConferenceModel {
@WorkerThread
private fun computeParticipants() {
participants.value.orEmpty().forEach(ConferenceParticipantModel::destroy)
participantDevices.value.orEmpty().forEach(ConferenceParticipantDeviceModel::destroy)
val participantsList = arrayListOf<ConferenceParticipantModel>()
@ -457,7 +457,6 @@ class ConferenceModel {
participant.address.weakEqual(it.participant.address)
}
if (toRemove != null) {
toRemove.destroy()
list.remove(toRemove)
}

View file

@ -36,8 +36,4 @@ class ConferenceParticipantModel @WorkerThread constructor(val participant: Part
init {
isAdmin.postValue(participant.isAdmin)
}
@WorkerThread
fun destroy() {
}
}

View file

@ -726,7 +726,7 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
val avatarModel = contact.value
if (avatarModel != null) {
avatarModel.trust.postValue(securityLevel)
contact.postValue(avatarModel!!)
contact.postValue(avatarModel)
} else {
Log.e("$TAG No avatar model found!")
}

View file

@ -257,11 +257,11 @@ class ContactViewModel @UiThread constructor() : ViewModel() {
val organization = friend.organization
if (!organization.isNullOrEmpty()) {
company.postValue(organization!!)
company.postValue(organization)
}
val jobTitle = friend.jobTitle
if (!jobTitle.isNullOrEmpty()) {
title.postValue(jobTitle!!)
title.postValue(jobTitle)
}
val addressesAndNumbers = friend.getListOfSipAddressesAndPhoneNumbers(listener)

View file

@ -39,7 +39,7 @@ class AuthRequestedDialogModel @UiThread constructor(identity: String) {
init {
showPassword.value = false
message.value = AppUtils.getFormattedString(
R.string.dialog_account_invalid_password_message,
R.string.account_settings_dialog_invalid_password_message,
identity
)
}

View file

@ -32,8 +32,4 @@ class ParticipantModel @WorkerThread constructor(address: Address, val isOrganiz
val avatar = coreContext.contactsManager.getContactAvatarModelForAddress(address)
avatarModel.postValue(avatar)
}
@WorkerThread
fun destroy() {
}
}

View file

@ -74,11 +74,6 @@ class MeetingViewModel @UiThread constructor() : ViewModel() {
override fun onCleared() {
super.onCleared()
coreContext.postOnCoreThread {
speakers.value.orEmpty().forEach(ParticipantModel::destroy)
participants.value.orEmpty().forEach(ParticipantModel::destroy)
}
}
@UiThread
@ -163,9 +158,6 @@ class MeetingViewModel @UiThread constructor() : ViewModel() {
}
private fun computeParticipantsList() {
speakers.value.orEmpty().forEach(ParticipantModel::destroy)
participants.value.orEmpty().forEach(ParticipantModel::destroy)
val speakersList = arrayListOf<ParticipantModel>()
val participantsList = arrayListOf<ParticipantModel>()

View file

@ -69,22 +69,6 @@ class TimestampUtils {
return isSameDay(cal, yesterday)
}
@AnyThread
fun dateToString(date: Long, timestampInSecs: Boolean = true): String {
val dateFormat: Format = android.text.format.DateFormat.getDateFormat(
coreContext.context
)
val pattern = (dateFormat as SimpleDateFormat).toLocalizedPattern()
val calendar = Calendar.getInstance()
calendar.timeInMillis = if (timestampInSecs) date * 1000 else date
// See https://github.com/material-components/material-components-android/issues/882
val dateFormatter = SimpleDateFormat(pattern, Locale.getDefault())
dateFormatter.timeZone = TimeZone.getTimeZone("UTC")
return dateFormatter.format(calendar.time)
}
@AnyThread
fun dayOfWeek(timestamp: Long, timestampInSecs: Boolean = true): String {
val calendar = Calendar.getInstance()

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="android.view.View" />