mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Added navigation from call log to contact
This commit is contained in:
parent
4ac78c5b30
commit
a10f416f15
6 changed files with 33 additions and 8 deletions
|
|
@ -137,10 +137,18 @@ class CallFragment : GenericFragment() {
|
|||
|
||||
popupView.setAddToContactsListener {
|
||||
// TODO: go to new contact fragment
|
||||
sharedViewModel.navigateToContactsEvent.value = Event(true)
|
||||
sharedViewModel.showNewContactEvent.value = Event(true)
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
|
||||
popupView.setGoToContactListener {
|
||||
// TODO: go to contact fragment
|
||||
val friendRefKey = viewModel.callLogModel.value?.friendRefKey
|
||||
if (!friendRefKey.isNullOrEmpty()) {
|
||||
sharedViewModel.navigateToContactsEvent.value = Event(true)
|
||||
sharedViewModel.showContactEvent.value = Event(friendRefKey)
|
||||
}
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
|
||||
popupView.setDeleteAllHistoryClickListener {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ class CallLogModel(private val callLog: CallLog) {
|
|||
|
||||
val dateTime = MutableLiveData<String>()
|
||||
|
||||
val friendRefKey: String?
|
||||
|
||||
var friendExists: Boolean = false
|
||||
|
||||
init {
|
||||
|
|
@ -43,11 +45,13 @@ class CallLogModel(private val callLog: CallLog) {
|
|||
|
||||
val friend = coreContext.core.findFriend(address)
|
||||
if (friend != null) {
|
||||
friendRefKey = friend.refKey
|
||||
avatarModel = ContactAvatarModel(friend)
|
||||
friendExists = true
|
||||
} else {
|
||||
val fakeFriend = coreContext.core.createFriend()
|
||||
fakeFriend.address = address
|
||||
friendRefKey = null
|
||||
avatarModel = ContactAvatarModel(fakeFriend)
|
||||
friendExists = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,6 +91,15 @@ class ContactsFragment : GenericFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
sharedViewModel.showNewContactEvent.observe(
|
||||
viewLifecycleOwner
|
||||
) {
|
||||
it.consume {
|
||||
val navController = binding.contactsLeftNavContainer.findNavController()
|
||||
navController.navigate(R.id.action_global_newContactFragment)
|
||||
}
|
||||
}
|
||||
|
||||
sharedViewModel.navigateToConversationsEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
if (findNavController().currentDestination?.id == R.id.contactsFragment) {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class ContactsListFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
binding.setOnNewContactClicked {
|
||||
findNavController().navigate(R.id.action_global_newContactFragment)
|
||||
sharedViewModel.showNewContactEvent.value = Event(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ class SharedMainViewModel : ViewModel() {
|
|||
MutableLiveData<Event<String>>()
|
||||
}
|
||||
|
||||
val showNewContactEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
/* Call logs related */
|
||||
|
||||
val showCallLogEvent: MutableLiveData<Event<String>> by lazy {
|
||||
|
|
|
|||
|
|
@ -33,19 +33,19 @@
|
|||
android:onClick="@{backClickListener}"
|
||||
android:visibility="@{viewModel.showBackButton ? View.VISIBLE : View.GONE}"
|
||||
android:src="@drawable/back"
|
||||
app:layout_constraintBottom_toBottomOf="@id/invisible_title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/invisible_title"/>
|
||||
app:layout_constraintTop_toTopOf="@id/title"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_800"
|
||||
android:id="@+id/invisible_title"
|
||||
android:visibility="invisible"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/top_bar_height"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Call history"
|
||||
android:textColor="@color/primary_color"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/menu"
|
||||
|
|
@ -65,9 +65,9 @@
|
|||
android:paddingEnd="10dp"
|
||||
android:src="@drawable/dot_menu"
|
||||
app:tint="@color/primary_color"
|
||||
app:layout_constraintBottom_toBottomOf="@id/invisible_title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/invisible_title" />
|
||||
app:layout_constraintTop_toTopOf="@id/title" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue