Added guessing of mailto/tel schemes

pull/203/head
M66B 4 years ago
parent 456a998a04
commit c18e761486

@ -141,14 +141,22 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
final Uri uri; final Uri uri;
if (_uri.getScheme() == null) { if (_uri.getScheme() == null) {
Uri g = Uri.parse(URLUtil.guessUrl(_uri.toString())); String url = _uri.toString();
String scheme = g.getScheme(); if (Helper.EMAIL_ADDRESS.matcher(url).matches())
if (scheme != null) { uri = Uri.parse("mailto:" + _uri.toString());
if ("http".equals(scheme)) else if (android.util.Patterns.PHONE.matcher(url).matches())
scheme = "https"; // Alternative: PhoneNumberUtils.isGlobalPhoneNumber()
uri = Uri.parse(scheme + "://" + _uri.toString()); uri = Uri.parse("tel:" + _uri.toString());
} else else {
uri = _uri; Uri g = Uri.parse(URLUtil.guessUrl(url));
String scheme = g.getScheme();
if (scheme != null) {
if ("http".equals(scheme))
scheme = "https";
uri = Uri.parse(scheme + "://" + _uri.toString());
} else
uri = _uri;
}
} else } else
uri = _uri; uri = _uri;

Loading…
Cancel
Save