mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Fix closed group quote handling bug
This commit is contained in:
parent
b7de9b36ad
commit
93a417d322
@ -730,7 +730,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
|
|
||||||
// `position` is the adapter position; not the visual position
|
// `position` is the adapter position; not the visual position
|
||||||
private fun handleSwipeToReply(message: MessageRecord, position: Int) {
|
private fun handleSwipeToReply(message: MessageRecord, position: Int) {
|
||||||
inputBar.draftQuote(message, glide)
|
inputBar.draftQuote(thread, message, glide)
|
||||||
}
|
}
|
||||||
|
|
||||||
// `position` is the adapter position; not the visual position
|
// `position` is the adapter position; not the visual position
|
||||||
@ -1180,7 +1180,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun reply(messages: Set<MessageRecord>) {
|
override fun reply(messages: Set<MessageRecord>) {
|
||||||
inputBar.draftQuote(messages.first(), glide)
|
inputBar.draftQuote(thread, messages.first(), glide)
|
||||||
endActionMode()
|
endActionMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ import androidx.core.view.isVisible
|
|||||||
import kotlinx.android.synthetic.main.view_input_bar.view.*
|
import kotlinx.android.synthetic.main.view_input_bar.view.*
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.session.libsession.messaging.sending_receiving.link_preview.LinkPreview
|
import org.session.libsession.messaging.sending_receiving.link_preview.LinkPreview
|
||||||
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
|
import org.session.libsession.utilities.recipients.Recipient
|
||||||
import org.thoughtcrime.securesms.conversation.v2.components.LinkPreviewDraftView
|
import org.thoughtcrime.securesms.conversation.v2.components.LinkPreviewDraftView
|
||||||
import org.thoughtcrime.securesms.conversation.v2.components.LinkPreviewDraftViewDelegate
|
import org.thoughtcrime.securesms.conversation.v2.components.LinkPreviewDraftViewDelegate
|
||||||
import org.thoughtcrime.securesms.conversation.v2.messages.QuoteView
|
import org.thoughtcrime.securesms.conversation.v2.messages.QuoteView
|
||||||
@ -105,7 +107,7 @@ class InputBar : RelativeLayout, InputBarEditTextDelegate, QuoteViewDelegate, Li
|
|||||||
// Drafting quotes and drafting link previews is mutually exclusive, i.e. you can't draft
|
// Drafting quotes and drafting link previews is mutually exclusive, i.e. you can't draft
|
||||||
// a quote and a link preview at the same time.
|
// a quote and a link preview at the same time.
|
||||||
|
|
||||||
fun draftQuote(message: MessageRecord, glide: GlideRequests) {
|
fun draftQuote(thread: Recipient, message: MessageRecord, glide: GlideRequests) {
|
||||||
quote = message
|
quote = message
|
||||||
linkPreview = null
|
linkPreview = null
|
||||||
linkPreviewDraftView = null
|
linkPreviewDraftView = null
|
||||||
@ -118,8 +120,9 @@ class InputBar : RelativeLayout, InputBarEditTextDelegate, QuoteViewDelegate, Li
|
|||||||
// quote view content area's start and end margins. This unfortunately has to be calculated manually
|
// quote view content area's start and end margins. This unfortunately has to be calculated manually
|
||||||
// here to get the layout right.
|
// here to get the layout right.
|
||||||
val maxContentWidth = (screenWidth - 2 * resources.getDimension(R.dimen.medium_spacing) - toPx(16, resources) - toPx(30, resources)).roundToInt()
|
val maxContentWidth = (screenWidth - 2 * resources.getDimension(R.dimen.medium_spacing) - toPx(16, resources) - toPx(30, resources)).roundToInt()
|
||||||
quoteView.bind(message.individualRecipient.address.toString(), message.body, attachments,
|
val sender = if (message.isOutgoing) TextSecurePreferences.getLocalNumber(context)!! else message.individualRecipient.address.serialize()
|
||||||
message.recipient, true, maxContentWidth, message.isOpenGroupInvitation, message.threadId, glide)
|
quoteView.bind(sender, message.body, attachments,
|
||||||
|
thread, true, maxContentWidth, message.isOpenGroupInvitation, message.threadId, glide)
|
||||||
// The 6 DP below is the padding the quote view applies to itself, which isn't included in the
|
// The 6 DP below is the padding the quote view applies to itself, which isn't included in the
|
||||||
// intrinsic height calculation.
|
// intrinsic height calculation.
|
||||||
val quoteViewIntrinsicHeight = quoteView.getIntrinsicHeight(maxContentWidth) + toPx(6, resources)
|
val quoteViewIntrinsicHeight = quoteView.getIntrinsicHeight(maxContentWidth) + toPx(6, resources)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user