diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index c2fba87a9..3d3ff0719 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -393,6 +393,7 @@
android:name=".ui.MediaBrowserActivity"
android:label="@string/media_browser"
android:exported="false" />
+
finish());
+ setTitle(R.string.add_reaction_title);
+ binding.emojiPicker.setOnEmojiPickedListener(
+ emojiViewItem -> addReaction(emojiViewItem.getEmoji()));
+ }
+
+ private void addReaction(final String emoji) {
+ final var intent = getIntent();
+ final var conversation = intent == null ? null : intent.getStringExtra("conversation");
+ final var message = intent == null ? null : intent.getStringExtra("message");
+ if (Strings.isNullOrEmpty(conversation) || Strings.isNullOrEmpty(message)) {
+ Toast.makeText(this, R.string.could_not_add_reaction, Toast.LENGTH_LONG).show();
+ return;
+ }
+ final var c = xmppConnectionService.findConversationByUuid(conversation);
+ final var m = c == null ? null : c.findMessageWithUuid(message);
+ if (m == null) {
+ Toast.makeText(this, R.string.could_not_add_reaction, Toast.LENGTH_LONG).show();
+ return;
+ }
+ final var aggregated = m.getAggregatedReactions();
+ if (aggregated.ourReactions.contains(emoji)) {
+ xmppConnectionService.sendReactions(m, aggregated.ourReactions);
+ } else {
+ final ImmutableSet.Builder reactionBuilder = new ImmutableSet.Builder<>();
+ reactionBuilder.addAll(aggregated.ourReactions);
+ reactionBuilder.add(emoji);
+ xmppConnectionService.sendReactions(m, reactionBuilder.build());
+ }
+ finish();
+ }
+
+ @Override
+ protected void refreshUiReal() {}
+
+ @Override
+ protected void onBackendConnected() {}
+}
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 3bd1b793a..d02f7b60e 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -360,6 +360,14 @@ public abstract class XmppActivity extends ActionBarActivity {
popupWindow.dismiss();
});
}
+ viewBinding.more.setOnClickListener(
+ v -> {
+ popupWindow.dismiss();
+ final var intent = new Intent(this, AddReactionActivity.class);
+ intent.putExtra("conversation", message.getConversation().getUuid());
+ intent.putExtra("message", message.getUuid());
+ startActivity(intent);
+ });
popupWindow.setAnimationStyle(androidx.appcompat.R.style.Animation_AppCompat_Tooltip);
popupWindow.setBackgroundDrawable(ContextCompat.getDrawable(this,R.drawable.reactions_bubble));
popupWindow.setFocusable(true);
diff --git a/src/main/res/layout/activity_add_reaction.xml b/src/main/res/layout/activity_add_reaction.xml
new file mode 100644
index 000000000..0a963b02c
--- /dev/null
+++ b/src/main/res/layout/activity_add_reaction.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/dialog_add_reaction.xml b/src/main/res/layout/dialog_add_reaction.xml
index 4eda335e2..6546f37f8 100644
--- a/src/main/res/layout/dialog_add_reaction.xml
+++ b/src/main/res/layout/dialog_add_reaction.xml
@@ -1,18 +1,31 @@
-
+
-
-
+ android:padding="?dialogPreferredPadding">
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index b4520c5cc..0d1a16fe6 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -1166,4 +1166,6 @@
Could not add reaction
Add reaction…
Related chats
+ Add reaction
+ More reactions