aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java21
-rw-r--r--src/main/res/values/strings.xml1
2 files changed, 15 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
index 4919a4251..5dce3fca2 100644
--- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
@@ -1,5 +1,6 @@
package de.pixart.messenger.ui;
+import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -116,12 +117,14 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
intent.setType(Contacts.CONTENT_ITEM_TYPE);
- intent.putExtra(Intents.Insert.IM_HANDLE, contact.getJid().toString());
- intent.putExtra(Intents.Insert.IM_PROTOCOL,
- CommonDataKinds.Im.PROTOCOL_JABBER);
+ intent.putExtra(Intents.Insert.IM_HANDLE, contact.getJid().toEscapedString());
+ intent.putExtra(Intents.Insert.IM_PROTOCOL, CommonDataKinds.Im.PROTOCOL_JABBER);
intent.putExtra("finishActivityOnSaveCompleted", true);
- ContactDetailsActivity.this.startActivityForResult(intent, 0);
- overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
+ try {
+ ContactDetailsActivity.this.startActivityForResult(intent, 0);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(ContactDetailsActivity.this, R.string.no_application_found_to_view_contact, Toast.LENGTH_SHORT).show();
+ }
}
};
@@ -308,8 +311,12 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setDataAndType(systemAccount, Contacts.CONTENT_ITEM_TYPE);
intent.putExtra("finishActivityOnSaveCompleted", true);
- startActivity(intent);
- overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
+ try {
+ startActivity(intent);
+ overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(ContactDetailsActivity.this, R.string.no_application_found_to_view_contact, Toast.LENGTH_SHORT).show();
+ }
}
break;
case R.id.action_block:
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 89cecf15f..4a5b4e3c6 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -805,4 +805,5 @@
<string name="conference_resource_constraint">Resource constraint</string>
<string name="delete_message">Delete message</string>
<string name="conference_destroyed">This group chat has been destroyed</string>
+ <string name="no_application_found_to_view_contact">No application found to view contact</string>
</resources>