mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-24 13:08:33 +00:00
Copy app/SDK version when clicking on it
This commit is contained in:
parent
59aa036875
commit
a7f868fe15
2 changed files with 31 additions and 0 deletions
|
|
@ -20,6 +20,9 @@
|
||||||
package org.linphone.ui.main.help.fragment
|
package org.linphone.ui.main.help.fragment
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException
|
import android.content.ActivityNotFoundException
|
||||||
|
import android.content.ClipData
|
||||||
|
import android.content.ClipboardManager
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
|
@ -65,6 +68,22 @@ class DebugFragment : GenericMainFragment() {
|
||||||
goBack()
|
goBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.setAppVersionClickListener {
|
||||||
|
val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
|
val label = getString(R.string.help_troubleshooting_app_version_title)
|
||||||
|
clipboard.setPrimaryClip(
|
||||||
|
ClipData.newPlainText(label, viewModel.appVersion.value.orEmpty())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.setSdkVersionClickListener {
|
||||||
|
val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
|
val label = getString(R.string.help_troubleshooting_sdk_version_title)
|
||||||
|
clipboard.setPrimaryClip(
|
||||||
|
ClipData.newPlainText(label, viewModel.sdkVersion.value.orEmpty())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
viewModel.debugLogsCleanedEvent.observe(viewLifecycleOwner) {
|
viewModel.debugLogsCleanedEvent.observe(viewLifecycleOwner) {
|
||||||
it.consume {
|
it.consume {
|
||||||
(requireActivity() as GenericActivity).showGreenToast(
|
(requireActivity() as GenericActivity).showGreenToast(
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,12 @@
|
||||||
<variable
|
<variable
|
||||||
name="backClickListener"
|
name="backClickListener"
|
||||||
type="View.OnClickListener" />
|
type="View.OnClickListener" />
|
||||||
|
<variable
|
||||||
|
name="appVersionClickListener"
|
||||||
|
type="View.OnClickListener" />
|
||||||
|
<variable
|
||||||
|
name="sdkVersionClickListener"
|
||||||
|
type="View.OnClickListener" />
|
||||||
<variable
|
<variable
|
||||||
name="viewModel"
|
name="viewModel"
|
||||||
type="org.linphone.ui.main.help.viewmodel.HelpViewModel" />
|
type="org.linphone.ui.main.help.viewmodel.HelpViewModel" />
|
||||||
|
|
@ -100,6 +106,7 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/app_version_icon"
|
android:id="@+id/app_version_icon"
|
||||||
|
android:onClick="@{appVersionClickListener}"
|
||||||
android:layout_width="32dp"
|
android:layout_width="32dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="32dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
|
|
@ -114,6 +121,7 @@
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/header_style"
|
style="@style/header_style"
|
||||||
android:id="@+id/app_version_title"
|
android:id="@+id/app_version_title"
|
||||||
|
android:onClick="@{appVersionClickListener}"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
|
|
@ -127,6 +135,7 @@
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/default_text_style"
|
style="@style/default_text_style"
|
||||||
android:id="@+id/app_version_subtitle"
|
android:id="@+id/app_version_subtitle"
|
||||||
|
android:onClick="@{appVersionClickListener}"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
|
|
@ -140,6 +149,7 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/sdk_version_icon"
|
android:id="@+id/sdk_version_icon"
|
||||||
|
android:onClick="@{sdkVersionClickListener}"
|
||||||
android:layout_width="32dp"
|
android:layout_width="32dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="32dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
|
|
@ -154,6 +164,7 @@
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/header_style"
|
style="@style/header_style"
|
||||||
android:id="@+id/sdk_version_title"
|
android:id="@+id/sdk_version_title"
|
||||||
|
android:onClick="@{sdkVersionClickListener}"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
|
|
@ -167,6 +178,7 @@
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/default_text_style"
|
style="@style/default_text_style"
|
||||||
android:id="@+id/sdk_version_subtitle"
|
android:id="@+id/sdk_version_subtitle"
|
||||||
|
android:onClick="@{sdkVersionClickListener}"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue