Catch attempts to dial on devices with no dialer.

This commit is contained in:
Moxie Marlinspike 2013-06-18 14:43:27 -07:00
parent 38565488a4
commit 2928abc98f
2 changed files with 14 additions and 5 deletions

View File

@ -82,6 +82,8 @@
<string name="ConversationActivity_d_recipients_in_group">%d recipients in group</string>
<string name="ConversationActivity_saving_draft">Saving draft...</string>
<string name="ConversationActivity_invalid_recipient">Invalid recipient!</string>
<string name="ConversationActivity_calls_not_supported">Calls Not Supported</string>
<string name="ConversationActivity_this_device_does_not_appear_to_support_dial_actions">This device does not appear to support dial actions.</string>
<!-- ConversationFragment -->
<string name="ConversationFragment_message_details">Message details</string>
@ -525,7 +527,6 @@
<!-- verify_keys -->
<string name="verify_keys__menu_verified">Verified</string>
<!-- EOF -->
</resources>

View File

@ -18,6 +18,7 @@ package org.thoughtcrime.securesms;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
@ -379,11 +380,18 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
}
private void handleDial(Recipient recipient) {
if (recipient == null) return;
try {
if (recipient == null) return;
Intent dialIntent = new Intent(Intent.ACTION_DIAL,
Uri.parse("tel:" + recipient.getNumber()));
startActivity(dialIntent);
Intent dialIntent = new Intent(Intent.ACTION_DIAL,
Uri.parse("tel:" + recipient.getNumber()));
startActivity(dialIntent);
} catch (ActivityNotFoundException anfe) {
Log.w("ConversationActivity", anfe);
Util.showAlertDialog(this,
getString(R.string.ConversationActivity_calls_not_supported),
getString(R.string.ConversationActivity_this_device_does_not_appear_to_support_dial_actions));
}
}
private void handleDisplayGroupRecipients() {