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
commit 907aa7b734
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.core.tween
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
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.NoteCompose
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.ReactionsRow
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)
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun NoteMaster(
baseNote: Note,
@ -211,6 +215,8 @@ fun NoteMaster(
val noteEvent = note?.event
var popupExpanded by remember { mutableStateOf(false) }
if (noteEvent == null) {
BlankNote()
} 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() {
val eventContent = note.event?.content()
@ -343,5 +356,7 @@ fun NoteMaster(
}
}
}
NoteQuickActionMenu(note, popupExpanded, { popupExpanded = false }, accountViewModel)
}
}