show toast if no address book app is installed
This commit is contained in:
parent
e27e3ecf92
commit
53a9930837
|
@ -1,5 +1,6 @@
|
||||||
package eu.siacs.conversations.ui;
|
package eu.siacs.conversations.ui;
|
||||||
|
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
@ -98,11 +99,14 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
|
Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
|
||||||
intent.setType(Contacts.CONTENT_ITEM_TYPE);
|
intent.setType(Contacts.CONTENT_ITEM_TYPE);
|
||||||
intent.putExtra(Intents.Insert.IM_HANDLE, contact.getJid().toString());
|
intent.putExtra(Intents.Insert.IM_HANDLE, contact.getJid().toEscapedString());
|
||||||
intent.putExtra(Intents.Insert.IM_PROTOCOL,
|
intent.putExtra(Intents.Insert.IM_PROTOCOL, CommonDataKinds.Im.PROTOCOL_JABBER);
|
||||||
CommonDataKinds.Im.PROTOCOL_JABBER);
|
|
||||||
intent.putExtra("finishActivityOnSaveCompleted", true);
|
intent.putExtra("finishActivityOnSaveCompleted", true);
|
||||||
|
try {
|
||||||
ContactDetailsActivity.this.startActivityForResult(intent, 0);
|
ContactDetailsActivity.this.startActivityForResult(intent, 0);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
Toast.makeText(ContactDetailsActivity.this, R.string.no_application_found_to_view_contact, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -238,7 +242,12 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
|
||||||
Intent intent = new Intent(Intent.ACTION_EDIT);
|
Intent intent = new Intent(Intent.ACTION_EDIT);
|
||||||
intent.setDataAndType(systemAccount, Contacts.CONTENT_ITEM_TYPE);
|
intent.setDataAndType(systemAccount, Contacts.CONTENT_ITEM_TYPE);
|
||||||
intent.putExtra("finishActivityOnSaveCompleted", true);
|
intent.putExtra("finishActivityOnSaveCompleted", true);
|
||||||
|
try {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
Toast.makeText(ContactDetailsActivity.this, R.string.no_application_found_to_view_contact, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.action_block:
|
case R.id.action_block:
|
||||||
|
|
|
@ -328,6 +328,7 @@
|
||||||
<string name="file_deleted">The file has been deleted</string>
|
<string name="file_deleted">The file has been deleted</string>
|
||||||
<string name="no_application_found_to_open_file">No application found to open file</string>
|
<string name="no_application_found_to_open_file">No application found to open file</string>
|
||||||
<string name="no_application_found_to_open_link">No application found to open link</string>
|
<string name="no_application_found_to_open_link">No application found to open link</string>
|
||||||
|
<string name="no_application_found_to_view_contact">No application found to view contact</string>
|
||||||
<string name="pref_show_dynamic_tags">Dynamic Tags</string>
|
<string name="pref_show_dynamic_tags">Dynamic Tags</string>
|
||||||
<string name="pref_show_dynamic_tags_summary">Display read-only tags underneath contacts</string>
|
<string name="pref_show_dynamic_tags_summary">Display read-only tags underneath contacts</string>
|
||||||
<string name="enable_notifications">Enable notifications</string>
|
<string name="enable_notifications">Enable notifications</string>
|
||||||
|
|
Loading…
Reference in a new issue