mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 20:49:36 +01:00
copy the message
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
7d381f4ca5
commit
a7997abf57
@ -10,6 +10,8 @@ package com.nextcloud.talk.diagnose
|
|||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
import android.content.ClipboardManager
|
import android.content.ClipboardManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.os.Build
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@ -71,7 +73,6 @@ fun DiagnoseContentComposable(
|
|||||||
onClick = {
|
onClick = {
|
||||||
diagnoseViewModel.fetchTestPushResult()
|
diagnoseViewModel.fetchTestPushResult()
|
||||||
}
|
}
|
||||||
|
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = element.headline,
|
text = element.headline,
|
||||||
@ -121,7 +122,6 @@ fun DiagnoseContentComposable(
|
|||||||
CircularProgressIndicator()
|
CircularProgressIndicator()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showDialog.value) {
|
if (showDialog.value) {
|
||||||
Dialog(
|
Dialog(
|
||||||
onDismissRequest = { diagnoseViewModel.dismissDialog() },
|
onDismissRequest = { diagnoseViewModel.dismissDialog() },
|
||||||
@ -130,58 +130,51 @@ fun DiagnoseContentComposable(
|
|||||||
usePlatformDefaultWidth = false
|
usePlatformDefaultWidth = false
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
if (showDialog.value) {
|
Surface(
|
||||||
Dialog(
|
shape = MaterialTheme.shapes.medium,
|
||||||
onDismissRequest = { diagnoseViewModel.dismissDialog() },
|
tonalElevation = 8.dp,
|
||||||
properties = DialogProperties(
|
modifier = Modifier
|
||||||
dismissOnClickOutside = true,
|
.wrapContentSize()
|
||||||
usePlatformDefaultWidth = false
|
.padding(16.dp)
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.padding(16.dp)) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.nc_test_results),
|
||||||
|
style = MaterialTheme.typography
|
||||||
|
.titleMedium
|
||||||
)
|
)
|
||||||
) {
|
Spacer(modifier = Modifier.height(12.dp))
|
||||||
Surface(
|
Box(
|
||||||
shape = MaterialTheme.shapes.medium,
|
|
||||||
tonalElevation = 8.dp,
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.wrapContentSize()
|
.fillMaxWidth()
|
||||||
.padding(16.dp)
|
.weight(1f, fill = false)
|
||||||
|
.verticalScroll(rememberScrollState())
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(16.dp)) {
|
Text(
|
||||||
Text(
|
modifier = Modifier.padding(top = 8.dp),
|
||||||
text = stringResource(R.string.nc_test_results),
|
text = message.value
|
||||||
style = MaterialTheme.typography
|
)
|
||||||
.titleMedium
|
}
|
||||||
)
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
Spacer(modifier = Modifier.height(12.dp))
|
Row(
|
||||||
Box(
|
horizontalArrangement = Arrangement.SpaceEvenly,
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
) {
|
||||||
.weight(1f, fill = false)
|
TextButton(onClick = { diagnoseViewModel.dismissDialog() }) {
|
||||||
.verticalScroll(rememberScrollState())
|
Text(text = stringResource(R.string.nc_cancel))
|
||||||
) {
|
}
|
||||||
Text(
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
modifier = Modifier.padding(top = 8.dp),
|
TextButton(onClick = {
|
||||||
text = message.value
|
val clipboard =
|
||||||
)
|
context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
}
|
val clip = ClipData.newPlainText("Push Message", message.value)
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
clipboard.setPrimaryClip(clip)
|
||||||
Row(
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
|
||||||
horizontalArrangement = Arrangement.SpaceEvenly,
|
Toast.makeText(context, R.string.message_copied, Toast.LENGTH_SHORT).show()
|
||||||
modifier = Modifier.fillMaxWidth()
|
|
||||||
) {
|
|
||||||
TextButton(onClick = { diagnoseViewModel.dismissDialog() }) {
|
|
||||||
Text(text = stringResource(R.string.nc_cancel))
|
|
||||||
}
|
|
||||||
Spacer(modifier = Modifier.width(8.dp))
|
|
||||||
TextButton(onClick = {
|
|
||||||
val clipboard =
|
|
||||||
context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
|
||||||
val clip = ClipData.newPlainText("Push Message", message.value)
|
|
||||||
clipboard.setPrimaryClip(clip)
|
|
||||||
diagnoseViewModel.dismissDialog()
|
|
||||||
}) {
|
|
||||||
Text(text = stringResource(R.string.nc_common_copy))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
diagnoseViewModel.dismissDialog()
|
||||||
|
}) {
|
||||||
|
Text(text = stringResource(R.string.nc_common_copy))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,6 +230,7 @@ How to translate with transifex:
|
|||||||
<string name="nc_diagnose_flavor" translatable="false">Build flavor</string>
|
<string name="nc_diagnose_flavor" translatable="false">Build flavor</string>
|
||||||
<string name="nc_test_push_button">"Test push notifications</string>
|
<string name="nc_test_push_button">"Test push notifications</string>
|
||||||
<string name="nc_test_results">Test results</string>
|
<string name="nc_test_results">Test results</string>
|
||||||
|
<string name="message_copied">Message copied</string>
|
||||||
|
|
||||||
<!-- Conversation menu -->
|
<!-- Conversation menu -->
|
||||||
<string name="nc_leave">Leave conversation</string>
|
<string name="nc_leave">Leave conversation</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user