mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Show participant SIP URI in reactions / delivery status / conversation participants lists when clicking on name
This commit is contained in:
parent
d6d705a975
commit
07cb09128e
4 changed files with 68 additions and 2 deletions
|
|
@ -21,7 +21,9 @@ package org.linphone.ui.main.chat.model
|
|||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.core.Address
|
||||
|
||||
class MessageBottomSheetParticipantModel
|
||||
|
|
@ -35,8 +37,23 @@ class MessageBottomSheetParticipantModel
|
|||
) {
|
||||
val sipUri = address.asStringUriOnly()
|
||||
|
||||
val showSipUri = MutableLiveData<Boolean>()
|
||||
|
||||
val avatarModel = coreContext.contactsManager.getContactAvatarModelForAddress(address)
|
||||
|
||||
init {
|
||||
showSipUri.postValue(false)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun toggleShowSipUri() {
|
||||
if (!isOurOwnReaction && !corePreferences.onlyDisplaySipUriUsername) {
|
||||
showSipUri.postValue(showSipUri.value == false)
|
||||
} else {
|
||||
clicked()
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun clicked() {
|
||||
onClick?.invoke()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ package org.linphone.ui.main.chat.model
|
|||
import android.view.View
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.core.Address
|
||||
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
||||
|
||||
|
|
@ -39,6 +41,8 @@ class ParticipantModel
|
|||
) {
|
||||
val sipUri = address.asStringUriOnly()
|
||||
|
||||
val showSipUri = MutableLiveData<Boolean>()
|
||||
|
||||
val avatarModel: ContactAvatarModel = coreContext.contactsManager.getContactAvatarModelForAddress(
|
||||
address
|
||||
)
|
||||
|
|
@ -49,6 +53,19 @@ class ParticipantModel
|
|||
avatarModel.friend
|
||||
)
|
||||
|
||||
init {
|
||||
showSipUri.postValue(false)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun toggleShowSipUri() {
|
||||
if (!corePreferences.onlyDisplaySipUriUsername) {
|
||||
showSipUri.postValue(showSipUri.value == false)
|
||||
} else {
|
||||
onClicked()
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun onClicked() {
|
||||
onClicked?.invoke(this)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:onClick="@{() -> model.toggleShowSipUri()}"
|
||||
android:id="@+id/name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -42,6 +43,21 @@
|
|||
app:layout_constraintStart_toEndOf="@id/avatar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/date_time"
|
||||
app:layout_constraintBottom_toTopOf="@id/sip_address"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:onClick="@{() -> model.toggleShowSipUri()}"
|
||||
android:id="@+id/sip_address"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{model.sipUri, default=`sip:johndoe@sip.linphone.org`}"
|
||||
android:visibility="@{model.showSipUri ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:textSize="12sp"
|
||||
android:textColor="?attr/color_main2_500"
|
||||
app:layout_constraintStart_toStartOf="@id/name"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
app:layout_constraintEnd_toEndOf="@id/name"
|
||||
app:layout_constraintBottom_toTopOf="@id/remove_reaction"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
|
|
@ -53,7 +69,7 @@
|
|||
android:textSize="12sp"
|
||||
android:textColor="?attr/color_main2_400"
|
||||
android:visibility="@{model.ourOwnReaction ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
app:layout_constraintTop_toBottomOf="@id/sip_address"
|
||||
app:layout_constraintStart_toStartOf="@id/name"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:onClick="@{() -> model.toggleShowSipUri()}"
|
||||
android:id="@+id/name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -44,6 +45,21 @@
|
|||
app:layout_constraintStart_toEndOf="@id/avatar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/participant_menu"
|
||||
app:layout_constraintBottom_toTopOf="@id/sip_address"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:onClick="@{() -> model.toggleShowSipUri()}"
|
||||
android:id="@+id/sip_address"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{model.sipUri, default=`sip:johndoe@sip.linphone.org`}"
|
||||
android:visibility="@{model.showSipUri ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:textSize="12sp"
|
||||
android:textColor="?attr/color_main2_500"
|
||||
app:layout_constraintStart_toStartOf="@id/name"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
app:layout_constraintEnd_toEndOf="@id/name"
|
||||
app:layout_constraintBottom_toTopOf="@id/admin_label"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
|
|
@ -55,7 +71,7 @@
|
|||
android:textColor="?attr/color_main2_500"
|
||||
android:textSize="12sp"
|
||||
android:visibility="@{model.isParticipantAdmin ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
app:layout_constraintTop_toBottomOf="@id/sip_address"
|
||||
app:layout_constraintStart_toStartOf="@id/name"
|
||||
app:layout_constraintEnd_toEndOf="@id/name"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue