mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-20 14:01:22 +02:00
Keeping Quick Action and DropDown similar for now.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.vitorpamplona.amethyst.ui.note
|
package com.vitorpamplona.amethyst.ui.note
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import androidx.compose.foundation.*
|
import androidx.compose.foundation.*
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
@@ -25,11 +26,13 @@ import androidx.compose.ui.platform.LocalContext
|
|||||||
import androidx.compose.ui.platform.LocalUriHandler
|
import androidx.compose.ui.platform.LocalUriHandler
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.AnnotatedString
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import coil.compose.AsyncImage
|
import coil.compose.AsyncImage
|
||||||
import com.google.accompanist.flowlayout.FlowRow
|
import com.google.accompanist.flowlayout.FlowRow
|
||||||
@@ -742,7 +745,8 @@ fun UserPicture(
|
|||||||
@Composable
|
@Composable
|
||||||
fun NoteDropDownMenu(note: Note, popupExpanded: Boolean, onDismiss: () -> Unit, accountViewModel: AccountViewModel) {
|
fun NoteDropDownMenu(note: Note, popupExpanded: Boolean, onDismiss: () -> Unit, accountViewModel: AccountViewModel) {
|
||||||
val clipboardManager = LocalClipboardManager.current
|
val clipboardManager = LocalClipboardManager.current
|
||||||
val context = LocalContext.current.applicationContext
|
val appContext = LocalContext.current.applicationContext
|
||||||
|
val actContext = LocalContext.current
|
||||||
|
|
||||||
DropdownMenu(
|
DropdownMenu(
|
||||||
expanded = popupExpanded,
|
expanded = popupExpanded,
|
||||||
@@ -758,6 +762,33 @@ fun NoteDropDownMenu(note: Note, popupExpanded: Boolean, onDismiss: () -> Unit,
|
|||||||
}
|
}
|
||||||
Divider()
|
Divider()
|
||||||
}
|
}
|
||||||
|
DropdownMenuItem(onClick = { clipboardManager.setText(AnnotatedString(accountViewModel.decrypt(note) ?: "")); onDismiss() }) {
|
||||||
|
Text(stringResource(R.string.copy_text))
|
||||||
|
}
|
||||||
|
DropdownMenuItem(onClick = { clipboardManager.setText(AnnotatedString("@${note.author?.pubkeyNpub()}" ?: "")); onDismiss() }) {
|
||||||
|
Text(stringResource(R.string.copy_user_pubkey))
|
||||||
|
}
|
||||||
|
DropdownMenuItem(onClick = { clipboardManager.setText(AnnotatedString(note.idNote())); onDismiss() }) {
|
||||||
|
Text(stringResource(R.string.copy_note_id))
|
||||||
|
}
|
||||||
|
DropdownMenuItem(onClick = {
|
||||||
|
val sendIntent = Intent().apply {
|
||||||
|
action = Intent.ACTION_SEND
|
||||||
|
type = "text/plain"
|
||||||
|
putExtra(
|
||||||
|
Intent.EXTRA_TEXT,
|
||||||
|
externalLinkForNote(note)
|
||||||
|
)
|
||||||
|
putExtra(Intent.EXTRA_TITLE, actContext.getString(R.string.quick_action_share_browser_link))
|
||||||
|
}
|
||||||
|
|
||||||
|
val shareIntent = Intent.createChooser(sendIntent, appContext.getString(R.string.quick_action_share))
|
||||||
|
ContextCompat.startActivity(actContext, shareIntent, null)
|
||||||
|
onDismiss()
|
||||||
|
}) {
|
||||||
|
Text(stringResource(R.string.quick_action_share))
|
||||||
|
}
|
||||||
|
Divider()
|
||||||
DropdownMenuItem(onClick = { accountViewModel.broadcast(note); onDismiss() }) {
|
DropdownMenuItem(onClick = { accountViewModel.broadcast(note); onDismiss() }) {
|
||||||
Text(stringResource(R.string.broadcast))
|
Text(stringResource(R.string.broadcast))
|
||||||
}
|
}
|
||||||
@@ -773,7 +804,7 @@ fun NoteDropDownMenu(note: Note, popupExpanded: Boolean, onDismiss: () -> Unit,
|
|||||||
note.author?.let {
|
note.author?.let {
|
||||||
accountViewModel.hide(
|
accountViewModel.hide(
|
||||||
it,
|
it,
|
||||||
context
|
appContext
|
||||||
)
|
)
|
||||||
}; onDismiss()
|
}; onDismiss()
|
||||||
}) {
|
}) {
|
||||||
@@ -782,35 +813,35 @@ fun NoteDropDownMenu(note: Note, popupExpanded: Boolean, onDismiss: () -> Unit,
|
|||||||
Divider()
|
Divider()
|
||||||
DropdownMenuItem(onClick = {
|
DropdownMenuItem(onClick = {
|
||||||
accountViewModel.report(note, ReportEvent.ReportType.SPAM)
|
accountViewModel.report(note, ReportEvent.ReportType.SPAM)
|
||||||
note.author?.let { accountViewModel.hide(it, context) }
|
note.author?.let { accountViewModel.hide(it, appContext) }
|
||||||
onDismiss()
|
onDismiss()
|
||||||
}) {
|
}) {
|
||||||
Text(stringResource(R.string.report_spam_scam))
|
Text(stringResource(R.string.report_spam_scam))
|
||||||
}
|
}
|
||||||
DropdownMenuItem(onClick = {
|
DropdownMenuItem(onClick = {
|
||||||
accountViewModel.report(note, ReportEvent.ReportType.PROFANITY)
|
accountViewModel.report(note, ReportEvent.ReportType.PROFANITY)
|
||||||
note.author?.let { accountViewModel.hide(it, context) }
|
note.author?.let { accountViewModel.hide(it, appContext) }
|
||||||
onDismiss()
|
onDismiss()
|
||||||
}) {
|
}) {
|
||||||
Text(stringResource(R.string.report_hateful_speech))
|
Text(stringResource(R.string.report_hateful_speech))
|
||||||
}
|
}
|
||||||
DropdownMenuItem(onClick = {
|
DropdownMenuItem(onClick = {
|
||||||
accountViewModel.report(note, ReportEvent.ReportType.IMPERSONATION)
|
accountViewModel.report(note, ReportEvent.ReportType.IMPERSONATION)
|
||||||
note.author?.let { accountViewModel.hide(it, context) }
|
note.author?.let { accountViewModel.hide(it, appContext) }
|
||||||
onDismiss()
|
onDismiss()
|
||||||
}) {
|
}) {
|
||||||
Text(stringResource(R.string.report_impersonation))
|
Text(stringResource(R.string.report_impersonation))
|
||||||
}
|
}
|
||||||
DropdownMenuItem(onClick = {
|
DropdownMenuItem(onClick = {
|
||||||
accountViewModel.report(note, ReportEvent.ReportType.NUDITY)
|
accountViewModel.report(note, ReportEvent.ReportType.NUDITY)
|
||||||
note.author?.let { accountViewModel.hide(it, context) }
|
note.author?.let { accountViewModel.hide(it, appContext) }
|
||||||
onDismiss()
|
onDismiss()
|
||||||
}) {
|
}) {
|
||||||
Text(stringResource(R.string.report_nudity_porn))
|
Text(stringResource(R.string.report_nudity_porn))
|
||||||
}
|
}
|
||||||
DropdownMenuItem(onClick = {
|
DropdownMenuItem(onClick = {
|
||||||
accountViewModel.report(note, ReportEvent.ReportType.ILLEGAL)
|
accountViewModel.report(note, ReportEvent.ReportType.ILLEGAL)
|
||||||
note.author?.let { accountViewModel.hide(it, context) }
|
note.author?.let { accountViewModel.hide(it, appContext) }
|
||||||
onDismiss()
|
onDismiss()
|
||||||
}) {
|
}) {
|
||||||
Text(stringResource(R.string.report_illegal_behaviour))
|
Text(stringResource(R.string.report_illegal_behaviour))
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
<string name="relay_icon">Relay Icon</string>
|
<string name="relay_icon">Relay Icon</string>
|
||||||
<string name="unknown_author">Unknown Author</string>
|
<string name="unknown_author">Unknown Author</string>
|
||||||
<string name="copy_text">Copy Text</string>
|
<string name="copy_text">Copy Text</string>
|
||||||
<string name="copy_user_pubkey">Copy Author @npub</string>
|
<string name="copy_user_pubkey">Copy Author ID</string>
|
||||||
<string name="copy_note_id">Copy Note ID</string>
|
<string name="copy_note_id">Copy Note ID</string>
|
||||||
<string name="broadcast">Broadcast</string>
|
<string name="broadcast">Broadcast</string>
|
||||||
<string name="block_hide_user"><![CDATA[Block & Hide User]]></string>
|
<string name="block_hide_user"><![CDATA[Block & Hide User]]></string>
|
||||||
|
Reference in New Issue
Block a user