mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Added hidden menus to display account contact address GRUU param & chat room peer address
This commit is contained in:
parent
f325c5ebbd
commit
859e32e655
8 changed files with 148 additions and 10 deletions
|
|
@ -19,6 +19,9 @@
|
|||
*/
|
||||
package org.linphone.ui.main.chat.fragment
|
||||
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
|
|
@ -309,6 +312,14 @@ class ConversationInfoFragment : SlidingPaneChildFragment() {
|
|||
binding.setDeleteHistoryClickListener {
|
||||
showDeleteHistoryConfirmationDialog()
|
||||
}
|
||||
|
||||
binding.setCopySipUriClickListener {
|
||||
copyAddressToClipboard(viewModel.sipUri.value.orEmpty())
|
||||
}
|
||||
|
||||
binding.setCopyPeerSipUriClickListener {
|
||||
copyAddressToClipboard(viewModel.peerSipUri.value.orEmpty())
|
||||
}
|
||||
}
|
||||
|
||||
private fun showParticipantAdminPopupMenu(view: View, participantModel: ParticipantModel) {
|
||||
|
|
@ -416,4 +427,14 @@ class ConversationInfoFragment : SlidingPaneChildFragment() {
|
|||
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
private fun copyAddressToClipboard(value: String) {
|
||||
val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText("SIP address", value))
|
||||
val message = getString(R.string.sip_address_copied_to_clipboard_toast)
|
||||
(requireActivity() as GenericActivity).showGreenToast(
|
||||
message,
|
||||
R.drawable.check
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,10 @@ class ConversationInfoViewModel @UiThread constructor() : AbstractConversationVi
|
|||
|
||||
val sipUri = MutableLiveData<String>()
|
||||
|
||||
val peerSipUri = MutableLiveData<String>()
|
||||
|
||||
val showPeerSipUri = MutableLiveData<Boolean>()
|
||||
|
||||
val isReadOnly = MutableLiveData<Boolean>()
|
||||
|
||||
val isMyselfAdmin = MutableLiveData<Boolean>()
|
||||
|
|
@ -242,11 +246,12 @@ class ConversationInfoViewModel @UiThread constructor() : AbstractConversationVi
|
|||
}
|
||||
|
||||
init {
|
||||
expandParticipants.value = true
|
||||
showPeerSipUri.value = false
|
||||
|
||||
coreContext.postOnCoreThread {
|
||||
coreContext.contactsManager.addListener(contactsListener)
|
||||
}
|
||||
|
||||
expandParticipants.value = true
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
|
|
@ -491,6 +496,12 @@ class ConversationInfoViewModel @UiThread constructor() : AbstractConversationVi
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun showDebugInfo(): Boolean {
|
||||
showPeerSipUri.value = true
|
||||
return true
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun updateSubject(newSubject: String) {
|
||||
coreContext.postOnCoreThread {
|
||||
|
|
@ -531,6 +542,7 @@ class ConversationInfoViewModel @UiThread constructor() : AbstractConversationVi
|
|||
}
|
||||
|
||||
subject.postValue(chatRoom.subject)
|
||||
peerSipUri.postValue(chatRoom.peerAddress.asStringUriOnly())
|
||||
|
||||
val firstParticipant = chatRoom.participants.firstOrNull()
|
||||
if (firstParticipant != null) {
|
||||
|
|
|
|||
|
|
@ -138,6 +138,10 @@ class AccountProfileFragment : GenericMainFragment() {
|
|||
copyAddressToClipboard(viewModel.sipAddress.value.orEmpty())
|
||||
}
|
||||
|
||||
binding.setCopyDeviceIdClickListener {
|
||||
copyAddressToClipboard(viewModel.deviceId.value.orEmpty())
|
||||
}
|
||||
|
||||
binding.setPrefixTooltipClickListener {
|
||||
showHelpPopup()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,10 @@ class AccountProfileViewModel @UiThread constructor() : GenericViewModel() {
|
|||
|
||||
val hideAccountSettings = MutableLiveData<Boolean>()
|
||||
|
||||
val deviceId = MutableLiveData<String>()
|
||||
|
||||
val showDeviceId = MutableLiveData<Boolean>()
|
||||
|
||||
val accountRemovedEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
|
@ -146,8 +150,9 @@ class AccountProfileViewModel @UiThread constructor() : GenericViewModel() {
|
|||
init {
|
||||
expandDetails.value = true
|
||||
expandDevices.value = false
|
||||
showDeviceId.value = false
|
||||
|
||||
coreContext.postOnCoreThread { core ->
|
||||
coreContext.postOnCoreThread {
|
||||
hideAccountSettings.postValue(corePreferences.hideAccountSettings)
|
||||
dialPlansLabelList.add("") // To allow removing selected dial plan
|
||||
|
||||
|
|
@ -230,6 +235,7 @@ class AccountProfileViewModel @UiThread constructor() : GenericViewModel() {
|
|||
selectedDialPlan.postValue(index)
|
||||
}
|
||||
}
|
||||
deviceId.postValue(account.contactAddress?.getUriParam("gr"))
|
||||
|
||||
accountFoundEvent.postValue(Event(true))
|
||||
} else {
|
||||
|
|
@ -366,4 +372,10 @@ class AccountProfileViewModel @UiThread constructor() : GenericViewModel() {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun showDebugInfo(): Boolean {
|
||||
showDeviceId.value = true
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
<variable
|
||||
name="copySipUriClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="copyDeviceIdClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="prefixTooltipClickListener"
|
||||
type="View.OnClickListener" />
|
||||
|
|
@ -59,15 +62,23 @@
|
|||
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="@string/manage_account_title"
|
||||
android:textColor="?attr/color_main1_500"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/show_menu"
|
||||
app:layout_constraintStart_toEndOf="@id/back"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/show_menu"
|
||||
android:onLongClick="@{() -> viewModel.showDebugInfo()}"
|
||||
android:layout_width="@dimen/top_bar_height"
|
||||
android:layout_height="@dimen/top_bar_height"
|
||||
android:contentDescription="@string/content_description_show_popup_menu"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
|
|
@ -219,11 +230,49 @@
|
|||
android:ellipsize="end"
|
||||
android:drawableEnd="@drawable/copy"
|
||||
android:drawablePadding="5dp"
|
||||
app:drawableTint="?attr/color_main2_600"
|
||||
app:layout_constraintStart_toEndOf="@id/sip_address_label"
|
||||
app:layout_constraintEnd_toEndOf="@id/details_background"
|
||||
app:layout_constraintTop_toTopOf="@id/sip_address_label"
|
||||
app:layout_constraintBottom_toBottomOf="@id/sip_address_label"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/header_style"
|
||||
android:id="@+id/device_id_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="@string/device_id"
|
||||
android:visibility="@{viewModel.showDeviceId ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintStart_toStartOf="@id/details_background"
|
||||
app:layout_constraintTop_toBottomOf="@id/sip_address"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/device_id"
|
||||
android:onClick="@{copyDeviceIdClickListener}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="@={viewModel.deviceId, default=`1234`}"
|
||||
android:textSize="13sp"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:drawableEnd="@drawable/copy"
|
||||
android:drawablePadding="5dp"
|
||||
app:drawableTint="?attr/color_main2_600"
|
||||
android:visibility="@{viewModel.showDeviceId ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintStart_toEndOf="@id/device_id_label"
|
||||
app:layout_constraintEnd_toEndOf="@id/details_background"
|
||||
app:layout_constraintTop_toTopOf="@id/device_id_label"
|
||||
app:layout_constraintBottom_toBottomOf="@id/device_id_label"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/header_style"
|
||||
android:id="@+id/display_name_label"
|
||||
|
|
@ -235,7 +284,7 @@
|
|||
android:paddingBottom="8dp"
|
||||
android:text="@string/sip_address_display_name"
|
||||
app:layout_constraintStart_toStartOf="@id/details_background"
|
||||
app:layout_constraintTop_toBottomOf="@id/sip_address"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/device_id"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
|
|
|
|||
|
|
@ -27,6 +27,12 @@
|
|||
<variable
|
||||
name="deleteHistoryClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="copySipUriClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="copyPeerSipUriClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.chat.viewmodel.ConversationInfoViewModel" />
|
||||
|
|
@ -57,12 +63,19 @@
|
|||
android:visibility="invisible"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/top_bar_height"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/show_menu"
|
||||
app:layout_constraintStart_toEndOf="@id/back"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/show_menu"
|
||||
android:onLongClick="@{() -> viewModel.showDebugInfo()}"
|
||||
android:layout_width="@dimen/top_bar_height"
|
||||
android:layout_height="@dimen/top_bar_height"
|
||||
android:contentDescription="@string/content_description_show_popup_menu"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="0dp"
|
||||
|
|
@ -123,6 +136,7 @@
|
|||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/address"
|
||||
style="@style/default_text_style"
|
||||
android:onClick="@{copySipUriClickListener}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -132,11 +146,35 @@
|
|||
android:text="@{viewModel.sipUri, default=`sip:john.doe@sip.example.org`}"
|
||||
android:textColor="?attr/color_main2_700"
|
||||
android:textSize="14sp"
|
||||
android:drawableEnd="@drawable/copy"
|
||||
android:drawablePadding="5dp"
|
||||
android:visibility="@{viewModel.isGroup ? View.GONE : View.VISIBLE, default=gone}"
|
||||
app:drawableTint="?attr/color_main2_600"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/peer_address"
|
||||
style="@style/default_text_style"
|
||||
android:onClick="@{copyPeerSipUriClickListener}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:text="@{viewModel.peerSipUri, default=`sip:chatroom-xxxx@sip.example.org`}"
|
||||
android:textColor="?attr/color_main2_700"
|
||||
android:textSize="14sp"
|
||||
android:drawableEnd="@drawable/copy"
|
||||
android:drawablePadding="5dp"
|
||||
android:visibility="@{viewModel.showPeerSipUri ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:drawableTint="?attr/color_main2_600"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/address" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/status"
|
||||
style="@style/default_text_style_300"
|
||||
|
|
@ -148,7 +186,7 @@
|
|||
android:visibility="@{viewModel.isGroup || viewModel.avatarModel.presenceStatus == ConsolidatedPresence.Offline ? View.GONE : View.VISIBLE, default=gone}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/address" />
|
||||
app:layout_constraintTop_toBottomOf="@id/peer_address" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mute"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Common words -->
|
||||
<string name="sip_address">Adresse SIP</string>
|
||||
<string name="device_id">ID du téléphone</string>
|
||||
<string name="sip_address_hint">utilisateur@domaine</string>
|
||||
<string name="sip_address_display_name">Nom d\'affichage</string>
|
||||
<string name="sip_address_domain">Domaine</string>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
<!-- Common words -->
|
||||
<string name="sip_address">SIP address</string>
|
||||
<string name="device_id">Device ID</string>
|
||||
<string name="sip_address_hint">username@domain</string>
|
||||
<string name="sip_address_display_name">Display name</string>
|
||||
<string name="sip_address_domain">Domain</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue