diff options
author | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-12-08 15:12:37 +0100 |
---|---|---|
committer | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-12-08 15:12:37 +0100 |
commit | d6652c571d9167b6966543013297faf5640d03cf (patch) | |
tree | c0ed1da28dd22f91c3f27fc90e4a35160e2da248 /src/main/java/de/pixart | |
parent | 4f0ac410eb6b4e57c3905d1075346fcd3775cc3b (diff) |
add direct answer button in private muc messages
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java index 19bfb7463..9a5540236 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -29,6 +29,7 @@ import android.view.ViewGroup; import android.view.WindowManager; import android.widget.ArrayAdapter; import android.widget.Button; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; @@ -975,6 +976,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie viewHolder.contact_picture = view.findViewById(R.id.message_photo); viewHolder.audioPlayer = view.findViewById(R.id.audio_player); viewHolder.download_button = view.findViewById(R.id.download_button); + viewHolder.answer_button = view.findViewById(R.id.answer); viewHolder.indicator = view.findViewById(R.id.security_indicator); viewHolder.edit_indicator = view.findViewById(R.id.edit_indicator); viewHolder.image = view.findViewById(R.id.message_image); @@ -1146,6 +1148,26 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie } if (type == RECEIVED) { + if (message.isPrivateMessage()) { + viewHolder.answer_button.setVisibility(View.VISIBLE); + viewHolder.answer_button.setImageResource(R.drawable.ic_reply_circle_black_24dp); + viewHolder.answer_button.setOnClickListener(v -> { + try { + if (activity instanceof ConversationsActivity) { + ConversationFragment conversationFragment = ConversationFragment.get(activity); + if (conversationFragment != null) { + activity.invalidateOptionsMenu(); + conversationFragment.privateMessageWith(message.getCounterpart()); + } + } + } catch (Exception e) { + viewHolder.answer_button.setVisibility(View.GONE); + e.printStackTrace(); + } + }); + } else { + viewHolder.answer_button.setVisibility(View.GONE); + } if (isInValidSession) { setBubbleBackgroundColor(viewHolder.message_box, activity.getThemeColor(), type, message.isPrivateMessage(), isInValidSession); viewHolder.encryption.setVisibility(View.GONE); @@ -1299,6 +1321,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie protected LinearLayout message_box; protected Button download_button; protected Button resend_button; + protected ImageButton answer_button; protected ImageView image; protected GifImageView gifImage; protected RichLinkView richlinkview; |