diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-02-08 23:28:27 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-02-08 23:28:27 +0100 |
commit | 42c3129b66fe555c37fa67b6421230199cc64968 (patch) | |
tree | dbf28af0310e01d9544d0b1829333382ed2d3887 /src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java | |
parent | 960e20123cf663ee4375acb5c385d43554f1b7e7 (diff) |
catch activity not found when trying to open contact app
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java index 7fc150aa7..91f48c4c4 100644 --- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java @@ -155,8 +155,12 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp } else { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(systemAccount); - 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(); + } } } }; @@ -192,16 +196,16 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp } } builder1.setItems(labels, (dialog1, which1) -> { - final long till; - if (durations[which1] == -1) { - till = Long.MAX_VALUE; - } else { - till = System.currentTimeMillis() + (durations[which1] * 1000); - } - mConversation.setMutedTill(till); - xmppConnectionService.updateConversation(mConversation); - populateView(); - }); + final long till; + if (durations[which1] == -1) { + till = Long.MAX_VALUE; + } else { + till = System.currentTimeMillis() + (durations[which1] * 1000); + } + mConversation.setMutedTill(till); + xmppConnectionService.updateConversation(mConversation); + populateView(); + }); builder1.create().show(); } else { mConversation.setMutedTill(0); @@ -423,9 +427,9 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp binding.addContactButton.setOnClickListener(view -> { final AlertDialog.Builder deleteFromRosterDialog = new AlertDialog.Builder(ContactDetailsActivity.this); deleteFromRosterDialog.setNegativeButton(getString(R.string.cancel), null) - .setTitle(getString(R.string.action_delete_contact)) - .setMessage(JidDialog.style(this, R.string.remove_contact_text, contact.getJid().toEscapedString())) - .setPositiveButton(getString(R.string.delete), removeFromRoster).create().show(); + .setTitle(getString(R.string.action_delete_contact)) + .setMessage(JidDialog.style(this, R.string.remove_contact_text, contact.getJid().toEscapedString())) + .setPositiveButton(getString(R.string.delete), removeFromRoster).create().show(); }); binding.detailsSendPresence.setOnCheckedChangeListener(null); binding.detailsReceivePresence.setOnCheckedChangeListener(null); @@ -570,7 +574,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp if (Config.supportOmemo() && axolotlService != null) { final Collection<XmppAxolotlSession> sessions = axolotlService.findSessionsForContact(contact); boolean anyActive = false; - for(XmppAxolotlSession session : sessions) { + for (XmppAxolotlSession session : sessions) { anyActive = session.getTrust().isActive(); if (anyActive) { break; |