mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Renamed a few classes related to call logs for better understanding
This commit is contained in:
parent
c002ea3205
commit
bbe26ec35b
11 changed files with 35 additions and 41 deletions
|
|
@ -28,16 +28,16 @@ import androidx.recyclerview.widget.DiffUtil
|
|||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.linphone.R
|
||||
import org.linphone.databinding.HistoryContactListCellBinding
|
||||
import org.linphone.databinding.HistoryCallListCellBinding
|
||||
import org.linphone.ui.main.history.model.CallLogHistoryModel
|
||||
|
||||
class ContactHistoryListAdapter : ListAdapter<CallLogHistoryModel, RecyclerView.ViewHolder>(
|
||||
CallHistoryDiffCallback()
|
||||
) {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
val binding: HistoryContactListCellBinding = DataBindingUtil.inflate(
|
||||
val binding: HistoryCallListCellBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
R.layout.history_contact_list_cell,
|
||||
R.layout.history_call_list_cell,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
|
|
@ -50,7 +50,7 @@ class ContactHistoryListAdapter : ListAdapter<CallLogHistoryModel, RecyclerView.
|
|||
}
|
||||
|
||||
inner class ViewHolder(
|
||||
val binding: HistoryContactListCellBinding
|
||||
val binding: HistoryCallListCellBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
@UiThread
|
||||
fun bind(callLogHistoryModel: CallLogHistoryModel) {
|
||||
|
|
|
|||
|
|
@ -37,35 +37,35 @@ import androidx.navigation.fragment.navArgs
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import org.linphone.R
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.HistoryContactFragmentBinding
|
||||
import org.linphone.databinding.HistoryContactPopupMenuBinding
|
||||
import org.linphone.databinding.HistoryFragmentBinding
|
||||
import org.linphone.databinding.HistoryPopupMenuBinding
|
||||
import org.linphone.ui.GenericActivity
|
||||
import org.linphone.ui.main.fragment.SlidingPaneChildFragment
|
||||
import org.linphone.ui.main.history.adapter.ContactHistoryListAdapter
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.ui.main.history.viewmodel.ContactHistoryViewModel
|
||||
import org.linphone.ui.main.history.viewmodel.HistoryViewModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
|
||||
@UiThread
|
||||
class HistoryContactFragment : SlidingPaneChildFragment() {
|
||||
class HistoryFragment : SlidingPaneChildFragment() {
|
||||
companion object {
|
||||
private const val TAG = "[Call Fragment]"
|
||||
private const val TAG = "[History Fragment]"
|
||||
}
|
||||
|
||||
private lateinit var binding: HistoryContactFragmentBinding
|
||||
private lateinit var binding: HistoryFragmentBinding
|
||||
|
||||
private lateinit var viewModel: ContactHistoryViewModel
|
||||
private lateinit var viewModel: HistoryViewModel
|
||||
|
||||
private lateinit var adapter: ContactHistoryListAdapter
|
||||
|
||||
private val args: HistoryContactFragmentArgs by navArgs()
|
||||
private val args: HistoryFragmentArgs by navArgs()
|
||||
|
||||
override fun goBack(): Boolean {
|
||||
sharedViewModel.closeSlidingPaneEvent.value = Event(true)
|
||||
|
||||
// If not done this fragment won't be paused, which will cause us issues
|
||||
val action = HistoryContactFragmentDirections.actionHistoryContactFragmentToEmptyFragment()
|
||||
val action = HistoryFragmentDirections.actionHistoryFragmentToEmptyFragment()
|
||||
findNavController().navigate(action)
|
||||
return true
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ class HistoryContactFragment : SlidingPaneChildFragment() {
|
|||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
binding = HistoryContactFragmentBinding.inflate(layoutInflater)
|
||||
binding = HistoryFragmentBinding.inflate(layoutInflater)
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ class HistoryContactFragment : SlidingPaneChildFragment() {
|
|||
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
viewModel = ViewModelProvider(this)[ContactHistoryViewModel::class.java]
|
||||
viewModel = ViewModelProvider(this)[HistoryViewModel::class.java]
|
||||
binding.viewModel = viewModel
|
||||
|
||||
val callId = args.callId
|
||||
|
|
@ -182,9 +182,9 @@ class HistoryContactFragment : SlidingPaneChildFragment() {
|
|||
}
|
||||
|
||||
private fun showPopupMenu() {
|
||||
val popupView: HistoryContactPopupMenuBinding = DataBindingUtil.inflate(
|
||||
val popupView: HistoryPopupMenuBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(requireContext()),
|
||||
R.layout.history_contact_popup_menu,
|
||||
R.layout.history_popup_menu,
|
||||
null,
|
||||
false
|
||||
)
|
||||
|
|
@ -54,7 +54,7 @@ import org.linphone.utils.Event
|
|||
@UiThread
|
||||
class HistoryListFragment : AbstractTopBarFragment() {
|
||||
companion object {
|
||||
private const val TAG = "[Calls List Fragment]"
|
||||
private const val TAG = "[History List Fragment]"
|
||||
}
|
||||
|
||||
private lateinit var binding: HistoryListFragmentBinding
|
||||
|
|
@ -166,7 +166,7 @@ class HistoryListFragment : AbstractTopBarFragment() {
|
|||
if (!uri.isNullOrEmpty()) {
|
||||
val navController = binding.historyNavContainer.findNavController()
|
||||
val action =
|
||||
HistoryContactFragmentDirections.actionGlobalHistoryContactFragment(uri)
|
||||
HistoryFragmentDirections.actionGlobalHistoryFragment(uri)
|
||||
navController.navigate(action)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import androidx.annotation.WorkerThread
|
|||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.R
|
||||
import org.linphone.core.Call.Dir
|
||||
import org.linphone.core.CallLog
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
||||
|
|
@ -35,14 +34,14 @@ import org.linphone.utils.TimestampUtils
|
|||
|
||||
class CallLogModel @WorkerThread constructor(private val callLog: CallLog) {
|
||||
companion object {
|
||||
private const val TAG = "[CallLog Model]"
|
||||
private const val TAG = "[Call Log Model]"
|
||||
}
|
||||
|
||||
val id = callLog.callId ?: callLog.refKey
|
||||
|
||||
val timestamp = callLog.startDate
|
||||
|
||||
val address = if (callLog.dir == Dir.Outgoing) callLog.toAddress else callLog.fromAddress
|
||||
val address = callLog.remoteAddress
|
||||
|
||||
val sipUri = address.asStringUriOnly()
|
||||
|
||||
|
|
|
|||
|
|
@ -33,10 +33,6 @@ class ContactOrSuggestionModel @WorkerThread constructor(
|
|||
val friend: Friend? = null,
|
||||
private val onClicked: ((Address) -> Unit)? = null
|
||||
) {
|
||||
companion object {
|
||||
private const val TAG = "[Suggestion Model]"
|
||||
}
|
||||
|
||||
val id = friend?.refKey ?: address.asStringUriOnly().hashCode()
|
||||
|
||||
val name = if (friend != null) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.linphone.utils.LinphoneUtils
|
|||
|
||||
class HistoryListViewModel @UiThread constructor() : AbstractTopBarViewModel() {
|
||||
companion object {
|
||||
private const val TAG = "[Calls List ViewModel]"
|
||||
private const val TAG = "[History List ViewModel]"
|
||||
}
|
||||
|
||||
val callLogs = MutableLiveData<ArrayList<CallLogModel>>()
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import org.linphone.LinphoneApplication.Companion.coreContext
|
|||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.R
|
||||
import org.linphone.core.Address
|
||||
import org.linphone.core.Call
|
||||
import org.linphone.core.ChatRoom
|
||||
import org.linphone.core.ChatRoomListenerStub
|
||||
import org.linphone.core.ChatRoomParams
|
||||
|
|
@ -39,9 +38,9 @@ import org.linphone.utils.AppUtils
|
|||
import org.linphone.utils.Event
|
||||
import org.linphone.utils.LinphoneUtils
|
||||
|
||||
class ContactHistoryViewModel @UiThread constructor() : ViewModel() {
|
||||
class HistoryViewModel @UiThread constructor() : ViewModel() {
|
||||
companion object {
|
||||
private const val TAG = "[Contact History ViewModel]"
|
||||
private const val TAG = "[History ViewModel]"
|
||||
}
|
||||
|
||||
val showBackButton = MutableLiveData<Boolean>()
|
||||
|
|
@ -124,11 +123,11 @@ class ContactHistoryViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
isConferenceCallLog.postValue(callLog.wasConference())
|
||||
|
||||
val peerAddress = if (callLog.dir == Call.Dir.Outgoing) callLog.toAddress else callLog.fromAddress
|
||||
val peerAddress = callLog.remoteAddress
|
||||
val history = arrayListOf<CallLogHistoryModel>()
|
||||
val account = LinphoneUtils.getDefaultAccount()
|
||||
val list = if (account == null) {
|
||||
val localAddress = if (callLog.dir == Call.Dir.Outgoing) callLog.fromAddress else callLog.toAddress
|
||||
val localAddress = callLog.localAddress
|
||||
core.getCallHistory(peerAddress, localAddress)
|
||||
} else {
|
||||
account.getCallLogsForAddress(peerAddress)
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.viewmodel.ContactHistoryViewModel" />
|
||||
type="org.linphone.ui.main.history.viewmodel.HistoryViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
|
|
@ -13,23 +13,23 @@
|
|||
tools:layout="@layout/empty_fragment"/>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/historyContactFragment"
|
||||
android:name="org.linphone.ui.main.history.fragment.HistoryContactFragment"
|
||||
android:label="HistoryContactFragment"
|
||||
tools:layout="@layout/history_contact_fragment">
|
||||
android:id="@+id/historyFragment"
|
||||
android:name="org.linphone.ui.main.history.fragment.HistoryFragment"
|
||||
android:label="HistoryFragment"
|
||||
tools:layout="@layout/history_fragment">
|
||||
<argument
|
||||
android:name="callId"
|
||||
app:argType="string" />
|
||||
<action
|
||||
android:id="@+id/action_historyContactFragment_to_emptyFragment"
|
||||
android:id="@+id/action_historyFragment_to_emptyFragment"
|
||||
app:destination="@id/emptyFragment"
|
||||
app:popUpTo="@id/historyContactFragment"
|
||||
app:popUpTo="@id/historyFragment"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_historyContactFragment"
|
||||
app:destination="@id/historyContactFragment"
|
||||
android:id="@+id/action_global_historyFragment"
|
||||
app:destination="@id/historyFragment"
|
||||
app:launchSingleTop="true" />
|
||||
|
||||
</navigation>
|
||||
Loading…
Add table
Reference in a new issue