mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-18 20:08:08 +00:00
Added copy SIP address in account profile
This commit is contained in:
parent
824b225549
commit
37786a0b83
2 changed files with 24 additions and 0 deletions
|
|
@ -19,6 +19,9 @@
|
|||
*/
|
||||
package org.linphone.ui.main.settings.fragment
|
||||
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
|
@ -131,6 +134,10 @@ class AccountProfileFragment : GenericMainFragment() {
|
|||
viewModel.setNewPicturePath("")
|
||||
}
|
||||
|
||||
binding.setCopySipUriClickListener {
|
||||
copyAddressToClipboard(viewModel.sipAddress.value.orEmpty())
|
||||
}
|
||||
|
||||
binding.setPrefixTooltipClickListener {
|
||||
showHelpPopup()
|
||||
}
|
||||
|
|
@ -220,6 +227,16 @@ class AccountProfileFragment : GenericMainFragment() {
|
|||
pickMedia.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly))
|
||||
}
|
||||
|
||||
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.toast_sip_address_copied_to_clipboard)
|
||||
(requireActivity() as GenericActivity).showGreenToast(
|
||||
message,
|
||||
R.drawable.check
|
||||
)
|
||||
}
|
||||
|
||||
private fun setupDialPlanPicker() {
|
||||
val dialPlanIndex = viewModel.selectedDialPlan.value ?: 0
|
||||
Log.i("$TAG Setting default dial plan at index [$dialPlanIndex]")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@
|
|||
<variable
|
||||
name="deleteImageClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="copySipUriClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="prefixTooltipClickListener"
|
||||
type="View.OnClickListener" />
|
||||
|
|
@ -203,15 +206,19 @@
|
|||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/sip_address"
|
||||
android:onClick="@{copySipUriClickListener}"
|
||||
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.sipAddress, default=`sip:johndoe@sip.example.org`}"
|
||||
android:textSize="13sp"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:drawableEnd="@drawable/copy"
|
||||
android:drawablePadding="5dp"
|
||||
app:layout_constraintStart_toEndOf="@id/sip_address_label"
|
||||
app:layout_constraintEnd_toEndOf="@id/details_background"
|
||||
app:layout_constraintTop_toTopOf="@id/sip_address_label"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue