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 | |
parent | 4f0ac410eb6b4e57c3905d1075346fcd3775cc3b (diff) |
add direct answer button in private muc messages
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java | 23 | ||||
-rw-r--r-- | src/main/res/drawable-hdpi/ic_reply_circle_black_24dp.png | bin | 0 -> 602 bytes | |||
-rw-r--r-- | src/main/res/drawable-mdpi/ic_reply_circle_black_24dp.png | bin | 0 -> 502 bytes | |||
-rw-r--r-- | src/main/res/drawable-xhdpi/ic_reply_circle_black_24dp.png | bin | 0 -> 964 bytes | |||
-rw-r--r-- | src/main/res/drawable-xxhdpi/ic_reply_circle_black_24dp.png | bin | 0 -> 1280 bytes | |||
-rw-r--r-- | src/main/res/drawable-xxxhdpi/ic_reply_circle_black_24dp.png | bin | 0 -> 3323 bytes | |||
-rw-r--r-- | src/main/res/layout/message_content.xml | 10 |
7 files changed, 33 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; diff --git a/src/main/res/drawable-hdpi/ic_reply_circle_black_24dp.png b/src/main/res/drawable-hdpi/ic_reply_circle_black_24dp.png Binary files differnew file mode 100644 index 000000000..8a10af07f --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_reply_circle_black_24dp.png diff --git a/src/main/res/drawable-mdpi/ic_reply_circle_black_24dp.png b/src/main/res/drawable-mdpi/ic_reply_circle_black_24dp.png Binary files differnew file mode 100644 index 000000000..575e1fd9e --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_reply_circle_black_24dp.png diff --git a/src/main/res/drawable-xhdpi/ic_reply_circle_black_24dp.png b/src/main/res/drawable-xhdpi/ic_reply_circle_black_24dp.png Binary files differnew file mode 100644 index 000000000..ca61c64e3 --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_reply_circle_black_24dp.png diff --git a/src/main/res/drawable-xxhdpi/ic_reply_circle_black_24dp.png b/src/main/res/drawable-xxhdpi/ic_reply_circle_black_24dp.png Binary files differnew file mode 100644 index 000000000..2ed5097dd --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_reply_circle_black_24dp.png diff --git a/src/main/res/drawable-xxxhdpi/ic_reply_circle_black_24dp.png b/src/main/res/drawable-xxxhdpi/ic_reply_circle_black_24dp.png Binary files differnew file mode 100644 index 000000000..598b7602b --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_reply_circle_black_24dp.png diff --git a/src/main/res/layout/message_content.xml b/src/main/res/layout/message_content.xml index 7a95f3944..147b2952e 100644 --- a/src/main/res/layout/message_content.xml +++ b/src/main/res/layout/message_content.xml @@ -55,6 +55,16 @@ android:longClickable="true" android:visibility="gone" /> + <ImageButton + android:id="@+id/answer" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:layout_gravity="right" + android:alpha="?attr/icon_alpha" + android:background="?android:selectableItemBackground" + android:visibility="gone" /> + <RelativeLayout android:id="@+id/audio_player" android:layout_width="@dimen/audio_player_width" |