diff --git a/build.gradle b/build.gradle index 91632f6f7f..aa4a4cb035 100644 --- a/build.gradle +++ b/build.gradle @@ -131,6 +131,7 @@ dependencies { implementation 'com.github.Priyansh-Kedia:OpenGraphParser:2.5.6' implementation 'com.github.p32929:AndroidAppLockscreen:1.2' implementation 'com.github.bumptech.glide:glide:4.16.0' + implementation "com.github.pgreze:android-reactions:1.6" } ext { diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index a4f7aa4ac2..ed36145ef5 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -71,6 +71,9 @@ import androidx.core.graphics.drawable.DrawableCompat; import com.bumptech.glide.Glide; import com.daimajia.swipe.SwipeLayout; +import com.github.pgreze.reactions.ReactionPopup; +import com.github.pgreze.reactions.ReactionsConfig; +import com.github.pgreze.reactions.ReactionsConfigBuilder; import com.google.common.base.Strings; import com.lelloman.identicon.view.GithubIdenticonView; @@ -1679,6 +1682,30 @@ public class MessageAdapter extends ArrayAdapter { } }); } + + ReactionsConfig config = new ReactionsConfigBuilder(activity) + .withReactions(new int[]{ + R.drawable.ic_fb_like, + R.drawable.ic_fb_love, + R.drawable.ic_fb_laugh, + R.drawable.ic_fb_wow, + R.drawable.ic_fb_sad, + R.drawable.ic_fb_angry + }) + .build(); + + ReactionPopup popup = new ReactionPopup(activity, config, (positionReact) -> { + return true; // true is closing popup, false is requesting a new selection + }); + + viewHolder.messageBody.setOnClickListener(v -> { + if (MessageAdapter.this.mOnMessageBoxClickedListener != null) { + MessageAdapter.this.mOnMessageBoxClickedListener + .onContactPictureClicked(message); + } + }); + + viewHolder.contact_picture.setOnClickListener(v -> { if (MessageAdapter.this.mOnContactPictureClickedListener != null) { MessageAdapter.this.mOnContactPictureClickedListener.onContactPictureClicked(message); @@ -1747,14 +1774,12 @@ public class MessageAdapter extends ArrayAdapter { viewHolder.messageBody.setOnTouchListener((v, event) -> { if (event.getAction() == MotionEvent.ACTION_UP) { if (MessageAdapter.this.mOnMessageBoxClickedListener != null) { - MessageAdapter.this.mOnMessageBoxClickedListener - .onContactPictureClicked(message); + popup.onTouch(v, event); } } - - return false; }); + viewHolder.contact_picture.setOnLongClickListener(v -> { if (MessageAdapter.this.mOnContactPictureLongClickedListener != null) { MessageAdapter.this.mOnContactPictureLongClickedListener.onContactPictureLongClicked(v, message); diff --git a/src/main/res/drawable/ic_fb_angry.png b/src/main/res/drawable/ic_fb_angry.png new file mode 100644 index 0000000000..6345b4a982 Binary files /dev/null and b/src/main/res/drawable/ic_fb_angry.png differ diff --git a/src/main/res/drawable/ic_fb_laugh.png b/src/main/res/drawable/ic_fb_laugh.png new file mode 100644 index 0000000000..532ffc8c49 Binary files /dev/null and b/src/main/res/drawable/ic_fb_laugh.png differ diff --git a/src/main/res/drawable/ic_fb_like.png b/src/main/res/drawable/ic_fb_like.png new file mode 100644 index 0000000000..3939bcb0c5 Binary files /dev/null and b/src/main/res/drawable/ic_fb_like.png differ diff --git a/src/main/res/drawable/ic_fb_love.png b/src/main/res/drawable/ic_fb_love.png new file mode 100644 index 0000000000..4ec3905c89 Binary files /dev/null and b/src/main/res/drawable/ic_fb_love.png differ diff --git a/src/main/res/drawable/ic_fb_sad.png b/src/main/res/drawable/ic_fb_sad.png new file mode 100644 index 0000000000..05a4b3faa0 Binary files /dev/null and b/src/main/res/drawable/ic_fb_sad.png differ diff --git a/src/main/res/drawable/ic_fb_wow.png b/src/main/res/drawable/ic_fb_wow.png new file mode 100644 index 0000000000..d3450413a8 Binary files /dev/null and b/src/main/res/drawable/ic_fb_wow.png differ