Correctly check whether mailto: links can be handled

Similar to the litecoin/bitcoin/flattr stuff, we need to check that a
proper URI can be handled via an intent. This previously just checked
whether the email address could be handled without the mailto: prefix.
This commit is contained in:
Peter Serwylo 2016-12-01 00:04:06 +11:00
parent a0c40bcaae
commit 2e1484bcb2

View File

@ -363,10 +363,10 @@ public class AppDetailsRecyclerViewAdapter
}
// Email button
if (uriIsSetAndCanBeOpened(mApp.email)) {
final String subject = Uri.encode(mContext.getString(R.string.app_details_subject, mApp.name));
String url = "mailto:" + mApp.email + "?subject=" + subject;
addLinkItemView(vh.contentView, R.string.menu_email, R.drawable.ic_email, url);
final String subject = Uri.encode(mContext.getString(R.string.app_details_subject, mApp.name));
String emailUrl = mApp.email == null ? null : ("mailto:" + mApp.email + "?subject=" + subject);
if (uriIsSetAndCanBeOpened(emailUrl)) {
addLinkItemView(vh.contentView, R.string.menu_email, R.drawable.ic_email, emailUrl);
}
} else if (viewType == VIEWTYPE_PERMISSIONS) {
final ExpandableLinearLayoutViewHolder vh = (ExpandableLinearLayoutViewHolder) holder;