mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-20 14:01:22 +02:00
Allow zooming on profile picture and banner #134
This commit is contained in:
@@ -55,6 +55,7 @@ import com.vitorpamplona.amethyst.ui.components.AsyncImageProxy
|
|||||||
import com.vitorpamplona.amethyst.ui.components.DisplayNip05ProfileStatus
|
import com.vitorpamplona.amethyst.ui.components.DisplayNip05ProfileStatus
|
||||||
import com.vitorpamplona.amethyst.ui.components.InvoiceRequest
|
import com.vitorpamplona.amethyst.ui.components.InvoiceRequest
|
||||||
import com.vitorpamplona.amethyst.ui.components.ResizeImage
|
import com.vitorpamplona.amethyst.ui.components.ResizeImage
|
||||||
|
import com.vitorpamplona.amethyst.ui.components.ZoomableImageDialog
|
||||||
import com.vitorpamplona.amethyst.ui.dal.UserProfileConversationsFeedFilter
|
import com.vitorpamplona.amethyst.ui.dal.UserProfileConversationsFeedFilter
|
||||||
import com.vitorpamplona.amethyst.ui.dal.UserProfileFollowersFeedFilter
|
import com.vitorpamplona.amethyst.ui.dal.UserProfileFollowersFeedFilter
|
||||||
import com.vitorpamplona.amethyst.ui.dal.UserProfileFollowsFeedFilter
|
import com.vitorpamplona.amethyst.ui.dal.UserProfileFollowsFeedFilter
|
||||||
@@ -258,6 +259,7 @@ private fun ProfileHeader(
|
|||||||
) {
|
) {
|
||||||
val ctx = LocalContext.current.applicationContext
|
val ctx = LocalContext.current.applicationContext
|
||||||
var popupExpanded by remember { mutableStateOf(false) }
|
var popupExpanded by remember { mutableStateOf(false) }
|
||||||
|
var zoomImageDialogOpen by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
val accountUserState by account.userProfile().live().follows.observeAsState()
|
val accountUserState by account.userProfile().live().follows.observeAsState()
|
||||||
val accountUser = accountUserState?.user ?: return
|
val accountUser = accountUserState?.user ?: return
|
||||||
@@ -317,7 +319,9 @@ private fun ProfileHeader(
|
|||||||
MaterialTheme.colors.background,
|
MaterialTheme.colors.background,
|
||||||
CircleShape),
|
CircleShape),
|
||||||
onClick = {
|
onClick = {
|
||||||
navController.navigate("User/${it.pubkeyHex}")
|
if (baseUser.profilePicture() != null) {
|
||||||
|
zoomImageDialogOpen = true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onLongClick = {
|
onLongClick = {
|
||||||
ResizeImage(it.info?.picture, 100.dp).proxyUrl()?.let { it1 ->
|
ResizeImage(it.info?.picture, 100.dp).proxyUrl()?.let { it1 ->
|
||||||
@@ -358,6 +362,10 @@ private fun ProfileHeader(
|
|||||||
Divider(modifier = Modifier.padding(top = 6.dp))
|
Divider(modifier = Modifier.padding(top = 6.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (zoomImageDialogOpen) {
|
||||||
|
ZoomableImageDialog(baseUser.profilePicture()!!, onDismiss = { zoomImageDialogOpen = false })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -455,6 +463,7 @@ private fun DrawBanner(baseUser: User) {
|
|||||||
|
|
||||||
val banner = user.info?.banner
|
val banner = user.info?.banner
|
||||||
val clipboardManager = LocalClipboardManager.current
|
val clipboardManager = LocalClipboardManager.current
|
||||||
|
var zoomImageDialogOpen by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
if (banner != null && banner.isNotBlank()) {
|
if (banner != null && banner.isNotBlank()) {
|
||||||
AsyncImageProxy(
|
AsyncImageProxy(
|
||||||
@@ -469,7 +478,12 @@ private fun DrawBanner(baseUser: User) {
|
|||||||
clipboardManager.setText(AnnotatedString(banner))
|
clipboardManager.setText(AnnotatedString(banner))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
.clickable { zoomImageDialogOpen = true }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (zoomImageDialogOpen) {
|
||||||
|
ZoomableImageDialog(imageUrl = banner, onDismiss = {zoomImageDialogOpen = false})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(R.drawable.profile_banner),
|
painter = painterResource(R.drawable.profile_banner),
|
||||||
|
Reference in New Issue
Block a user