From 9d67090823a02512dbe0cb938ec3695e72cfdf88 Mon Sep 17 00:00:00 2001 From: ylecollen Date: Fri, 2 Sep 2016 11:40:21 +0200 Subject: [PATCH] Quote in a room : The quote is used in the current room. it is not anymore forwarded. --- .../im/vector/activity/VectorRoomActivity.java | 9 +++++++++ .../fragments/VectorMessageListFragment.java | 15 +++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/activity/VectorRoomActivity.java b/vector/src/main/java/im/vector/activity/VectorRoomActivity.java index 9079d62b9c..2f08bb076b 100755 --- a/vector/src/main/java/im/vector/activity/VectorRoomActivity.java +++ b/vector/src/main/java/im/vector/activity/VectorRoomActivity.java @@ -1684,6 +1684,15 @@ private void appendInTextEditor(String text) { } } + /** + * Init the edited with a provided text + * @param text the text + */ + public void initEditText(String text) { + mEditText.setText(""); + mEditText.append(text); + } + //================================================================================ // Notifications area management (... is typing and so on) //================================================================================ diff --git a/vector/src/main/java/im/vector/fragments/VectorMessageListFragment.java b/vector/src/main/java/im/vector/fragments/VectorMessageListFragment.java index 6cfee122e5..550e35f57b 100755 --- a/vector/src/main/java/im/vector/fragments/VectorMessageListFragment.java +++ b/vector/src/main/java/im/vector/fragments/VectorMessageListFragment.java @@ -300,7 +300,14 @@ public void onClick(DialogInterface dialog, int which) { .show(); } }); - } else if ((action == R.id.ic_action_vector_quote) || (action == R.id.ic_action_vector_share) || (action == R.id.ic_action_vector_forward) || (action == R.id.ic_action_vector_save)) { + } else if (action == R.id.ic_action_vector_quote) { + Activity attachedActivity = getActivity(); + + if ((null != attachedActivity) && (attachedActivity instanceof VectorRoomActivity)) { + Message message = JsonUtils.toMessage(event.content); + ((VectorRoomActivity)attachedActivity).initEditText( "> " + message.body + "\n\n"); + } + } else if ((action == R.id.ic_action_vector_share) || (action == R.id.ic_action_vector_forward) || (action == R.id.ic_action_vector_save)) { // Message message = JsonUtils.toMessage(event.content); @@ -335,11 +342,7 @@ public void onClick(DialogInterface dialog, int which) { final Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); - if (action == R.id.ic_action_vector_quote) { - sendIntent.putExtra(Intent.EXTRA_TEXT, "> " + message.body); - } else { - sendIntent.putExtra(Intent.EXTRA_TEXT, message.body); - } + sendIntent.putExtra(Intent.EXTRA_TEXT, message.body); sendIntent.setType("text/plain"); if ((action == R.id.ic_action_vector_forward) ||(action == R.id.ic_action_vector_quote)) {