mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-23 06:08:52 +01:00
Merge pull request #677 from benwaffle/show-who-sent-emojis
Implement tapping emoji to see who reacted
This commit is contained in:
@@ -190,6 +190,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
|||||||
override val confirmDeleteIntent: Subject<List<Long>> = PublishSubject.create()
|
override val confirmDeleteIntent: Subject<List<Long>> = PublishSubject.create()
|
||||||
override val clearCurrentMessageIntent: Subject<Boolean> = PublishSubject.create()
|
override val clearCurrentMessageIntent: Subject<Boolean> = PublishSubject.create()
|
||||||
override val messageLinkAskIntent: Subject<Uri> by lazy { messageAdapter.messageLinkClicks }
|
override val messageLinkAskIntent: Subject<Uri> by lazy { messageAdapter.messageLinkClicks }
|
||||||
|
override val reactionClickIntent: Subject<Long> by lazy { messageAdapter.reactionClicks }
|
||||||
override val speechRecogniserIntent by lazy { speechToTextIcon.clicks() }
|
override val speechRecogniserIntent by lazy { speechToTextIcon.clicks() }
|
||||||
override val shadeIntent by lazy { shadeBackground.clicks() }
|
override val shadeIntent by lazy { shadeBackground.clicks() }
|
||||||
override val recordAudioStartStopRecording: Subject<Boolean> = PublishSubject.create()
|
override val recordAudioStartStopRecording: Subject<Boolean> = PublishSubject.create()
|
||||||
@@ -757,6 +758,13 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
|||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun showReactionsDialog(reactions: List<String>) {
|
||||||
|
AlertDialog.Builder(this)
|
||||||
|
.setTitle(R.string.compose_reactions_title)
|
||||||
|
.setMessage(reactions.joinToString("\n"))
|
||||||
|
.show()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||||
menuInflater.inflate(R.menu.compose, menu)
|
menuInflater.inflate(R.menu.compose, menu)
|
||||||
return super.onCreateOptionsMenu(menu)
|
return super.onCreateOptionsMenu(menu)
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ interface ComposeView : QkView<ComposeState> {
|
|||||||
val confirmDeleteIntent: Observable<List<Long>>
|
val confirmDeleteIntent: Observable<List<Long>>
|
||||||
val clearCurrentMessageIntent: Subject<Boolean>
|
val clearCurrentMessageIntent: Subject<Boolean>
|
||||||
val messageLinkAskIntent: Observable<Uri>
|
val messageLinkAskIntent: Observable<Uri>
|
||||||
|
val reactionClickIntent: Subject<Long>
|
||||||
val speechRecogniserIntent: Observable<*>
|
val speechRecogniserIntent: Observable<*>
|
||||||
val shadeIntent: Observable<Unit>
|
val shadeIntent: Observable<Unit>
|
||||||
val recordAudioStartStopRecording: Subject<Boolean>
|
val recordAudioStartStopRecording: Subject<Boolean>
|
||||||
@@ -111,6 +112,7 @@ interface ComposeView : QkView<ComposeState> {
|
|||||||
fun showQksmsPlusSnackbar(@StringRes message: Int)
|
fun showQksmsPlusSnackbar(@StringRes message: Int)
|
||||||
fun showDeleteDialog( messages: List<Long>)
|
fun showDeleteDialog( messages: List<Long>)
|
||||||
fun showClearCurrentMessageDialog()
|
fun showClearCurrentMessageDialog()
|
||||||
|
fun showReactionsDialog(reactions: List<String>)
|
||||||
fun startSpeechRecognition()
|
fun startSpeechRecognition()
|
||||||
fun focusMessage()
|
fun focusMessage()
|
||||||
}
|
}
|
||||||
@@ -759,6 +759,23 @@ class ComposeViewModel @Inject constructor(
|
|||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe { view.showMessageLinkAskDialog(it) }
|
.subscribe { view.showMessageLinkAskDialog(it) }
|
||||||
|
|
||||||
|
// Show reaction details popup
|
||||||
|
view.reactionClickIntent
|
||||||
|
.mapNotNull { messageId -> messageRepo.getMessage(messageId) }
|
||||||
|
.withLatestFrom(conversation) { message, conv ->
|
||||||
|
message.emojiReactions.map { reaction ->
|
||||||
|
val contactName = conv.recipients
|
||||||
|
.firstOrNull { recipient ->
|
||||||
|
phoneNumberUtils.compare(recipient.address, reaction.senderAddress)
|
||||||
|
}
|
||||||
|
?.getDisplayName()
|
||||||
|
?: reaction.senderAddress
|
||||||
|
"${reaction.emoji} $contactName"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.autoDisposable(view.scope())
|
||||||
|
.subscribe { reactions -> view.showReactionsDialog(reactions) }
|
||||||
|
|
||||||
// Set the current conversation
|
// Set the current conversation
|
||||||
Observables
|
Observables
|
||||||
.combineLatest(
|
.combineLatest(
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ class MessagesAdapter @Inject constructor(
|
|||||||
val sendNowClicks: Subject<Long> = PublishSubject.create()
|
val sendNowClicks: Subject<Long> = PublishSubject.create()
|
||||||
val resendClicks: Subject<Long> = PublishSubject.create()
|
val resendClicks: Subject<Long> = PublishSubject.create()
|
||||||
val partContextMenuRegistrar: Subject<View> = PublishSubject.create()
|
val partContextMenuRegistrar: Subject<View> = PublishSubject.create()
|
||||||
|
val reactionClicks: Subject<Long> = PublishSubject.create()
|
||||||
|
|
||||||
var data: Pair<Conversation, RealmResults<Message>>? = null
|
var data: Pair<Conversation, RealmResults<Message>>? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
@@ -413,27 +414,15 @@ class MessagesAdapter @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
holder.reactionText?.text = reactionText
|
holder.reactionText?.text = reactionText
|
||||||
|
holder.reactionText?.setOnClickListener { reactionClicks.onNext(message.id) }
|
||||||
reactionsContainer.setVisible(true)
|
reactionsContainer.setVisible(true)
|
||||||
makeRoomForEmojis(holder)
|
|
||||||
} else {
|
} else {
|
||||||
reactionsContainer.setVisible(false)
|
reactionsContainer.setVisible(false)
|
||||||
|
holder.reactionText?.setOnClickListener(null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun makeRoomForEmojis(holder: QkViewHolder) {
|
|
||||||
val paddingBottom = 25.dpToPx(context)
|
|
||||||
|
|
||||||
(holder.reactions?.parent?.parent as? ViewGroup)?.let { parent ->
|
|
||||||
parent.setPadding(
|
|
||||||
parent.paddingLeft,
|
|
||||||
parent.paddingTop,
|
|
||||||
parent.paddingRight,
|
|
||||||
paddingBottom
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun bindStatus(
|
private fun bindStatus(
|
||||||
holder: QkViewHolder,
|
holder: QkViewHolder,
|
||||||
bodyTextTruncated: Boolean,
|
bodyTextTruncated: Boolean,
|
||||||
|
|||||||
@@ -23,13 +23,17 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground">
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="36dp"
|
android:layout_marginEnd="36dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -132,10 +136,10 @@
|
|||||||
android:id="@+id/reactions"
|
android:id="@+id/reactions"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignBottom="@id/body"
|
android:layout_below="@id/body"
|
||||||
android:layout_alignEnd="@id/body"
|
android:layout_alignEnd="@id/body"
|
||||||
android:layout_marginEnd="-12dp"
|
android:layout_marginEnd="-12dp"
|
||||||
android:layout_marginBottom="-20dp"
|
android:layout_marginTop="-10dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|||||||
@@ -148,12 +148,13 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<FrameLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="18dp"
|
android:paddingStart="18dp"
|
||||||
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:clipChildren="false">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<dev.octoshrimpy.quik.common.widget.TightTextView
|
<dev.octoshrimpy.quik.common.widget.TightTextView
|
||||||
android:id="@+id/body"
|
android:id="@+id/body"
|
||||||
@@ -171,9 +172,8 @@
|
|||||||
android:id="@+id/reactions"
|
android:id="@+id/reactions"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|start"
|
|
||||||
android:layout_marginStart="-16dp"
|
android:layout_marginStart="-16dp"
|
||||||
android:layout_marginBottom="-20dp"
|
android:layout_marginTop="-10dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
@@ -196,7 +196,7 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|||||||
@@ -154,6 +154,7 @@
|
|||||||
<string name="compose_menu_next">Next</string>
|
<string name="compose_menu_next">Next</string>
|
||||||
<string name="compose_menu_clear">Clear</string>
|
<string name="compose_menu_clear">Clear</string>
|
||||||
<string name="compose_details_title">Message details</string>
|
<string name="compose_details_title">Message details</string>
|
||||||
|
<string name="compose_reactions_title">Reactions</string>
|
||||||
<string name="compose_details_type">Type: %s</string>
|
<string name="compose_details_type">Type: %s</string>
|
||||||
<string name="compose_details_from">From: %s</string>
|
<string name="compose_details_from">From: %s</string>
|
||||||
<string name="compose_details_to">To: %s</string>
|
<string name="compose_details_to">To: %s</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user