aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui/adapter
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-11-11 22:56:28 +0100
committerChristian Schneppe <christian@pix-art.de>2016-11-11 22:56:28 +0100
commit945cea7ce5d7102d35c255e2f09d27ac14fb1620 (patch)
treee31b780be8be5c0035bb6dc9e067885cb60c9491 /src/main/java/de/pixart/messenger/ui/adapter
parentacf3c1f5685b22e6ba404760b09d08de8dea5dd8 (diff)
show button on "xmpp:" uris
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/adapter')
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java24
1 files changed, 24 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 1914df278..3cfc4cfa7 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -313,6 +313,28 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
viewHolder.messageBody.setText(span);
}
+ private void displayXmppMessage(final ViewHolder viewHolder, final String body) {
+ String contact = body.toLowerCase();
+ contact = contact.split(":")[1];
+ contact = contact.split("\\?")[0];
+ String add_contact = activity.getString(R.string.add_to_contact_list) + " (" + contact + ")";
+ viewHolder.aw_player.setVisibility(View.GONE);
+ viewHolder.download_button.setVisibility(View.VISIBLE);
+ viewHolder.download_button.setText(add_contact);
+ viewHolder.download_button.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setData(Uri.parse(body));
+ activity.startActivity(intent);
+ }
+ });
+ viewHolder.image.setVisibility(View.GONE);
+ viewHolder.messageBody.setVisibility(View.GONE);
+
+ }
+
private void displayTextMessage(final ViewHolder viewHolder, final Message message, boolean darkBackground) {
if (viewHolder.download_button != null) {
viewHolder.download_button.setVisibility(View.GONE);
@@ -740,6 +762,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
displayLocationMessage(viewHolder,message);
} else if (message.bodyIsHeart()) {
displayHeartMessage(viewHolder, message.getBody().trim());
+ } else if (message.bodyIsXmpp()) {
+ displayXmppMessage(viewHolder, message.getBody().trim());
} else if (message.treatAsDownloadable() == Message.Decision.MUST ||
message.treatAsDownloadable() == Message.Decision.SHOULD) {
try {