Merge pull request #256 from maxmoney21m/bugfix/note-quick-actions

Add quick action menu in chats and threads
This commit is contained in:
Vitor Pamplona
2023-03-12 10:26:31 -04:00
committed by GitHub
2 changed files with 17 additions and 2 deletions

View File

@ -339,7 +339,7 @@ fun ChatroomMessageCompose(
} }
} }
NoteDropDownMenu(note, popupExpanded, { popupExpanded = false }, accountViewModel) NoteQuickActionMenu(note, popupExpanded, { popupExpanded = false }, accountViewModel)
} }
} }
} }

View File

@ -2,7 +2,9 @@ package com.vitorpamplona.amethyst.ui.screen
import androidx.compose.animation.Crossfade import androidx.compose.animation.Crossfade
import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
@ -56,6 +58,7 @@ import com.vitorpamplona.amethyst.ui.note.HiddenNote
import com.vitorpamplona.amethyst.ui.note.NoteAuthorPicture import com.vitorpamplona.amethyst.ui.note.NoteAuthorPicture
import com.vitorpamplona.amethyst.ui.note.NoteCompose import com.vitorpamplona.amethyst.ui.note.NoteCompose
import com.vitorpamplona.amethyst.ui.note.NoteDropDownMenu import com.vitorpamplona.amethyst.ui.note.NoteDropDownMenu
import com.vitorpamplona.amethyst.ui.note.NoteQuickActionMenu
import com.vitorpamplona.amethyst.ui.note.NoteUsernameDisplay import com.vitorpamplona.amethyst.ui.note.NoteUsernameDisplay
import com.vitorpamplona.amethyst.ui.note.ReactionsRow import com.vitorpamplona.amethyst.ui.note.ReactionsRow
import com.vitorpamplona.amethyst.ui.note.timeAgo import com.vitorpamplona.amethyst.ui.note.timeAgo
@ -187,6 +190,7 @@ fun Modifier.drawReplyLevel(level: Int, color: Color, selected: Color): Modifier
} }
.padding(start = (2 + (level * 3)).dp) .padding(start = (2 + (level * 3)).dp)
@OptIn(ExperimentalFoundationApi::class)
@Composable @Composable
fun NoteMaster( fun NoteMaster(
baseNote: Note, baseNote: Note,
@ -211,6 +215,8 @@ fun NoteMaster(
val noteEvent = note?.event val noteEvent = note?.event
var popupExpanded by remember { mutableStateOf(false) }
if (noteEvent == null) { if (noteEvent == null) {
BlankNote() BlankNote()
} else if (!account.isAcceptable(noteForReports) && !showHiddenNote) { } else if (!account.isAcceptable(noteForReports) && !showHiddenNote) {
@ -314,7 +320,14 @@ fun NoteMaster(
} }
} }
Row(modifier = Modifier.padding(horizontal = 12.dp)) { Row(
modifier = Modifier
.padding(horizontal = 12.dp)
.combinedClickable(
onClick = { },
onLongClick = { popupExpanded = true }
)
) {
Column() { Column() {
val eventContent = note.event?.content() val eventContent = note.event?.content()
@ -343,5 +356,7 @@ fun NoteMaster(
} }
} }
} }
NoteQuickActionMenu(note, popupExpanded, { popupExpanded = false }, accountViewModel)
} }
} }