mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Improvements
This commit is contained in:
parent
ab151cc409
commit
c051d28c95
5 changed files with 10 additions and 11 deletions
|
|
@ -50,11 +50,6 @@ class CallsListAdapter(
|
|||
selectedAdapterPosition = -1
|
||||
}
|
||||
|
||||
fun deleteSelection() {
|
||||
notifyItemRemoved(selectedAdapterPosition)
|
||||
selectedAdapterPosition = -1
|
||||
}
|
||||
|
||||
inner class ViewHolder(
|
||||
val binding: CallListCellBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
|
@ -89,11 +84,11 @@ class CallsListAdapter(
|
|||
|
||||
private class CallLogDiffCallback : DiffUtil.ItemCallback<CallLogModel>() {
|
||||
override fun areItemsTheSame(oldItem: CallLogModel, newItem: CallLogModel): Boolean {
|
||||
return oldItem.id == newItem.id
|
||||
return oldItem.id == newItem.id && oldItem.timestamp == newItem.timestamp
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: CallLogModel, newItem: CallLogModel): Boolean {
|
||||
return oldItem.avatarModel.id == newItem.avatarModel.id
|
||||
return oldItem.avatarModel.id == newItem.avatarModel.id && oldItem.iconResId.value == newItem.iconResId.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class CallsListFragment : GenericFragment() {
|
|||
{ // onDeleteCallLog
|
||||
Log.i("$TAG Deleting call log with ref key or call ID [${model.id}]")
|
||||
model.delete()
|
||||
adapter.deleteSelection()
|
||||
listViewModel.applyFilter()
|
||||
}
|
||||
)
|
||||
modalBottomSheet.show(parentFragmentManager, CallsListMenuDialogFragment.TAG)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import org.linphone.utils.TimestampUtils
|
|||
class CallLogModel @WorkerThread constructor(private val callLog: CallLog) {
|
||||
val id = callLog.callId ?: callLog.refKey
|
||||
|
||||
val timestamp = callLog.startDate
|
||||
|
||||
val address = if (callLog.dir == Dir.Outgoing) callLog.toAddress else callLog.fromAddress
|
||||
|
||||
val displayedAddress = address.asStringUriOnly()
|
||||
|
|
@ -34,7 +36,7 @@ class CallLogModel @WorkerThread constructor(private val callLog: CallLog) {
|
|||
init {
|
||||
isOutgoing.postValue(callLog.dir == Dir.Outgoing)
|
||||
|
||||
val timestamp = callLog.startDate
|
||||
val timestamp = timestamp
|
||||
val displayedDate = if (TimestampUtils.isToday(timestamp)) {
|
||||
TimestampUtils.timeToString(timestamp)
|
||||
} else if (TimestampUtils.isYesterday(timestamp)) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import androidx.recyclerview.widget.DiffUtil
|
|||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.linphone.R
|
||||
import org.linphone.core.ConsolidatedPresence
|
||||
import org.linphone.databinding.ContactFavouriteListCellBinding
|
||||
import org.linphone.databinding.ContactListCellBinding
|
||||
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
||||
|
|
@ -128,7 +129,8 @@ class ContactsListAdapter(
|
|||
|
||||
override fun areContentsTheSame(oldItem: ContactAvatarModel, newItem: ContactAvatarModel): Boolean {
|
||||
return oldItem.firstContactStartingByThatLetter.value == newItem.firstContactStartingByThatLetter.value &&
|
||||
oldItem.presenceStatus.value == newItem.presenceStatus.value
|
||||
oldItem.presenceStatus.value == newItem.presenceStatus.value &&
|
||||
(newItem.presenceStatus.value == ConsolidatedPresence.Busy || newItem.presenceStatus.value == ConsolidatedPresence.Online)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class ContactAvatarModel @WorkerThread constructor(val friend: Friend) {
|
|||
@WorkerThread
|
||||
override fun onPresenceReceived(fr: Friend) {
|
||||
Log.d(
|
||||
"$TAG Presence received for friend [${fr.name}]: [${friend.consolidatedPresence}]"
|
||||
"$TAG Presence received for friend [${fr.name}]: [${fr.consolidatedPresence}]"
|
||||
)
|
||||
presenceStatus.postValue(fr.consolidatedPresence)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue