mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-19 16:19:33 +01:00
Small UI fixes for pinned messages.
This commit is contained in:
committed by
jeffrey-signal
parent
6d01fff7ee
commit
8fd17fd909
@@ -22,6 +22,7 @@ object PinnedContextMenu {
|
|||||||
anchorView: View,
|
anchorView: View,
|
||||||
rootView: ViewGroup = anchorView.rootView as ViewGroup,
|
rootView: ViewGroup = anchorView.rootView as ViewGroup,
|
||||||
message: MmsMessageRecord,
|
message: MmsMessageRecord,
|
||||||
|
isGroup: Boolean,
|
||||||
canUnpin: Boolean,
|
canUnpin: Boolean,
|
||||||
onUnpin: () -> Unit = {},
|
onUnpin: () -> Unit = {},
|
||||||
onCopy: () -> Unit = {},
|
onCopy: () -> Unit = {},
|
||||||
@@ -33,6 +34,7 @@ object PinnedContextMenu {
|
|||||||
anchorView = anchorView,
|
anchorView = anchorView,
|
||||||
rootView = rootView,
|
rootView = rootView,
|
||||||
message = message,
|
message = message,
|
||||||
|
isGroup = isGroup,
|
||||||
canUnpin = canUnpin,
|
canUnpin = canUnpin,
|
||||||
callbacks = object : Callbacks {
|
callbacks = object : Callbacks {
|
||||||
override fun onUnpin() = onUnpin()
|
override fun onUnpin() = onUnpin()
|
||||||
@@ -48,6 +50,7 @@ object PinnedContextMenu {
|
|||||||
anchorView: View,
|
anchorView: View,
|
||||||
rootView: ViewGroup,
|
rootView: ViewGroup,
|
||||||
message: MmsMessageRecord,
|
message: MmsMessageRecord,
|
||||||
|
isGroup: Boolean,
|
||||||
canUnpin: Boolean,
|
canUnpin: Boolean,
|
||||||
callbacks: Callbacks
|
callbacks: Callbacks
|
||||||
) {
|
) {
|
||||||
@@ -97,10 +100,11 @@ object PinnedContextMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val horizontalPosition = if (message.isOutgoing) SignalContextMenu.HorizontalPosition.END else SignalContextMenu.HorizontalPosition.START
|
val horizontalPosition = if (message.isOutgoing) SignalContextMenu.HorizontalPosition.END else SignalContextMenu.HorizontalPosition.START
|
||||||
|
val offsetX = if (message.isOutgoing || !isGroup) 16f else 48f
|
||||||
SignalContextMenu.Builder(anchorView, rootView)
|
SignalContextMenu.Builder(anchorView, rootView)
|
||||||
.preferredHorizontalPosition(horizontalPosition)
|
.preferredHorizontalPosition(horizontalPosition)
|
||||||
.preferredVerticalPosition(SignalContextMenu.VerticalPosition.BELOW)
|
.preferredVerticalPosition(SignalContextMenu.VerticalPosition.BELOW)
|
||||||
.offsetX(DimensionUnit.DP.toPixels(16f).toInt())
|
.offsetX(DimensionUnit.DP.toPixels(offsetX).toInt())
|
||||||
.offsetY(DimensionUnit.DP.toPixels(4f).toInt())
|
.offsetY(DimensionUnit.DP.toPixels(4f).toInt())
|
||||||
.show(actions)
|
.show(actions)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ class PinnedMessagesBottomSheet : FixedRoundedCornerBottomSheetDialogFragment()
|
|||||||
anchorView = itemView,
|
anchorView = itemView,
|
||||||
rootView = itemView.rootView as ViewGroup,
|
rootView = itemView.rootView as ViewGroup,
|
||||||
message = item.conversationMessage.messageRecord as MmsMessageRecord,
|
message = item.conversationMessage.messageRecord as MmsMessageRecord,
|
||||||
|
isGroup = item.conversationMessage.threadRecipient.isPushV2Group,
|
||||||
canUnpin = requireArguments().getBoolean(KEY_CAN_UNPIN),
|
canUnpin = requireArguments().getBoolean(KEY_CAN_UNPIN),
|
||||||
onUnpin = {
|
onUnpin = {
|
||||||
dismiss()
|
dismiss()
|
||||||
|
|||||||
Reference in New Issue
Block a user