aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2019-09-24 20:17:10 +0200
committerChristian Schneppe <christian.schneppe@pix-art.de>2019-09-24 20:17:10 +0200
commit9ce21a8077db22a672bbd3a67a95ebe50b8c50e6 (patch)
tree1b789d13a19e32154340f320fb3711cf75ba8432 /src/main/java
parent59f392a17aed84019a51558aa582a66f567438e3 (diff)
small changes in quotes
* don't show username in single chats * differ between own and foreign quotes
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index ac88e2870..92a018863 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -14,6 +14,8 @@ import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
+
+import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import android.net.Uri;
import android.os.Build;
@@ -1163,7 +1165,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
messageListAdapter = new MessageAdapter((XmppActivity) getActivity(), this.messageList);
messageListAdapter.setOnContactPictureClicked(this);
messageListAdapter.setOnContactPictureLongClicked(this);
- messageListAdapter.setOnQuoteListener(text -> quoteText(text, conversation.getContact().getDisplayName()));
+ messageListAdapter.setOnQuoteListener(text -> quoteText(text, getUsername(selectedMessage)));
binding.messagesView.setAdapter(messageListAdapter);
registerForContextMenu(binding.messagesView);
@@ -1189,8 +1191,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (binding.textinput.isEnabled()) {
String username = "";
if (user != null && user.length() > 0) {
- String res = "*" + user + "*";
- username = getString(R.string.x_has_written, res) + System.getProperty("line.separator");
+ if (user.equals(getString(R.string.me))) {
+ username = getString(R.string.i_have_written) + System.getProperty("line.separator");
+ } else {
+ username = getString(R.string.x_has_written, user) + System.getProperty("line.separator");
+ }
}
binding.textinput.insertAsQuote(username + text);
binding.textinput.requestFocus();
@@ -1213,7 +1218,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
binding.recordVoiceButton.setImageResource(activity.getThemeResource(R.attr.ic_send_voice_offline, R.drawable.ic_send_voice_offline));
}
- private void quoteMessage(Message message, String user) {
+ private void quoteMessage(Message message, @Nullable String user) {
quoteText(MessageUtils.prepareQuote(message), user);
}
@@ -1364,7 +1369,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
ShareUtil.copyLinkToClipboard(activity, selectedMessage);
return true;
case R.id.quote_message:
- quoteMessage(selectedMessage, user);
+ if (conversation.getMode() == Conversation.MODE_MULTI) {
+ quoteMessage(selectedMessage, user);
+ } else {
+ quoteMessage(selectedMessage, null);
+ }
return true;
case R.id.send_again:
resendMessage(selectedMessage);