aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-06-24 15:16:01 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-06-24 15:16:01 +0200
commit72a2622c84692f87d528dcff7e356fb38c8b0c4d (patch)
tree57891e7bb43460c65c5f7ed8c84711d663663d30 /src/main/java/eu/siacs
parent97fe14c4beadb650b7db8b7752569b50313f3dd7 (diff)
introduced share button in contact details. remove show qr
Diffstat (limited to 'src/main/java/eu/siacs')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Contact.java9
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java14
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java5
-rw-r--r--src/main/java/eu/siacs/conversations/ui/XmppActivity.java17
4 files changed, 22 insertions, 23 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java
index 9f2dfba9..551b6aab 100644
--- a/src/main/java/eu/siacs/conversations/entities/Contact.java
+++ b/src/main/java/eu/siacs/conversations/entities/Contact.java
@@ -484,15 +484,6 @@ public class Contact implements ListItem, Blockable {
return getOption(Options.FROM) && getOption(Options.TO);
}
- public String getShareableUri() {
- if (getOtrFingerprints().size() >= 1) {
- String otr = getOtrFingerprints().get(0);
- return "xmpp:" + getJid().toBareJid().toString() + "?otr-fingerprint=" + otr;
- } else {
- return "xmpp:" + getJid().toBareJid().toString();
- }
- }
-
@Override
public boolean isBlocked() {
return getAccount().isBlocked(this);
diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
index a39f735e..69154888 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
@@ -284,7 +284,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
}
break;
case R.id.action_share:
- share();
+ shareUri();
break;
case R.id.action_save_as_bookmark:
saveAsBookmark();
@@ -313,18 +313,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
}
}
- private void share() {
- Intent shareIntent = new Intent();
- shareIntent.setAction(Intent.ACTION_SEND);
- shareIntent.putExtra(Intent.EXTRA_TEXT, getShareableUri());
- shareIntent.setType("text/plain");
- try {
- startActivity(Intent.createChooser(shareIntent, getText(R.string.share_uri_with)));
- } catch (ActivityNotFoundException e) {
- Toast.makeText(this, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show();
- }
- }
-
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem menuItemSaveBookmark = menu.findItem(R.id.action_save_as_bookmark);
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
index 16051405..c6df77dc 100644
--- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -181,7 +181,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
@Override
protected String getShareableUri() {
if (contact != null) {
- return contact.getShareableUri();
+ return "xmpp:"+contact.getJid().toBareJid().toString();
} else {
return "";
}
@@ -241,6 +241,9 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
case android.R.id.home:
finish();
break;
+ case R.id.action_share:
+ shareUri();
+ break;
case R.id.action_delete_contact:
builder.setTitle(getString(R.string.action_delete_contact))
.setMessage(
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 47dff719..8955278b 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -8,6 +8,7 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.PendingIntent;
+import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.ComponentName;
@@ -1095,6 +1096,22 @@ public abstract class XmppActivity extends Activity {
return null;
}
+ protected void shareUri() {
+ String uri = getShareableUri();
+ if (uri == null || uri.isEmpty()) {
+ return;
+ }
+ Intent shareIntent = new Intent();
+ shareIntent.setAction(Intent.ACTION_SEND);
+ shareIntent.putExtra(Intent.EXTRA_TEXT, getShareableUri());
+ shareIntent.setType("text/plain");
+ try {
+ startActivity(Intent.createChooser(shareIntent, getText(R.string.share_uri_with)));
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(this, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show();
+ }
+ }
+
@Override
public void onResume() {
super.onResume();